/* bellhours.com – "Is the stock market open?" Two themes, chosen by the MARKET,
   not by the visitor: the regular session is open → light theme with the sea-map
   blue; the bell has rung → dark theme with the sea-map red. There is no toggle
   on purpose: the colour IS the answer. Palette lifted from the SeaTempMap SST
   raster (seatemp lib/theme/tokens.ts): blue 10 °C #0961bb / 13 °C #0a8fd1,
   red 30 °C #d73528 / 28 °C #ff6c44. Neutrals follow Apple's system colours. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1040px;
  --radius: 18px;
  --radius-sm: 12px;

  --blue: #0961bb;
  --blue-bright: #0a8fd1;
  --red: #d73528;
  --red-bright: #ff6c44;
  --amber: #ff9f0a;

  /* CLOSED = default before JS runs. Dark, Apple system colours. */
  --bg: #000000;
  --bg-2: #1c1c1e;
  --bg-3: #2c2c2e;
  --card: #1c1c1e;
  --fg: #ffffff;
  --fg-2: rgba(235, 235, 245, 0.62);
  --fg-3: rgba(235, 235, 245, 0.38);
  --line: rgba(84, 84, 88, 0.55);
  --line-strong: rgba(84, 84, 88, 0.9);
  --accent: var(--red);
  --accent-text: var(--red-bright);
  --accent-soft: rgba(215, 53, 40, 0.16);
  --accent-glow: rgba(215, 53, 40, 0.28);
  --ok: #30d158;
  color-scheme: dark;
}

html[data-state="open"] {
  /* OPEN = light, Apple system colours, sea-map blue. */
  --bg: #ffffff;
  --bg-2: #f2f2f7;
  --bg-3: #e5e5ea;
  --card: #ffffff;
  --fg: #000000;
  --fg-2: rgba(60, 60, 67, 0.64);
  --fg-3: rgba(60, 60, 67, 0.4);
  --line: rgba(60, 60, 67, 0.2);
  --line-strong: rgba(60, 60, 67, 0.36);
  --accent: var(--blue);
  --accent-text: var(--blue);
  --accent-soft: rgba(9, 97, 187, 0.1);
  --accent-glow: rgba(9, 97, 187, 0.22);
  --ok: #34c759;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(30px, 5vw, 46px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { width: min(var(--max), 100% - 40px); margin: 0 auto; }
@media (max-width: 560px) { .wrap { width: min(var(--max), 100% - 28px); } }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 0 10px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.brand .mark-bell { fill: var(--accent); }
.brand .mark-dial { stroke: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--fg-2); font-size: 15px; font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); background: var(--bg-2); text-decoration: none; }
@media (max-width: 720px) { .nav a { padding: 6px 8px; font-size: 14px; } }

