/* FTN Clock — a beautiful, shareable clock for any screen. Lives on the same dark, ambient
   foundation as FTN Display (css/components/display.css) since both are "ambient utility"
   surfaces, but composed for exactly one job: be worth staring at from across a room. */

.clock-screen {
  background: var(--color-black);
  color: var(--color-white);
  min-height: calc(100vh - 1px);
  display: flex;
  flex-direction: column;
  padding: 21px max(13px, calc((100vw - 1400px) / 2)) 34px;
}

.clock-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  flex-wrap: wrap;
}

.clock-topbar__mark {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-red-on-dark);
  font-size: 14px;
}

.clock-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.clock-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 21px;
  min-height: 0;
  padding: 34px 0;
  transition: background 0.4s ease;
}

.clock-screen[data-clock-bg="accent"] .clock-stage {
  background: radial-gradient(ellipse at center, rgba(225, 6, 19, 0.16), transparent 65%);
}

.clock-face { display: flex; align-items: center; justify-content: center; }

/* An author-origin `display` declaration beats the UA stylesheet's [hidden]{display:none} rule
   regardless of selector specificity (origin is compared before specificity) -- so the rule
   above was silently keeping the digital and minimal faces rendered underneath the analog one
   any time [hidden] was toggled by clock-page.js, producing three simultaneous time displays
   instead of the one primary face the mode switcher is meant to select. */
.clock-face[hidden] { display: none; }

/* ---- Analog ---- */
.clock-analog-svg {
  width: min(52vh, 420px, 80vw);
  height: min(52vh, 420px, 80vw);
}

.clock-analog__dial {
  fill: rgba(255, 255, 255, 0.02);
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.5;
}

.clock-analog-tick {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
}

.clock-analog-tick--major {
  stroke: var(--color-white);
  stroke-width: 2.5;
}

.clock-hand {
  stroke-linecap: round;
  transform-origin: 100px 100px;
  transition: transform 0.2s cubic-bezier(0.4, 2.2, 0.2, 1);
}

.clock-hand--hour { stroke: var(--color-white); stroke-width: 5; }
.clock-hand--minute { stroke: var(--color-white); stroke-width: 3.5; }
.clock-hand--second { stroke: var(--color-red-on-dark); stroke-width: 1.5; }

.clock-analog__pivot { fill: var(--color-red-on-dark); }

@media (prefers-reduced-motion: reduce) {
  .clock-hand { transition: none; }
}

/* ---- Digital ---- */
.clock-digital__time {
  font-family: var(--font-heading);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 4vw + 2rem, 8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.clock-digital__meridiem {
  font-size: 0.28em;
  font-weight: 700;
  color: var(--color-silver);
  letter-spacing: 0.06em;
}

/* ---- Minimal ---- */
.clock-minimal__time {
  font-family: var(--font-heading);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 8vw + 2rem, 11rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.clock-date {
  color: var(--color-silver);
  font-size: 15px;
  letter-spacing: 0.02em;
  margin: 0;
}

.clock-worldnow {
  display: flex;
  gap: 21px;
  flex-wrap: wrap;
  justify-content: center;
}

.clock-worldnow__item {
  text-align: center;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.clock-worldnow__item span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-silver); }
.clock-worldnow__item strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- Radio ---- */
.clock-radio {
  width: min(720px, 100%);
  margin: 0 auto 21px;
}

.clock-radio__indicator {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: var(--color-white);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.clock-radio__note { color: var(--color-red-on-dark); font-size: 16px; }
.clock-radio__expand { margin-left: auto; color: var(--color-silver); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }

.clock-radio__shell { margin-top: 13px; }

/* ---- Personalize panel ---- */
.clock-personalize {
  width: min(720px, 100%);
  margin: 0 auto 21px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-16);
  padding: 21px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Same author-vs-UA-origin cascade issue as .clock-face above: this panel starts with the
   `hidden` attribute (only clock-page.js's Personalize toggle should reveal it), but the
   unconditional display:flex here silently overrode that, so the full panel -- 9 real focusable
   controls -- rendered open on every page load regardless of aria-expanded="false". */
.clock-personalize[hidden],
.clock-worldnow[hidden] {
  display: none;
}

.clock-personalize__label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-silver);
  margin: 0 0 8px;
}

.clock-personalize__options { display: flex; gap: 8px; flex-wrap: wrap; }

.clock-chip {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--color-white);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.clock-chip[aria-pressed="true"] { background: var(--color-red); border-color: var(--color-red); }
.clock-chip:hover { border-color: var(--color-white); }
.clock-chip:focus-visible { outline: 2px solid var(--color-red-on-dark); outline-offset: 2px; }

.clock-personalize__note {
  color: var(--color-silver);
  font-size: 12px;
  margin: 8px 0 0;
}

.clock-world-cities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-8);
  max-height: 220px;
  overflow-y: auto;
}

