/* Sarmizegetusa v2: a dawn scene behind glass cards. The scene stays dark in
   both themes, so card text stays light; the chrome and sources follow the theme. */
:root {
  --bg: #f4efe6; --ink: #1d1a16; --muted: #5c554b; --line: #d8cfbf; --accent: #9a4a12;
  --glass: rgba(14, 16, 22, 0.78); --gink: #f3ede2; --gmuted: #c9c1b3; --gold: #f2b25c; --gline: rgba(243, 237, 226, 0.18);
  --hit: #f2b25c; --you: #7fd4ff; --cell: rgba(243, 237, 226, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] { --bg: #111217; --ink: #ece6da; --muted: #b3ab9d; --line: #2d2e36; --accent: #f2b25c; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #111217; --ink: #ece6da; --muted: #b3ab9d; --line: #2d2e36; --accent: #f2b25c; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: #0f1116; color: var(--ink); font: 18px/1.6 var(--serif); -webkit-text-size-adjust: 100%; }
a { color: inherit; }
.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--gold); color: #111; padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* topbar */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); color: var(--ink); font: 14px/1 var(--sans);
  backdrop-filter: blur(8px); }
.topbar .home { font-weight: 700; text-decoration: none; white-space: nowrap; }
.topnav { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; color: var(--muted); white-space: nowrap; padding: 14px 0; }
.topnav a:hover { color: var(--ink); }
.spacer { flex: 0 0 0; }
.lang { text-decoration: none; color: var(--muted); white-space: nowrap; padding: 14px 4px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -8px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.icon-btn svg[hidden] { display: none; }
:root[data-theme="dark"] .i-sun, :root:not([data-theme="light"]) .i-sun { }
@media (max-width: 720px) { .topnav { display: none; } .topbar { gap: 8px; } .spacer { flex: 1 1 auto; } }

/* reading rail */
.rail { position: fixed; right: 10px; top: 50%; transform: translateY(-50%); z-index: 25; display: flex; flex-direction: column; gap: 2px; }
.rail-dot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 26px; text-decoration: none; color: var(--gink); font: 12px var(--sans); }
.rail-dot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gmuted); opacity: .55; transition: transform .2s, opacity .2s; }
.rail-dot.on .dot { background: var(--gold); opacity: 1; transform: scale(1.4); }
.rail-label { opacity: 0; transition: opacity .2s; text-shadow: 0 1px 3px #000; }
.rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label { opacity: 1; }
/* FM-818: each link is only the 24px target round its dot; the label is out of the layout and lets clicks through, so the rail never covers the map or text */
.rail a,.rail .rail-dot{position:relative;display:flex;align-items:center;justify-content:center;width:24px;min-width:0;height:24px;min-height:0;padding:0;gap:0;flex:none}
.rail .rail-label{position:absolute;right:100%;left:auto;top:50%;bottom:auto;margin:0;translate:0 -50%;white-space:nowrap;pointer-events:none}

@media (max-width: 720px) { .rail { display: none; } }

/* stage */
.stage { position: fixed; inset: 0; z-index: 0; background: #0f1116; }
#scene { display: block; width: 100%; height: 100%; }
.still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.no-webgl #scene { display: none; }
.no-webgl .still { display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; font: 12px/1.2 var(--sans); color: var(--gink); }
.hud .tag { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; padding: 3px 7px; border-radius: 4px; background: rgba(10, 12, 16, .72);
  border: 1px solid var(--gline); transition: opacity .4s; }
.hud .tag.flat { color: var(--gmuted); border-style: dashed; }
.hud .tag.real { color: var(--gold); }
.hud .tag.you { color: var(--you); }
.hud .tag::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 10px; background: currentColor; opacity: .7; }

/* steps and cards */
main { position: relative; z-index: 10; }
.step { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 72px 20px 40px; }
.card { width: min(34rem, 100%); background: var(--glass); color: var(--gink); padding: 22px 24px; border-radius: 10px; border: 1px solid var(--gline);
  backdrop-filter: blur(6px); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); margin-left: max(0px, calc(8vw - 20px)); }