/* Market switcher: iOS segmented control */
.switch {
  display: flex; gap: 2px; padding: 3px; margin: 8px 0 26px;
  background: var(--bg-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none;
}
.switch::-webkit-scrollbar { display: none; }
.switch button {
  flex: 1 0 auto; min-width: 84px; appearance: none; border: 0; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--fg-2);
  padding: 9px 14px; border-radius: 9px; background: transparent; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.switch button[aria-pressed="true"] {
  color: var(--fg); background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 1px var(--line);
}
html[data-state="open"] .switch button[aria-pressed="true"] { box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }

/* Hero */
.hero { padding: 6px 0 34px; }
.eyebrow { color: var(--fg-2); font-size: 15px; font-weight: 500; margin: 0 0 8px; }
.hero h1 { margin-bottom: 18px; }
.status {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: stretch;
}
@media (max-width: 760px) { .status { grid-template-columns: 1fr; } }
.status-card, .local-card {
  position: relative; padding: 26px 28px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .08);
}
html[data-state="closed"] .status-card { box-shadow: 0 0 0 1px var(--accent-soft), 0 24px 80px var(--accent-glow); }
html[data-state="open"] .status-card { box-shadow: 0 0 0 1px var(--accent-soft), 0 24px 80px var(--accent-glow); }
.status-word {
  font-size: clamp(56px, 11vw, 96px); font-weight: 800; letter-spacing: -0.045em; line-height: 1;
  color: var(--accent-text); margin: 4px 0 6px;
}
.status-sub { font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.status-note { color: var(--fg-2); margin: 0; font-size: 15px; }
.countdown {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.countdown .big { font-size: clamp(30px, 5vw, 40px); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.countdown .lbl { color: var(--fg-2); font-size: 15px; }
.local-card h2 { font-size: 15px; font-weight: 600; color: var(--fg-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.local-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.local-row:first-of-type { border-top: 0; }
.local-row .k { color: var(--fg-2); font-size: 15px; }
.local-row .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; text-align: right; }
.local-row .v small { display: block; font-weight: 500; color: var(--fg-2); font-size: 13px; }
.tz-pill { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--fg-2); background: var(--bg-2); padding: 4px 10px; border-radius: 999px; }

/* Session timeline */
.timeline { margin: 22px 0 0; }
.timeline .bar { position: relative; height: 12px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.timeline .seg { position: absolute; top: 0; bottom: 0; }
.timeline .seg.extended { background: var(--fg-3); opacity: .45; }
.timeline .seg.core { background: var(--accent); }
.timeline .seg.early { background: var(--amber); }
.timeline .now { position: absolute; top: -5px; width: 3px; height: 22px; background: var(--fg); border-radius: 2px; box-shadow: 0 0 0 3px var(--bg); transform: translateX(-1px); }
.timeline .ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .core i { background: var(--accent); }
.legend .extended i { background: var(--fg-3); }
.legend .early i { background: var(--amber); }

/* Sections */
section { padding: 26px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { color: var(--fg-2); margin: 0; }
.prose { max-width: 72ch; }
.prose p, .prose li { color: var(--fg); }
.prose p { margin-bottom: .9em; }
.lede { font-size: clamp(18px, 2vw, 20px); color: var(--fg-2); max-width: 66ch; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { padding: 18px 20px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); }
.tile b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--fg-2); font-size: 14px; }
.tile .tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.tag.closed { background: rgba(215, 53, 40, .15); color: var(--red-bright); }
html[data-state="open"] .tag.closed { color: var(--red); }
.tag.open { background: rgba(9, 97, 187, .12); color: var(--blue-bright); }
html[data-state="open"] .tag.open { color: var(--blue); }
.tag.early { background: rgba(255, 159, 10, .16); color: var(--amber); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; color: var(--fg-2); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-2); }
tr.next td { background: var(--accent-soft); }
tr.past td { color: var(--fg-3); }
td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .st { font-weight: 600; }
td .st.closed { color: var(--red-bright); }
html[data-state="open"] td .st.closed { color: var(--red); }
td .st.early { color: var(--amber); }
td .st.open { color: var(--ok); }

/* FAQ */
.faq details { border-top: 1px solid var(--line); padding: 4px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--fg-2); font-weight: 400; font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq .a { color: var(--fg-2); padding: 0 0 14px; max-width: 72ch; }
.faq .a p { margin-bottom: .6em; }

/* Buttons and badges */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 11px;
  border: 1px solid var(--line-strong); color: var(--fg); font-weight: 600; font-size: 15px; background: var(--card);
}
.btn:hover { text-decoration: none; border-color: var(--fg-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.stores { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.stores img { height: 44px; width: auto; display: block; }
.stores .soon { opacity: .55; filter: grayscale(.2); position: relative; }
.stores .soon::after { content: "Coming soon"; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 999px; opacity: 1; }
.app-tile { display: grid; grid-template-columns: 96px 1fr; gap: 20px; align-items: center; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.app-tile .icon { width: 96px; height: 96px; border-radius: 22.37%; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; }
.app-tile .icon svg { width: 76px; height: 76px; }
@media (max-width: 560px) { .app-tile { grid-template-columns: 1fr; } }

/* Market info list */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 15px; }
.kv dt { color: var(--fg-2); }
.kv dd { margin: 0; font-weight: 500; }
.note { font-size: 14px; color: var(--fg-2); }
.callout { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--accent-soft); margin: 14px 0; }
.callout b { color: var(--accent-text); }

/* Link hub */
.links-grid { display: grid; gap: 6px 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); padding: 0; margin: 0; list-style: none; }
.links-grid li a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--fg); font-size: 15px; }
.links-grid li a:hover { color: var(--accent-text); text-decoration: none; }

/* Breadcrumb */
.crumbs { font-size: 14px; color: var(--fg-2); margin: 14px auto 0; }
.crumbs a { color: var(--fg-2); }
.crumbs span { margin: 0 6px; }

footer { border-top: 1px solid var(--line); padding: 26px 0 38px; color: var(--fg-2); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
footer a { color: var(--fg-2); }
footer .sources { margin-top: 10px; font-size: 13px; color: var(--fg-3); max-width: 80ch; }

@media (prefers-reduced-motion: reduce) { body { transition: none; } }
