/* =============================================================
   WOD timer. Page-only styles, layered on editorial.css + tools.css.
   Type rule (feedback_no_inter_italic): the clock and big numbers are
   Archivo Black italic; every other word is upright Inter.
   Stage colour = phase (see PHASE COLOURS below); setup chrome stays mono.
   ============================================================= */

.wt { padding-top: clamp(48px, 7vw, 88px); padding-bottom: clamp(56px, 8vw, 104px); }
.wt .timer__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px 40px; margin-bottom: 36px; }
.wt .timer__head .h-hero { font-size: clamp(48px, 8vw, 104px); }
.wt .timer__head .lead { max-width: 440px; }

/* ---------- Setup: mode tiles ---------- */
.wt-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .wt-modes { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }
.wt-mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 18px 18px 16px; border-radius: 18px; border: 1px solid #262626; background: #0C0C0D; color: #fff;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
@media (hover: hover) { .wt-mode:hover { border-color: #3F3F46; } }
.wt-mode:active { transform: scale(.98); }
.wt-mode__name { font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; text-transform: uppercase; font-size: 20px; letter-spacing: -0.01em; line-height: 1; }
.wt-mode__desc { font-size: 13px; line-height: 1.35; color: #8A8A93; }
.wt-mode[aria-checked="true"] { background: #fff; border-color: #fff; color: #0A0A0A; }
.wt-mode[aria-checked="true"] .wt-mode__desc { color: #52525B; }
.wt-mode:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- Setup: panel ---------- */
.wt-panel { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 22px; }
@media (min-width: 900px) {
  .wt-panel { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px 40px; align-items: start; }
  .wt-steppers, .wt-labels, .wt-presets { grid-column: 1; }
  .wt-go { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 96px; }
}
.wt-steppers { display: flex; flex-direction: column; border-top: 1px solid #1F1F1F; }
.wt-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #1F1F1F; }
.wt-step__label { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #A0A0A0; }
.wt-step__ctl { display: flex; align-items: center; gap: 6px; }
.wt-step__btn {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid #2E2E2E; background: #111113; color: #fff;
  font-size: 24px; font-weight: 500; line-height: 1; display: grid; place-items: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.wt-step__btn:hover:not(:disabled) { border-color: #52525B; }
.wt-step__btn:active:not(:disabled) { transform: scale(.94); background: #1C1C1E; }
.wt-step__btn:disabled { opacity: .3; cursor: default; }
.wt-step__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.wt-step__val { min-width: 112px; text-align: center; font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; font-size: 30px; letter-spacing: -0.01em; color: #fff; }

.wt-labels { display: none; flex-direction: column; gap: 8px; }
.wt[data-mode="emom"] .wt-labels { display: flex; }
.wt-labels label { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #A0A0A0; }
.wt-labels label span { letter-spacing: 0; text-transform: none; font-weight: 500; color: #6B6B6B; margin-left: 6px; }
.wt-labels input {
  width: 100%; background: #0C0C0D; border: 1px solid #262626; border-radius: 14px; color: #fff;
  font: inherit; font-size: 17px; font-weight: 600; padding: 14px 16px;
}
.wt-labels input:focus { outline: none; border-color: #fff; }

.wt-presets { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -24px; padding: 0 24px; }
.wt-presets::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .wt-presets { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }
.wt-chip {
  flex: none; padding: 10px 16px; border-radius: 100px; border: 1px solid #2E2E2E; background: transparent;
  color: #D4D4D8; font-size: 14px; font-weight: 600; white-space: nowrap; transition: border-color .15s ease, background .15s ease;
}
.wt-chip:hover { border-color: #52525B; }
.wt-chip.is-on { background: #fff; border-color: #fff; color: #0A0A0A; }

.wt-go { display: flex; flex-direction: column; gap: 16px; padding: 22px; border: 1px solid #262626; border-radius: 22px; background: #0C0C0D; }
.wt-summary { display: flex; flex-direction: column; gap: 4px; }
.wt-summary__what { font-size: 17px; font-weight: 700; color: #fff; }
.wt-summary__total { font-size: 14px; color: #8A8A93; font-variant-numeric: tabular-nums; }
.wt-start {
  width: 100%; min-height: 64px; border-radius: 100px; border: 0; background: #fff; color: #0A0A0A;
  font-size: 19px; font-weight: 800; letter-spacing: -0.01em; touch-action: manipulation;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
@media (hover: hover) { .wt-start:hover { background: var(--accent); color: #fff; } }
.wt-start:active { transform: scale(.98); }
.wt-start:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.wt-tools { display: flex; justify-content: center; gap: 22px; }
.wt-tool { background: none; border: 0; padding: 6px 2px; color: #A0A0A0; font-size: 13px; font-weight: 600; border-bottom: 1px solid #333; }
.wt-tool:hover { color: #fff; border-color: #fff; }
.wt-tool[aria-pressed="false"] { color: #6B6B6B; }

/* ---------- Stage: full-viewport takeover ---------- */
html.wt-lock, html.wt-lock body { overflow: hidden; overscroll-behavior: none; }
.wt-stage {
  position: fixed; inset: 0; z-index: 400; background: #000; color: #fff;
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.wt-stage[hidden] { display: none; }

/* PHASE COLOURS, readable from across the room (Elliot 2026-09-24): amber =
   get ready, green = work, red = rest. The colour always means the phase;
   the last three seconds pulse instead of changing colour. These are status
   colours from the web palette, not brand accents, so the one-red rule for
   decoration doesn't apply. The field fills from the bottom in the phase
   colour as the phase runs; the digits carry the same colour. */
.wt { --ph: #FFFFFF; }
.wt[data-phase="lead"] { --ph: #FFB020; }
.wt[data-phase="work"] { --ph: #22E07A; }
.wt[data-phase="rest"] { --ph: #FF4848; }
.wt[data-phase="done"] { --ph: #FFFFFF; }
.wt-field { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.wt-field span {
  position: absolute; inset: 0; transform-origin: bottom center; transform: scaleY(0);
  background: linear-gradient(0deg, color-mix(in srgb, var(--ph) 34%, transparent) 0%, color-mix(in srgb, var(--ph) 10%, transparent) 70%, transparent 100%);
}
.wt[data-phase="done"] .wt-field span { background: linear-gradient(0deg, rgba(255,72,72,.28), rgba(255,122,41,.10) 60%, rgba(255,176,32,0)); }
.wt-stage::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.wt-stage.is-flash::after { animation: wtFlash .5s ease-out; }
@keyframes wtFlash { 0% { opacity: .5; } 100% { opacity: 0; } }

.wt-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.wt-top__mode { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: #A0A0A0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt-top__icons { display: flex; gap: 6px; flex: none; }
.wt-icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid #262626; background: rgba(0,0,0,.4); color: #fff; display: grid; place-items: center; }
.wt-icon svg { width: 20px; height: 20px; }
.wt-icon[hidden] { display: none; }
.wt-icon .wt-mute { display: none; }
.wt-icon[aria-pressed="false"] .wt-wave { display: none; }
.wt-icon[aria-pressed="false"] .wt-mute { display: inline; }
.wt-icon:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* The face is one big button: tap anywhere to pause. */
.wt-face {
  position: relative; z-index: 1; min-height: 0; border: 0; background: none; color: inherit; padding: 0 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; touch-action: manipulation;
}
.wt-face:focus { outline: none; }
.wt-face:focus-visible .wt-clock { text-decoration: underline; text-decoration-thickness: 2px; }
.wt-phase { font-size: clamp(14px, 2.2vh, 20px); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #fff; }
.wt-phase { color: var(--ph); }
.wt-clock {
  display: block; white-space: nowrap; line-height: .86;
  font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; letter-spacing: 0;
  font-size: min(27vw, 34vh); color: var(--ph); transition: color .25s ease, transform .2s ease;
}
.wt-clock i { display: inline-block; width: .66em; text-align: center; font-style: italic; }
.wt-clock i.wt-colon { width: .3em; }
.wt[data-mode="fortime"] .wt-clock, .wt[data-mode="amrap"] .wt-clock { font-size: min(25vw, 27vh); }
.wt.is-urgent .wt-clock { animation: wtPulse 1s ease-in-out infinite; }
@keyframes wtPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: .72; } }
.wt-label { font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; text-transform: uppercase; font-size: clamp(26px, 6vh, 56px); letter-spacing: -0.01em; line-height: 1; }
.wt-label[hidden] { display: none; }
.wt-sub { font-size: clamp(15px, 2.2vh, 20px); font-weight: 600; color: #A0A0A0; min-height: 1.2em; }
.wt-hint { font-size: 12px; font-weight: 600; color: #52525B; min-height: 1.2em; }

/* Rounds: the bottom of the screen is one giant target. Tap +1, hold to undo. */
.wt-rounds {
  position: relative; z-index: 1; display: none; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 14px 14px; padding: 18px 24px; min-height: clamp(96px, 20vh, 180px);
  border-radius: 24px; border: 1px solid #262626; background: rgba(20,20,22,.85); color: #fff;
  touch-action: manipulation; -webkit-touch-callout: none;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.wt[data-mode="fortime"] .wt-rounds, .wt[data-mode="amrap"] .wt-rounds { display: flex; }
.wt-rounds:active { transform: scale(.985); background: #1C1C1E; border-color: #3F3F46; }
.wt-rounds__n { font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; font-size: clamp(56px, 11vh, 110px); line-height: .9; }
.wt-rounds__t { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.wt-rounds__t span { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #8A8A93; }
.wt-rounds.is-bump .wt-rounds__n { animation: wtBump .3s ease; }
@keyframes wtBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.wt-rounds:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.wt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: 3; background: rgba(255,255,255,.06); }
.wt-bar span { display: block; height: 100%; background: var(--ph); transform-origin: left center; transform: scaleX(0); }

/* Paused / done sheet */
.wt-sheet {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; text-align: center; background: rgba(0,0,0,.72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: wtIn .25s ease;
}
.wt-sheet[hidden] { display: none; }
@keyframes wtIn { from { opacity: 0; } to { opacity: 1; } }
.wt-sheet__kicker { font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; text-transform: uppercase; font-size: min(10vh, 17vw, 96px); line-height: .9; }
.wt-sheet[data-kind="done"] .wt-sheet__kicker { font-family: 'Inter', sans-serif; font-style: normal; font-size: 15px; font-weight: 800; letter-spacing: 1.2px; color: #A1A1AA; }
.wt-sheet__result { font-family: 'Archivo Black', 'Inter', sans-serif; font-style: italic; text-transform: uppercase; font-size: min(11vh, 16vw, 120px); color: #fff; line-height: .92; }
.wt-sheet__result:empty { display: none; }
.wt-sheet__actions { display: flex; flex-direction: column; gap: 10px; width: min(360px, 100%); margin-top: 12px; }
.wt-ghost { min-height: 54px; border-radius: 100px; border: 1px solid #3F3F46; background: transparent; color: #fff; font-size: 16px; font-weight: 700; }
.wt-ghost:hover { border-color: #fff; }
.wt-ghost[hidden] { display: none; }
.wt-sheet__fiz { margin-top: 10px; font-size: 14px; color: #A0A0A0; }
.wt-sheet__fiz b { color: #fff; border-bottom: 1px solid #fff; }
.wt-sheet__fiz[hidden] { display: none; }

/* Desktop: the stage is still full-viewport, just roomier. */
@media (min-width: 900px) {
  .wt-top { padding: 22px 28px; }
  .wt-clock { font-size: min(24vw, 44vh); }
  .wt[data-mode="fortime"] .wt-clock, .wt[data-mode="amrap"] .wt-clock { font-size: min(22vw, 36vh); }
  .wt-rounds { margin: 0 auto 28px; width: min(760px, calc(100% - 56px)); }
}

/* Landscape phone propped on the floor: rounds move to the side. */
@media (orientation: landscape) and (max-height: 540px) {
  .wt-stage { grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; }
  .wt-top { grid-column: 1 / -1; padding: 8px 16px; }
  .wt-face { grid-row: 2; gap: 4px; }
  .wt-clock, .wt[data-mode="fortime"] .wt-clock, .wt[data-mode="amrap"] .wt-clock { font-size: min(20vw, 52vh); }
  .wt-rounds { grid-row: 2; grid-column: 2; flex-direction: column; justify-content: center; min-height: 0; width: 170px; margin: 0 14px 14px 0; }
  .wt-rounds__t { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .wt-mode, .wt-start, .wt-step__btn, .wt-rounds, .wt-clock, .wt-field span { transition: none; }
  .wt.is-urgent .wt-clock, .wt-rounds.is-bump .wt-rounds__n, .wt-sheet { animation: none; }
}