.card p { margin: 0 0 .85em; }
.card p:last-child { margin-bottom: 0; }
.kicker { font: 700 12px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px !important; }
h1, h2 { font-weight: 600; line-height: 1.15; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 3.6vw, 1.9rem); }
h2 .anchor { text-decoration: none; }
h2 .anchor:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.deck { font-size: 1.1rem; color: var(--gink); }
.byline { font: 13px/1.5 var(--sans); color: var(--gmuted); margin-top: 1.2em !important; }
.note { font: 14px/1.5 var(--sans); color: var(--gmuted); border-left: 2px solid var(--gline); padding-left: 10px; }
.result { font-size: 1.15rem; color: #fff; border-left: 3px solid var(--gold); padding-left: 12px; }
.hero { align-items: flex-end; }
.hero-card { background: linear-gradient(180deg, rgba(14, 16, 22, .62), rgba(14, 16, 22, .86)); }

/* the form */
.dayform fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.dayform legend { font: 700 13px var(--sans); color: var(--gmuted); margin-bottom: 6px; padding: 0; }
.dayform label { display: flex; flex-direction: column; gap: 4px; font: 12px var(--sans); color: var(--gmuted); }
.dayform select, .dayform button { font: 16px var(--sans); min-height: 44px; border-radius: 6px; }
.dayform select { background: #1b1e26; color: var(--gink); border: 1px solid var(--gline); padding: 0 10px; }
.dayform button { background: var(--gold); color: #1a1208; border: 0; padding: 0 22px; font-weight: 700; cursor: pointer; }
.dayform button:hover { filter: brightness(1.08); }
.hint { font: 13px var(--sans); color: var(--gmuted); margin-top: 8px !important; }

/* the lines lab */
.lines-lab fieldset { border: 0; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.lines-lab legend { font: 700 12px var(--sans); color: var(--gmuted); padding: 0; margin-bottom: 2px; width: 100%; }
.lines-lab label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font: 15px var(--sans); cursor: pointer; }
.lines-lab input { width: 20px; height: 20px; accent-color: var(--gold); }
.year { display: grid; grid-template-columns: repeat(73, 1fr); gap: 1px; margin: 8px 0 6px; }
.year i { display: block; aspect-ratio: 1 / 2.2; background: var(--cell); }
.year i.hit { background: var(--hit); }
.year i.you { background: var(--you); box-shadow: 0 0 0 1px var(--you); }
.year-key { font: 12px var(--sans); color: var(--gmuted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.year-key .k { display: inline-block; width: 10px; height: 14px; background: var(--hit); }
.year-key .k.you { background: var(--you); margin-left: 10px; }
.scan { width: 100%; border-collapse: collapse; font: 14px var(--sans); margin: 8px 0 14px; }
.scan caption { text-align: left; color: var(--gmuted); font-size: 12px; margin-bottom: 4px; }
.scan th, .scan td { padding: 5px 6px; border-bottom: 1px solid var(--gline); text-align: right; }
.scan th[scope="row"], .scan thead th:first-child { text-align: left; font-weight: 400; }
.js .scan { display: none; }

/* sources */
.sources { background: var(--bg); color: var(--ink); padding: 64px 20px 40px; position: relative; }
.wrap { max-width: 44rem; margin: 0 auto; }
.sources h2 .anchor { color: var(--ink); }
.sources h3 { font: 700 14px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.srcs { padding-left: 1.2em; font: 15px/1.5 var(--sans); }
.srcs li { margin-bottom: .6em; }
.srcs a { color: var(--ink); text-decoration-color: var(--accent); }
.site-footer { position: relative; z-index: 10; background: var(--bg); color: var(--muted); border-top: 1px solid var(--line); padding: 18px 20px 28px; font: 14px var(--sans); text-align: center; }
.e404 { background: var(--bg); color: var(--ink); } .e404 .wrap { padding: 80px 20px; }

/* phones: cards at the bottom so the sky shows above */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .step { display: block; padding: 62svh 12px 30svh; }
  .hero { padding-top: 34svh; padding-bottom: 16px; }
  .card { margin-left: 0; padding: 18px 16px; }
  .year { grid-template-columns: repeat(53, 1fr); }
}
@media (max-height: 740px) and (min-width: 721px) { .step { padding-top: 60px; } .card { padding: 16px 18px; } }

html:not(.js) #scene { display: none; }
html:not(.js) .still { display: block; }
.related { position: relative; background: var(--bg); color: var(--ink); padding: 64px 20px 8px; border-bottom: 1px solid var(--line); }
.wrap-wide { max-width: 68rem; margin: 0 auto; }
.related h2 .anchor { color: var(--ink); }
.related h3 { font: 700 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; }
.rel { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 12px; }
.rel a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--bg) 85%, var(--accent) 4%); }
.rel a:hover { border-color: var(--accent); }
.rel strong { font-weight: 600; line-height: 1.25; }
.rel span { font: 14px/1.45 var(--sans); color: var(--muted); }

/* v3: the hill through time */
.js .scan.eras { display: table; }
.scan.eras th, .scan.eras td { text-align: left; vertical-align: top; }
.hill-lab .reading[data-differs="no"] legend::after { content: ""; }
.hill-lab .reading[data-differs="yes"] { border-left: 3px solid var(--gold); padding-left: 10px; }
.counts { margin: 12px 0 16px; }
.bars { list-style: none; margin: 0; padding: 0; font: 14px/1.35 var(--sans); }
.bars li { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); gap: 2px 10px; margin-bottom: 10px; }
.bars .cy { font-weight: 700; color: var(--gink); }
.bars .cbar { display: grid; grid-template-columns: minmax(0, 1fr) 5.2em; align-items: center; gap: 8px; min-width: 0; }
.bars .cb { display: block; width: 100%; height: 14px; }
.bars .cb rect { fill: var(--gold); }
.bars .cv { font-weight: 700; color: var(--gink); white-space: nowrap; }
.bars .cw { grid-column: 2; min-width: 0; color: var(--gmuted); font-size: 13px; }
.counts figcaption { font: 13px/1.5 var(--sans); color: var(--gmuted); margin-top: 4px; }
.tag.fort, .tag.sacred { white-space: nowrap; }
/* FM-1018 rail clearance (2 Nov 2026) */
@media {.rail{display:none!important}}
