/* ============================================================
   whattimeisitright.now — design system
   Light, Apple-grade. The page is colored by the time of day.
   ============================================================ */

:root {
  /* Surfaces & ink */
  --bg:          #f5f5f7;
  --surface:     #ffffff;
  --surface-2:   #fbfbfd;
  --ink:         #1d1d1f;
  --ink-2:       #6e6e73;
  --ink-3:       #86868b;
  --hairline:    rgba(0,0,0,.09);
  --hairline-2:  rgba(0,0,0,.055);
  --accent:      #0071e3;
  --accent-ink:  #ffffff;
  --accent-soft: rgba(0,113,227,.10);
  --danger:      #d70015;

  /* Ambient sky (updated live by JS by local hour) */
  --sky:         #a9d6ff;
  --sky-2:       #ffffff;

  /* Shape & motion */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-pill: 980px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,.05), 0 14px 40px rgba(0,0,0,.08);
  --ease: cubic-bezier(.22,1,.36,1);
  --dur: .28s;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
  --maxw: 1120px;
}

/* Dark theme. An inline <head> script resolves the saved/system preference to
   data-theme="dark|light" before first paint, so there is no flash and no
   reliance on the media query alone. The media query is a no-JS fallback. */
:root[data-theme="dark"] {
  --bg:         #000000;
  --surface:    #1c1c1e;
  --surface-2:  #161618;
  --ink:        #f5f5f7;
  --ink-2:      #a1a1a6;
  --ink-3:      #8e8e93;
  --hairline:   rgba(255,255,255,.14);
  --hairline-2: rgba(255,255,255,.08);
  --accent:     #2997ff;
  --accent-soft: rgba(41,151,255,.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.5);
  --shadow-md: 0 2px 8px rgba(0,0,0,.5), 0 18px 50px rgba(0,0,0,.6);
  --sky-2:      #0b0b0d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg:#000; --surface:#1c1c1e; --surface-2:#161618; --ink:#f5f5f7;
    --ink-2:#a1a1a6; --ink-3:#8e8e93; --hairline:rgba(255,255,255,.14);
    --hairline-2:rgba(255,255,255,.08); --accent:#2997ff; --accent-soft:rgba(41,151,255,.18);
    --shadow-sm:0 1px 2px rgba(0,0,0,.4),0 6px 20px rgba(0,0,0,.5);
    --shadow-md:0 2px 8px rgba(0,0,0,.5),0 18px 50px rgba(0,0,0,.6); --sky-2:#0b0b0d;
  }
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
img, svg { display: block; max-width: 100%; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv01" 1; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 50%; top: 8px; transform: translate(-50%, -160%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill);
  z-index: 200; transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); text-decoration: none; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-2);
}
.nav {
  display: flex; align-items: center; gap: 16px;
  height: 56px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 16px; letter-spacing: -0.02em; color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; flex: 0 0 auto; }
.brand b { font-weight: 600; }
.brand .dotnow { color: var(--ink-3); font-weight: 500; }
.nav-spacer { flex: 1 1 auto; }
.nav-links { display: none; gap: 4px; align-items: center; }
.nav-links a {
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--r-pill); transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-links a:hover { background: var(--hairline-2); color: var(--ink); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--hairline-2); }
@media (min-width: 720px) { .nav-links { display: flex; } }

/* theme toggle (sun/moon) — visible on every screen size */
.theme-toggle {
  flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--hairline); border-radius: var(--r-pill); background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-sm);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ============================================================
   Hero — the living clock
   ============================================================ */
.hero {
  position: relative;
  text-align: center;
  padding: clamp(40px, 9vw, 96px) 0 clamp(32px, 6vw, 60px);
  isolation: isolate;
  overflow: clip;
}
/* ambient time-of-day glow */
.hero::before {
  content: ""; position: absolute; inset: -40% 0 auto 0; height: 120%;
  background: radial-gradient(80% 80% at 50% 0%,
              var(--sky) 0%, transparent 62%);
  opacity: .55; z-index: -1;
  transition: background 1.2s linear, opacity 1.2s linear;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .hero::before { transition: none; } }

