/* Focus Timer styles. Loaded by both apps via ../shared/timer.css.
   The accent colour is driven by the --ft-color custom property, set on the
   overlay when the timer is opened so the ring matches the calendar. Colours
   fall back to the apps' own theme variables where they exist. */

.ft-overlay {
  position: absolute;                  /* pinned inside the app's phone card */
  inset: 0;
  z-index: 100;                        /* above the card's views/sheets */
  --ft-color: var(--accent, #e0533d);
  --ft-hi: color-mix(in srgb, var(--ft-color) 60%, #ffffff);   /* gradient light */
  --ft-lo: color-mix(in srgb, var(--ft-color) 82%, #000000);   /* gradient deep */
  display: flex;
  flex-direction: column;
  background: var(--bg, #ffffff);
  color: var(--ink, #111111);
  border-radius: 28px;                 /* match the card's rounded corners */
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  animation: ft-fade 0.18s ease-out;
}
.ft-overlay[hidden] { display: none; }

@keyframes ft-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Top bar: ✕ · [ Timer | Stopwatch ] ---- */
.ft-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 8px;
  flex: 0 0 auto;
}
.ft-x {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--ink, #111);
  cursor: pointer;
  border-radius: 50%;
}
.ft-x svg { width: 24px; height: 24px; }
.ft-x:active { background: var(--line, #ececec); }

.ft-tabs {
  display: inline-flex;
  background: var(--line, #ececec);
  border-radius: 999px;
  padding: 3px;
}
.ft-tab {
  border: 0;
  background: none;
  color: var(--faded, #8a8a8a);
  font-size: 15px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.ft-tab.is-active {
  background: var(--bg, #fff);
  color: var(--ink, #111);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---- Panels: each fills the space below the bar and centres its content ---- */
.ft-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 20px;
  min-height: 0;
}
.ft-panel[hidden] { display: none; }

/* ---- Preset chooser ---- */
.ft-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 360px;
}
.ft-preset {
  border: 1.5px solid var(--line, #ececec);
  background: var(--bg, #fff);
  color: var(--ink, #111);
  font-size: 18px;
  font-weight: 600;
  padding: 20px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.06s;
}
.ft-preset:active { transform: scale(0.97); }
.ft-preset:hover { border-color: var(--ft-color); }
.ft-preset--custom {
  grid-column: 1 / -1;
  color: var(--ft-color);
  border-color: var(--ft-color);
}

.ft-soon { color: var(--faded, #8a8a8a); font-size: 16px; }

/* ---- Custom H:M:S wheels ---- */
.ft-wheels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ft-wheelcol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ft-wheellabel { font-size: 12px; color: var(--faded, #8a8a8a); text-transform: uppercase; letter-spacing: 0.04em; }
.ft-colon { font-size: 26px; font-weight: 600; color: var(--faded, #8a8a8a); align-self: flex-start; margin-top: 68px; }

.ft-wheel {
  position: relative;
  width: 68px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
  touch-action: none;
}
.ft-wheel__band {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 1px solid var(--line, #ececec);
  border-bottom: 1px solid var(--line, #ececec);
  pointer-events: none;
}
.ft-wheel__item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--faded, #b8b8b8);
  cursor: pointer;
}
.ft-wheel__item.is-active { color: var(--ink, #111); font-weight: 600; }

.ft-save {
  border: 0;
  background: var(--ft-color);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  padding: 15px 48px;
  border-radius: 999px;
  cursor: pointer;
}
.ft-save:active { filter: brightness(0.94); }

/* ---- Running: ring + digital time + pause ---- */
.ft-ringwrap {
  position: relative;
  width: min(76vw, 300px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
}
.ft-ringsvg { width: 100%; height: 100%; overflow: visible; }

/* Gradient stops (lighter -> darker of the calendar colour). */
.ft-stop-hi { stop-color: var(--ft-hi); }
.ft-stop-lo { stop-color: var(--ft-lo); }

.ft-track { stroke: var(--line, #ececec); stroke-width: 2; opacity: 0.7; }

/* The fine tick dial: faint by default, lit with the gradient up to the
   remaining fraction. */
.ft-tick {
  stroke: var(--line, #e4e4e4);
  stroke-width: 2;
  transition: stroke 0.25s linear;
}
.ft-tick.is-on {
  stroke: url(#ft-grad);
  stroke-width: 2.6;
}

.ft-arc {
  stroke: var(--ft-color);            /* fallback if url(#ft-grad) is unsupported */
  stroke: url(#ft-grad);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--ft-color) 45%, transparent));
}
.ft-pointer {
  fill: var(--ft-lo);
  fill: url(#ft-grad);
  transition: transform 0.3s linear;
}
.ft-ring {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.ft-display {
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.ft-play {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid var(--ft-color);
  background: var(--bg, #fff);
  color: var(--ft-color);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ft-play svg { width: 30px; height: 30px; }
.ft-play:active { background: color-mix(in srgb, var(--ft-color) 12%, var(--bg, #fff)); }

/* ---- Finished state: gently flash the readout until dismissed ---- */
.ft-overlay.is-done .ft-display { animation: ft-flash 1s ease-in-out infinite; }
.ft-overlay.is-done .ft-arc { stroke: var(--ft-color); opacity: 0.9; }
@keyframes ft-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .ft-overlay, .ft-arc, .ft-overlay.is-done .ft-display { animation: none; transition: none; }
}

/* ---- Stopwatch ---- */
.ft-defs { position: absolute; width: 0; height: 0; }   /* the shared gradient holder */

/* The stopwatch stacks ring, buttons and a scrolling lap list. */
.ft-stopwatch {
  justify-content: flex-start;
  gap: 20px;
  padding-top: 24px;
}
.ft-display--sw {
  font-size: clamp(28px, 8.5vw, 40px);   /* a touch smaller — it carries hundredths */
}

.ft-sw-btns {
  display: flex;
  gap: 40px;
  align-items: center;
}
.ft-sw-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ft-sw-btn--primary {
  background: var(--ft-color);
  color: #fff;
}
.ft-sw-btn--secondary {
  background: var(--line, #ececec);
  color: var(--ink, #111);
}
.ft-sw-btn:active { filter: brightness(0.94); }
.ft-sw-btn:disabled { opacity: 0.45; cursor: default; filter: none; }

/* Lap list: newest on top, scrolls inside its own area. */
.ft-sw-laps {
  flex: 1 1 auto;
  width: 100%;
  max-width: 360px;
  overflow-y: auto;
  min-height: 0;
}
.ft-lap {
  display: flex;
  justify-content: space-between;
  padding: 12px 6px;
  border-top: 1px solid var(--line, #ececec);
  font-size: 15px;
}
.ft-lap__n { color: var(--faded, #8a8a8a); }
.ft-lap__t { font-variant-numeric: tabular-nums; color: var(--ink, #111); }