.clock-world-city {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--color-white);
  cursor: pointer;
}

.clock-world-city input {
  width: 15px;
  height: 15px;
  accent-color: var(--color-red);
}

/* Personalize toggles are real buttons with aria-pressed, not checkboxes -- matches the already-
   proven [data-clock-style]/[data-clock-bg] chip pattern on this same page rather than a second
   interaction model. */
.clock-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-8);
  background: transparent;
  color: var(--color-white);
  cursor: pointer;
}

.clock-toggle::before {
  content: '';
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
}

.clock-toggle[aria-pressed="true"] {
  border-color: var(--color-red);
  background: rgba(225, 6, 19, 0.08);
}

.clock-toggle[aria-pressed="true"]::before {
  background: var(--color-red);
  border-color: var(--color-red);
}

.clock-toggle:hover { border-color: var(--color-white); }
.clock-toggle:focus-visible { outline: 2px solid var(--color-red-on-dark); outline-offset: 2px; }

.clock-secondary-actions { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 0 0 8px; }
.clock-secondary-actions__item { background: none; border: 0; padding: 4px 2px; color: var(--color-silver); font-family: var(--font-body); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; cursor: pointer; }
.clock-secondary-actions__item:hover { color: var(--color-white); }
.clock-secondary-actions__item:focus-visible { outline: 2px solid var(--color-red-on-dark); outline-offset: 2px; }

.clock-explore { text-align: center; margin: 0; }
.clock-explore a { color: var(--color-silver); font-size: 13px; text-decoration: none; }
.clock-explore a:hover { color: var(--color-red-on-dark); }

/* ---- Fullscreen: a deliberately designed display, not the ordinary page enlarged ----
   Founder walkthrough: fullscreen previously just clipped page overflow (height:100vh +
   overflow:hidden) with no actual composition -- the expanded Radio shell (the full discovery/
   catalogue/schedule/recently-played widget shared with /radio/) rendered at its normal full-page
   size below the clock, so it clipped, overlapped World Now, and squeezed the clock face itself
   whenever it was taller than the leftover space. Rebuilt as a genuine 3-row grid (topbar / clock
   stage / radio) where the clock stage always gets priority and the radio row is capacity-capped,
   never allowed to grow past a bounded share of the screen regardless of what's inside it. */
body.clock-fullscreen .site-header,
body.clock-fullscreen .site-footer,
body.clock-fullscreen .clock-explore,
body.clock-fullscreen .clock-topbar__mark,
body.clock-fullscreen #clock-personalize-toggle,
body.clock-fullscreen #clock-share,
body.clock-fullscreen #clock-install,
body.clock-fullscreen .clock-secondary-actions,
body.clock-fullscreen #ibis-widget-trigger,
body.clock-fullscreen #ibis-widget-panel {
  display: none;
}

body.clock-fullscreen {
  overflow: hidden;
}

body.clock-fullscreen .clock-screen {
  box-sizing: border-box;
  height: 100vh;
  width: 100vw;
  padding: 13px 21px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "topbar" "stage" "radio";
  gap: 8px;
  overflow: hidden;
}