.eyebrow {
  text-transform: uppercase; letter-spacing: .22em; font-weight: 600;
  font-size: clamp(11px, 2.4vw, 13px); color: var(--ink-2);
  margin-bottom: clamp(10px, 2vw, 18px);
}
.eyebrow.live::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px;
  border-radius: 50%; background: #34c759; vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(52,199,89,.5); animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(52,199,89,.5)} 70%{box-shadow:0 0 0 7px rgba(52,199,89,0)} 100%{box-shadow:0 0 0 0 rgba(52,199,89,0)} }

.clock {
  font-weight: 600; letter-spacing: -0.04em; line-height: .92;
  font-size: clamp(3.4rem, 17vw, 10.5rem);
  display: inline-flex; align-items: baseline; justify-content: center;
  gap: .04em; color: var(--ink);
}
.clock .sep { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .28; } }
@media (prefers-reduced-motion: reduce) { .clock .sep { animation: none; } }
.clock .ampm {
  font-size: .26em; font-weight: 600; letter-spacing: 0; color: var(--ink-2);
  margin-left: .12em; align-self: center;
}
.clock .secs { color: var(--ink-2); }

.hero-h1 {
  margin-top: clamp(12px, 2.6vw, 20px);
  font-size: clamp(19px, 4.2vw, 27px); font-weight: 600; letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-date {
  margin-top: clamp(8px, 1.8vw, 12px);
  font-size: clamp(15px, 3.2vw, 19px); font-weight: 500; color: var(--ink-2);
}
.hero-sub {
  margin-top: 6px; color: var(--ink-2); font-size: clamp(14px, 3vw, 17px);
}
.tz-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px;
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 500; color: var(--ink);
}
.tz-chip .off { color: var(--ink-2); }

/* analog — CRITICAL: pivot comes from the SVG rotate(a 100 100) attribute set
   in JS. Do NOT add css transform-origin here — it wraps the rotate() and
   double-shifts the pivot to the corner, flinging the hands off the face. */
