/* Fonts are hosted in /fonts so the page never waits on Google (slow or blocked in some countries). */
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: block; src: url("fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: block; src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: block; src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2"); }

/* Layout: one calm screen. Title, prompt, dial, one primary action, quiet footer.
   The whole room changes colour with the phase: neutral (ready), navy (prep), amber (preach). */
:root {
  --bg-idle: #15141b;
  --bg-prep: #121a36;
  --bg-preach: #2b1611;
  --ink: #f4eee4;
  --muted: rgba(244, 238, 228, 0.56);
  --faint: rgba(244, 238, 228, 0.4);
  --line: rgba(244, 238, 228, 0.12);
  --accent-idle: #d9cfc0;
  --accent-prep: #93acff;
  --accent-preach: #ffb36b;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  --bg: var(--bg-idle);
  --accent: var(--accent-idle);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  transition: background-color 1.2s ease;
  -webkit-font-smoothing: antialiased;
}
body[data-phase="prep"] { --bg: var(--bg-prep); --accent: var(--accent-prep); }
body[data-phase="preach"], body[data-phase="done"] { --bg: var(--bg-preach); --accent: var(--accent-preach); }

.stage {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  gap: clamp(16px, 3vh, 32px);
  padding: clamp(20px, 4vh, 40px) 20px clamp(16px, 3vh, 28px);
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.brand {
  font-family: var(--display);
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.brand em { color: var(--accent); transition: color 1.2s ease; }

.prompt-wrap { align-self: center; display: grid; gap: 14px; justify-items: center; }
.kind {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 1.2s ease;
}
.prompt {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.3rem, 7vw, 4.6rem);
  line-height: 1.04;
  max-width: 17ch;
  text-wrap: balance;
}
.prompt::before { content: "\201C"; }
.prompt::after { content: "\201D"; }
.prompt.swap { animation: swap 0.45s ease; }
@keyframes swap {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.play { display: grid; justify-items: center; gap: clamp(16px, 3vh, 32px); }
.dial { position: relative; width: min(230px, 32vh, 62vw); aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.dial .track { fill: none; stroke: var(--line); stroke-width: 6; }
.dial .arc { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke 1.2s ease; }
.dial .readout { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; }
.time {
  font-size: clamp(2.4rem, 6vh, 3.2rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.phase { font-family: var(--display); font-style: italic; font-size: 1.25rem; color: var(--accent); transition: color 1.2s ease; }
body[data-phase="done"] .dial { animation: settle 1.6s ease; }
@keyframes settle { 0% { transform: scale(1); } 30% { transform: scale(1.04); } 100% { transform: scale(1); } }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
button { font: inherit; cursor: pointer; }
.primary, .secondary {
  font-weight: 600;
  font-size: 1rem;
  border-radius: 999px;
  padding: 15px 28px;
  min-width: 150px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.12s ease, color 1.2s ease;
}
.primary:active, .secondary:active { transform: scale(0.97); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { background: var(--ink); color: var(--bg); }
.primary:hover { background: #ffffff; }
.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.secondary:hover { border-color: rgba(244, 238, 228, 0.35); }

.hint { margin: 0; font-size: 0.95rem; color: var(--muted); min-height: 1.4em; }

/* Footer: tail room above, three quiet links. Dims further while a round is running. */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
  padding-top: clamp(12px, 4vh, 40px);
  transition: opacity 0.6s ease;
}
body[data-phase="prep"] .footer, body[data-phase="preach"] .footer { opacity: 0.35; }
.link {
  background: none;
  border: none;
  padding: 6px 2px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--faint);
  text-decoration: none;
  text-underline-offset: 3px;
}
.link:hover { color: var(--ink); text-decoration: underline; }

/* About panel */
.about {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.about-card {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--bg-idle);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 26px 24px;
  display: grid;
  gap: 14px;
  text-align: left;
}
.about-card h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 2rem; }
.about-card > p { margin: 0; line-height: 1.55; color: rgba(244, 238, 228, 0.82); }
.about-card blockquote {
  margin: 6px 0 4px;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--accent-preach);
}
.about-card blockquote p { margin: 0 0 6px; font-family: var(--display); font-style: italic; font-size: 1.25rem; line-height: 1.3; }
.about-card cite { font-style: normal; font-size: 0.8rem; letter-spacing: 0.06em; color: var(--muted); }
.about-card .secondary { justify-self: start; min-width: 0; padding: 11px 22px; }

/* Wide screens (laptops, desktops): prompt on the left, dial and buttons on the right. */
@media (min-width: 960px) {
  .stage {
    max-width: 1280px;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "brand brand" "prompt play" "footer footer";
    column-gap: clamp(48px, 6vw, 110px);
    padding-left: 48px;
    padding-right: 48px;
  }
  .brand { grid-area: brand; font-size: clamp(2.6rem, 4vw, 3.6rem); }
  .prompt-wrap { grid-area: prompt; justify-items: start; text-align: left; }
  .play { grid-area: play; align-self: center; }
  .footer { grid-area: footer; }
  .prompt { font-size: clamp(3rem, 5.4vw, 6rem); max-width: 14ch; }
  .dial { width: min(320px, 42vh); }
  .time { font-size: clamp(3rem, 7vh, 4rem); }
  .phase { font-size: 1.4rem; }
}

@media (max-height: 640px) {
  .stage { gap: 12px; }
  .prompt { font-size: clamp(2rem, 6vw, 3.4rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