body.clock-fullscreen .clock-topbar {
  grid-area: topbar;
  justify-content: flex-end;
}

body.clock-fullscreen .clock-topbar__actions { gap: 0; }

body.clock-fullscreen #clock-fullscreen-toggle {
  opacity: 0.35;
}

body.clock-fullscreen #clock-fullscreen-toggle:hover,
body.clock-fullscreen #clock-fullscreen-toggle:focus-visible {
  opacity: 1;
}

body.clock-fullscreen .clock-personalize { display: none !important; }

/* Clock stage always wins the height fight: min-height:0 lets it genuinely shrink inside the
   grid row instead of forcing the row (and the radio row after it) to overflow, and the face
   sizes below are vh-capped with real headroom under every tested viewport (390x844 through
   1080x1920) so the clock stays fully visible even with Radio expanded and World Now on. */
body.clock-fullscreen .clock-stage {
  grid-area: stage;
  min-height: 0;
  gap: 13px;
  padding: 8px 0;
}

body.clock-fullscreen .clock-analog-svg {
  width: min(38vh, 360px, 55vw);
  height: min(38vh, 360px, 55vw);
}

/* min(vh, vw) deliberately, not vh alone: a purely height-based formula measured "12:34:56 PM"
   580px wide at 390px viewport width (real overflow found by the actual test matrix below, not
   assumed) -- the analog face was already width-safe via its own 55vw cap, digital/minimal
   weren't. */
body.clock-fullscreen .clock-digital__time {
  font-size: clamp(2rem, min(15vh, 13vw), 7rem);
}

body.clock-fullscreen .clock-minimal__time {
  font-size: clamp(2.5rem, min(18vh, 20vw), 9rem);
}

/* World Now lives inside the stage, never the radio row -- structurally impossible for the two
   to overlap now that they're separate grid rows. flex-wrap already prevents horizontal overflow;
   the reduced item size here just keeps it visually subordinate to the clock at small heights. */
body.clock-fullscreen .clock-worldnow {
  gap: 8px 13px;
}

body.clock-fullscreen .clock-worldnow__item {
  padding: 6px 10px;
}

/* Radio row: capacity-capped regardless of what's inside it (collapsed pill or expanded shell),
   so it can never push the clock stage below its fair share. */
body.clock-fullscreen .clock-radio {
  grid-area: radio;
  width: min(640px, 92vw);
  max-height: 32vh;
  margin: 0 auto;
  overflow: hidden;
}

body.clock-fullscreen #clock-radio-shell:not([hidden]) {
  overflow-y: auto;
  max-height: calc(32vh - 52px);
}

/* Radio expanded in fullscreen: a compact "Now Playing" card, not the full /radio/ discovery
   page. Reuses the exact same shared DOM/JS (js/radio-player.js) -- playback state, PLAY/NEXT
   handlers, everything -- only the presentation changes. High-specificity selectors (body class +
   #clock-radio-shell id) are required to beat the widget's own <style> tag, which is injected
   into the document later than this stylesheet and would otherwise win on source order alone. */
body.clock-fullscreen #clock-radio-shell .ftn-radio-live {
  display: block;
  margin-top: 0;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__catalog,
body.clock-fullscreen #clock-radio-shell .ftn-radio-schedule,
body.clock-fullscreen #clock-radio-shell .ftn-radio-recent,
body.clock-fullscreen #clock-radio-shell > .ftn-radio-live > .ftn-radio-live__status,
body.clock-fullscreen #clock-radio-shell #ftn-radio-favourite,
body.clock-fullscreen #clock-radio-shell #ftn-radio-share,
body.clock-fullscreen #clock-radio-shell .ftn-radio-yt-note {
  display: none !important;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__player {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 13px;
  position: static;
  border-radius: 13px;
  padding: 8px;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__video {
  width: 96px;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__now {
  flex: 1;
  min-width: 0;
  padding: 0;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__now strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.clock-fullscreen #clock-radio-shell .ftn-radio-live__controls {
  margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .clock-screen * { transition: none !important; }
}