.analog { width: clamp(190px, 46vw, 240px); height: clamp(190px, 46vw, 240px); margin: 0 auto; }
.analog .face { fill: var(--surface); stroke: var(--hairline); stroke-width: 2; }
.analog .tick { stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.analog .tick.major { stroke: var(--ink); stroke-width: 3.5; }
.analog .hand { stroke: var(--ink); stroke-linecap: round; }
.analog .hand.hour { stroke-width: 6; }
.analog .hand.min { stroke-width: 4; }
.analog .hand.sec { stroke: var(--accent); stroke-width: 2; }
.analog .pin { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
[hidden] { display: none !important; }

/* ── Hero controls (segmented) ── */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: clamp(24px, 5vw, 38px);
}
.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 3px; box-shadow: var(--shadow-sm);
}
.seg button {
  border: 0; background: transparent; color: var(--ink-2);
  padding: 7px 15px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  min-height: 36px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ============================================================
   Search
   ============================================================ */
.search { position: relative; max-width: 560px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 4px 6px 4px 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box svg { flex: 0 0 auto; color: var(--ink-3); }
.search-box input {
  flex: 1 1 auto; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink); padding: 12px 0; min-width: 0;
}
.search-box input::placeholder { color: var(--ink-3); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); overflow: hidden; max-height: 360px; overflow-y: auto;
  text-align: left;
}
.search-results a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px; color: var(--ink); border-bottom: 1px solid var(--hairline-2);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--accent-soft); text-decoration: none; }
.search-results .city { font-weight: 500; }
.search-results .meta { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.search-empty { padding: 18px; color: var(--ink-3); text-align: center; font-size: 14px; }

/* searchable combobox (time-zone converter) — reuses .search-results dropdown */
.combo { position: relative; }
.combo .combo-ico {
  position: absolute; left: 14px; top: 24px; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.combo input[type="search"] { padding-left: 40px; }
.combo input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.combo .search-results { max-height: 300px; }
.combo .search-results a { padding: 12px 16px; }

/* ============================================================
   Sections & cards
   ============================================================ */
section { padding-block: clamp(40px, 7vw, 72px); }
.section-head { margin-bottom: clamp(20px, 4vw, 34px); }
.section-head h2 {
  font-size: clamp(22px, 4.4vw, 32px); font-weight: 600; letter-spacing: -0.02em;
}
.section-head p { color: var(--ink-2); margin-top: 6px; font-size: clamp(15px, 3vw, 17px); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.city-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 16px 18px; box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.city-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.city-card .cc-name { font-weight: 600; font-size: 15px; }
.city-card .cc-country { color: var(--ink-3); font-size: 12.5px; }
.city-card .cc-time { font-size: clamp(24px, 6vw, 30px); font-weight: 600; letter-spacing: -0.03em; margin-top: 8px; }
.city-card .cc-time .ampm { font-size: .5em; color: var(--ink-2); margin-left: 3px; }
.city-card .cc-off { color: var(--ink-3); font-size: 12px; }

/* utility strip */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tile {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 18px 20px; box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.tile .ico {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent);
}
.tile .t-title { font-weight: 600; font-size: 15px; }
.tile .t-sub { color: var(--ink-3); font-size: 13px; }

/* info rows (city pages) */
.facts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.fact {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.fact .f-label { color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.fact .f-value { font-size: clamp(18px, 4vw, 22px); font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.fact .f-note { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

.callout {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-md); padding: 18px 20px; color: var(--ink);
  font-size: clamp(15px, 3vw, 18px); font-weight: 500;
}

/* prose */
.prose { max-width: 720px; }
.prose h2 { font-size: clamp(20px, 4vw, 26px); font-weight: 600; margin-top: 1.6em; letter-spacing: -0.02em; }
.prose h3 { font-size: clamp(17px, 3.4vw, 20px); font-weight: 600; margin-top: 1.4em; }
.prose p { color: var(--ink-2); margin-top: .7em; font-size: clamp(15px, 3vw, 17px); }
.prose ul { color: var(--ink-2); margin-top: .7em; padding-left: 1.2em; }
.prose li { margin-top: .35em; }

/* FAQ */
.faq details {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 4px 20px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.faq summary {
  list-style: none; cursor: pointer; padding: 16px 0; font-weight: 600; font-size: clamp(15px, 3vw, 17px);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 24px; transition: transform var(--dur) var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); padding-bottom: 18px; font-size: clamp(14px, 3vw, 16px); }

/* breadcrumbs */
.crumbs { font-size: 13px; color: var(--ink-3); padding-top: 18px; }
.crumbs a { color: var(--ink-2); }
.crumbs span { margin-inline: 6px; }

/* ============================================================
   Index lists (footer SEO hub)
   ============================================================ */
.index-grid { columns: 2; column-gap: 28px; }
@media (min-width: 560px) { .index-grid { columns: 3; } }
@media (min-width: 900px) { .index-grid { columns: 4; } }
.index-grid a {
  display: block; padding: 7px 0; color: var(--ink-2); font-size: 14px;
  break-inside: avoid;
}
.index-grid a:hover { color: var(--accent); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--hairline); margin-top: 40px;
  padding-block: 40px; background: var(--surface-2);
}
.foot-top { display: flex; flex-wrap: wrap; gap: 28px 48px; justify-content: space-between; }
.foot-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.foot-col a { display: block; color: var(--ink-2); font-size: 14px; padding: 5px 0; }
.foot-col a:hover { color: var(--accent); }
.foot-bottom {
  margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--hairline-2);
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; align-items: center;
  color: var(--ink-3); font-size: 13px;
}
.foot-bottom .brand-sm { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-weight: 600; }
.foot-bottom .brand-sm svg { width: 18px; height: 18px; }

/* tools (converter/timer) */
.tool-card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: clamp(22px, 5vw, 36px); box-shadow: var(--shadow-md); max-width: 720px; margin-inline: auto;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.field select, .field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 13px 14px; min-height: 48px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field select:focus, .field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tool-out {
  margin-top: 8px; text-align: center; padding: 26px; background: var(--surface-2);
  border-radius: var(--r-md); border: 1px solid var(--hairline);
}
.tool-out .big { font-size: clamp(30px, 8vw, 52px); font-weight: 600; letter-spacing: -0.03em; }
.tool-out .lbl { color: var(--ink-2); margin-top: 6px; font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--bg); border: 0; border-radius: var(--r-pill);
  padding: 13px 24px; font-weight: 600; font-size: 15px; min-height: 48px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* big timer display */
.timer-display { font-size: clamp(48px, 17vw, 120px); font-weight: 600; letter-spacing: -0.04em; text-align: center; line-height: 1; }
