/* sirul-mamelor: a fixed dark stage under scrolling cards. Chrome (bar, sources, share, footer) follows the
   theme; the stage and the type on it stay dark/light in both themes. build.py rewrites the font urls with
   content hashes and appends the share-row CSS. */
@font-face{font-family:Fraunces;font-style:normal;font-weight:100 900;font-display:swap;src:url(fonts/Fraunces-display.woff2?v=899e78419e) format("woff2")}
@font-face{font-family:"Atkinson Hyperlegible Next";font-style:normal;font-weight:200 800;font-display:swap;src:url(fonts/AtkinsonHyperlegibleNext.woff2?v=abde1ad5cf) format("woff2")}
@font-face{font-family:"Plex Sans";font-style:normal;font-weight:500 600;font-display:swap;src:url(fonts/IBMPlexSans-latin.woff2?v=056e4e2459) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Plex Sans";font-style:normal;font-weight:500 600;font-display:swap;src:url(fonts/IBMPlexSans-latin-ext.woff2?v=ae1d854fef) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}

:root {
  /* chrome tokens: light */
  --bg: #f6f2ea; --surface: #ece6da; --text: #221c17; --muted: #51473d; --line: #cfc5b4;
  --accent: #8a3a10; --link: #7d3410; --on-accent: #fff8ee;
  /* stage tokens: the same in both themes */
  --stage-bg: #090c15; --stage-text: #eef0f6; --stage-muted: #c6cbda; --stage-accent: #f2b36b; --stage-line: rgba(255, 236, 205, .18);
  --card: rgba(9, 12, 21, .86);
  --ui: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Fraunces, Georgia, serif;
  --topbar-h: 3rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141c; --surface: #1b1e29; --text: #ecebe6; --muted: #c3c0b8; --line: #343848;
    --accent: #f0a868; --link: #f4b682; --on-accent: #1a110b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12141c; --surface: #1b1e29; --text: #ecebe6; --muted: #c3c0b8; --line: #343848;
  --accent: #f0a868; --link: #f4b682; --on-accent: #1a110b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.125rem/1.62 "Atkinson Hyperlegible Next", system-ui, sans-serif;
}
h1, h2, h3 { font-family: var(--serif); font-variation-settings: "SOFT" 60; line-height: 1.12; margin: 0; font-weight: 600; text-wrap: balance; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .12em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.hero :focus-visible, .step :focus-visible { outline-color: var(--stage-accent); }
.skip { position: absolute; left: .5rem; top: -4rem; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; z-index: 50; border-radius: .4rem; }
.skip:focus { top: .5rem; }
section[id] { scroll-margin-top: var(--topbar-h); }

/* topbar (one line; Plex Sans via --ui) */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .6rem;
  padding: 0 .9rem; background: var(--bg);
  border-bottom: 1px solid var(--line); font: 500 .92rem/1 var(--ui);
}
.home { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--text); font-family: var(--ui); font-weight: 600; white-space: nowrap; }
.home span { display: none; }
@media (min-width: 34rem) { .home span { display: inline; } }
.homemark { color: var(--accent); flex: none; }
.topnav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: .35rem .6rem; text-decoration: none; color: var(--muted); white-space: nowrap; border-radius: .4rem; }
.topnav a:hover, .topnav a[aria-current="true"] { color: var(--text); background: var(--surface); }
.spacer { flex: 1 0 .25rem; }
.chip { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 2rem; text-decoration: none; color: var(--text); white-space: nowrap; font-family: var(--ui); font-weight: 600; font-size: .9rem; }
.chip:hover { border-color: var(--accent); }
.icon-btn { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
@media (pointer: coarse) {
  .icon-btn { width: 2.75rem; height: 2.75rem; }
  .chip, .topnav a { min-height: 2.75rem; display: inline-flex; align-items: center; }
}
@media (max-width: 30rem) { .topnav a:not(:nth-child(2)):not(:last-child) { display: none; } }
.progress { position: sticky; top: var(--topbar-h); z-index: 29; height: 0; }
.progress i { position: absolute; left: 0; top: -2px; height: 2px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* the stage: fixed, full viewport, behind the content, dark in both themes even before a script runs */
#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; background: var(--stage-bg); pointer-events: none; }
#odo {
  position: fixed; left: 0; right: 0; top: calc(var(--topbar-h) + .5rem); z-index: 20; display: flex; justify-content: center; flex-wrap: wrap; gap: .2rem .9rem;
  padding: 0 1rem; pointer-events: none; font: 600 .95rem/1.2 var(--ui); font-variant-numeric: tabular-nums; color: var(--stage-text);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8); transition: opacity .25s;
}
#odo span:empty { display: none; }
.past #odo { opacity: 0; }
main { position: relative; z-index: 1; display: block; }

