/* Dark by default; site.js rewrites the tokens from themes.js. */
:root {
  color-scheme: dark;
  --color-bg: #050807;
  --color-title: #eafff0;
  --color-body: rgba(234, 255, 240, 0.6);
  --color-highlight: #3dff7a;
}

:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f3f8f3;
  --color-title: #0c1a10;
  --color-body: rgba(12, 26, 16, 0.6);
}

:root {
  --font-heading: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --fill: color-mix(in srgb, var(--color-title) 7%, transparent);
  --fill-strong: color-mix(in srgb, var(--color-title) 12%, transparent);
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-title);
  font: 15px/1.5 var(--font-heading);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 0.5s var(--ease),
    color 0.5s var(--ease);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 1.5px solid var(--color-highlight);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--color-title);
  color: var(--color-bg);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

/* First screen: header, clock with pickers, intro — all visible without scrolling. */

.hero {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100svh;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}

.wordmark {
  margin-right: auto;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-link {
  padding: 8px 4px;
  font: 400 12px/1 var(--font-mono);
  text-transform: uppercase;
  text-decoration: none;
}

.header-link:hover {
  color: var(--color-highlight);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--color-title);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--color-highlight);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity 0.3s ease,
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark shows the sun (go light); light shows the moon (go dark). */
.theme-toggle .icon-moon,
:root[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: none;
}

/* Clock and pickers */

/* Clock fills the row and stays centred; settings float over its left edge. */
.stage-row {
  position: relative;
  display: grid;
  min-height: 0;
}

.stage-row .pickers {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
}

.stage {
  height: 100%;
  min-height: 320px;
}

/* Two columns: styles on the left, type and screen stacked on the right. */
.pickers {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto 1fr;
  gap: 18px 32px;
  align-items: start;
}

#form-picker {
  grid-row: 1 / span 2;
}

.picker {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
}

.picker legend {
  margin-bottom: 6px;
  padding: 0 10px;
  font: 400 10px/1 var(--font-mono);
  text-transform: uppercase;
  color: var(--color-body);
  opacity: 0.7;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--color-body);
  font: 400 11px/1 var(--font-mono);
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.option:hover {
  color: var(--color-title);
}

.option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option:has(input:checked) {
  background: var(--fill);
  color: var(--color-title);
}

.option:has(input:focus-visible) {
  outline: 1.5px solid var(--color-highlight);
  outline-offset: 2px;
}

/* Intro */

.intro {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 16px 0 max(32px, env(safe-area-inset-bottom));
  text-align: center;
}

.intro h1 {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--fill);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background: var(--fill-strong);
}

.btn-primary {
  background: var(--color-title);
  color: var(--color-bg);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--color-title) 82%, var(--color-bg));
}

.note {
  margin: 0;
  font-size: 13px;
  color: var(--color-body);
  text-wrap: balance;
}

/* Footer */

/* FAQ */

.faq {
  max-width: 640px;
  margin: 0 auto;
  padding: 120px 16px 48px;
}

.faq h2 {
  margin: 0 0 12px;
  font: 400 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-body);
}

.faq details {
  border-bottom: 1px solid var(--fill);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  font: 400 16px/1 var(--font-mono);
  color: var(--color-body);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  margin: 0;
  padding: 0 0 18px;
  color: var(--color-body);
  text-wrap: pretty;
}

.faq code {
  font: 13px var(--font-mono);
}

.faq a,
.site-footer a {
  text-underline-offset: 3px;
}

.faq a:hover,
.site-footer a:hover {
  color: var(--color-highlight);
}

.site-footer {
  padding: 32px 16px max(32px, env(safe-area-inset-bottom));
  font-size: 13px;
  text-align: center;
  color: var(--color-body);
}

/* Narrow screens: pickers become rows under the clock. */

@media (max-width: 640px) {
  .stage-row {
    grid-template-rows: minmax(280px, 1fr) auto;
    gap: 12px;
  }

  .stage-row .pickers {
    position: static;
    transform: none;
  }

  .stage {
    min-height: 280px;
  }

  .pickers {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 8px;
  }

  #form-picker {
    grid-row: auto;
  }

  .picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .picker legend {
    display: none;
  }

  .option {
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .theme-toggle svg,
  .option,
  .btn {
    transition: none;
  }
}