/* hero: on the stage */
.hero { min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-end; padding: calc(var(--topbar-h) + 4rem) 1rem 9svh; color: var(--stage-text); }
.hero-in { width: 100%; max-width: 40rem; }
.hero h1 { font-size: 1.95rem; font-weight: 650; color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
.hero .deck { margin: .8rem 0 0; font-size: 1.12rem; color: var(--stage-muted); max-width: 34rem; }
.by { margin: 1.3rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
html:not(.js) .by { display: none; }
.by label { color: var(--stage-muted); font-size: 1rem; }
.by select {
  font: inherit; min-height: 2.75rem; padding: 0 .8rem; color: var(--stage-text); background: var(--card);
  border: 1px solid var(--stage-line); border-radius: .5rem; cursor: pointer;
}
@media (min-width: 40rem) { .hero h1 { font-size: 2.5rem; } .hero .deck { font-size: 1.2rem; } }
@media (min-width: 62rem) { .hero { padding-left: 2rem; padding-right: 2rem; } .hero-in { margin: 0 auto; max-width: 75rem; } .hero h1, .hero .deck { max-width: 34rem; } .hero h1 { font-size: 3rem; } }

/* steps: about one viewport apart; the card's centre sits on the 34% reading line when the step top is at the bar */
.step { min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-start; padding: 0 1rem; color: var(--stage-text); }
.card {
  position: relative; width: min(24rem, 100%); margin-top: calc(34vh - var(--topbar-h)); margin-top: calc(34svh - var(--topbar-h)); transform: translateY(-50%);
  background: var(--card); border: 1px solid var(--stage-line); border-radius: 14px; padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 20px 50px -22px rgba(0, 0, 0, .85);
}
.card h2 { font-size: 1.5rem; color: #fff; margin: 0 2.2rem .55rem 0; }
.card p { margin: 0 0 .7rem; font-size: 1.04rem; line-height: 1.55; }
.card p:last-child { margin-bottom: 0; }
.card a { color: var(--stage-accent); }
.card strong, .card b { color: #fff; font-weight: 650; }
.step[data-kind="fork"] .card { border-color: color-mix(in srgb, var(--stage-accent) 55%, transparent); }
.step[data-kind="turn"] .card { border-color: var(--stage-accent); }
.step[data-kind="end"] .card { border-color: var(--stage-accent); }
@media (min-width: 62rem) { .step { max-width: 75rem; margin: 0 auto; padding: 0 2rem; } .card { width: 26rem; } }

/* section permalinks: a real link, 44 px target */
.permalink { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; text-decoration: none; color: var(--muted); font: 500 1.1rem/1 var(--ui); opacity: .55; border-radius: .5rem; vertical-align: middle; }
.permalink:hover, .permalink:focus-visible { opacity: 1; color: var(--accent); }
.card .permalink { position: absolute; top: .3rem; right: .3rem; color: var(--stage-muted); }
.card .permalink:hover, .card .permalink:focus-visible { color: var(--stage-accent); }
@media (hover: hover) { .permalink { opacity: 0; } .card:hover .permalink, .sec h2:hover .permalink, .permalink:focus-visible { opacity: 1; } }

/* chrome sections after the story: opaque, above the fixed stage */
.sec { position: relative; z-index: 1; background: var(--bg); padding: 3.2rem 0; border-top: 1px solid var(--line); }
.sec.share { background: var(--surface); }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }
.sec h2 { font-size: 1.75rem; margin-bottom: 1.1rem; }
.sec p { margin: 0 0 1.05rem; }
@media (min-width: 40rem) { .sec h2 { font-size: 2.1rem; } }
.share-wrap { margin-top: 1.4rem; --sr-acc: var(--accent); --sr-ink: var(--text); --sr-line: var(--line); --sr-ok: var(--muted); }
.share-row a, .share-row button { color: var(--text); }
.foot { position: relative; z-index: 1; background: var(--bg); padding: 1.6rem 0 3rem; border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.foot p { margin: 0 0 .5rem; }
.nf { padding: 4rem 1rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #odo { transition: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print { .topbar, .progress, #stage, #odo, .share { display: none; } .card { background: none; color: #000; border: 0; transform: none; margin: 0; } .card h2 { color: #000; } .step, .hero { min-height: 0; color: #000; } .hero h1 { color: #000; text-shadow: none; } }

/* phone: the stage is a band over the top 56% of the screen and the text scrolls beneath it,
   so the hand and the line are never covered while a card is read */
@media (max-width: 61.99rem) {
  main { z-index: auto; }
  .js #stage {
    height: calc(56vh - 6px); height: calc(56svh - 6px); z-index: 2;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent);
  }
  html:not(.js) #stage { display: none; }
  .hero { position: relative; z-index: 3; background: linear-gradient(to bottom, rgba(9, 12, 21, 0) calc(56svh - 44px - var(--topbar-h)), var(--stage-bg) calc(56svh - 26px - var(--topbar-h))); padding-bottom: 5svh; }
  .step { position: relative; z-index: 1; background: var(--stage-bg); }
  .sec { z-index: 3; }
  .step { min-height: 0; }
  .card { margin-top: 30vh; margin-top: 30svh; transform: none; padding: .9rem 1rem 1rem; }
  .hero + .step .card { margin-top: calc(56vh - var(--topbar-h)); margin-top: calc(56svh - var(--topbar-h)); }
  #mana-libera { padding-bottom: 30svh; }
  html:not(.js) .card { margin-top: 2rem; }
  html:not(.js) .step { min-height: 0; padding-bottom: 1rem; }
  .card h2 { font-size: 1.3rem; }
  .card p { font-size: 1rem; line-height: 1.5; margin-bottom: .55rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero .deck { font-size: 1.02rem; }
}
@media (min-width: 62rem) { #odo { justify-content: flex-end; padding-right: 8vw; } }

/* a card reached by its address lands just below the stage band on phones */
@media (max-width: 61.99rem) {
  section.step { scroll-margin-top: 26vh; scroll-margin-top: 26svh; }
  .hero + section.step { scroll-margin-top: var(--topbar-h); }
}
/* short landscape screens: the band would leave no room for text, so the stage goes back behind the cards */
@media (max-width: 61.99rem) and (max-height: 520px) and (orientation: landscape) {
  .js #stage { height: 100%; z-index: 0; -webkit-mask-image: none; mask-image: none; }
  .step { background: none; }
  .card { width: min(46vw, 24rem); }
  #odo { justify-content: flex-end; padding-right: 4vw; }
  .hero { background: none; }
}


/* share row (standards/v2/tools/share_row.py) */
.share-row{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}
.share-row .lab{font-size:.95rem;margin-inline-end:.3rem}
.share-row a,.share-row button{display:inline-grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;padding:0;border-radius:50%;border:1px solid var(--sr-line,color-mix(in srgb,currentColor 28%,transparent));background:transparent;color:var(--sr-ink,inherit);text-decoration:none;cursor:pointer;font:inherit;transition:color .15s,border-color .15s}
.share-row a:hover,.share-row button:hover,.share-row a:focus-visible,.share-row button:focus-visible{color:var(--sr-acc,inherit);border-color:var(--sr-acc,currentColor)}
.share-row [hidden]{display:none}
@media (pointer:coarse){.share-row a,.share-row button{width:2.75rem;height:2.75rem}}
@media (max-width:30rem){.share-row .lab{flex-basis:100%;margin:0 0 .15rem}}
.share-status{font-size:.92rem;color:var(--sr-ok,inherit);min-height:1.2em;margin:.4rem 0 0}
.share-status:empty{display:none}
.share-field{display:block;width:100%;max-width:36rem;margin-top:.4rem;font:inherit;font-size:.9rem}
