/* Sinking Star Guide — site.css
   Order: fonts → tokens → base → shell → home → article → components → responsive
   Visual direction: twilight sea + star-gold on a faint puzzle grid (see SITE_PROFILE). */

/* ---------- fonts (self-hosted, OFL) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-var.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-italic-var.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --night: #1a1c44;
  --night-2: #23265a;
  --night-3: #2e3270;
  --deep: #121433;
  --sea: #2f9c94;
  --sea-soft: #d8efeb;
  --gold: #f2c45a;
  --gold-deep: #9a6a12;
  --parchment: #f7f2e8;
  --card: #fffdf8;
  --ink: #1d2033;
  --ink-soft: #4a4e66;
  --rule: #e2d8c4;
  --on-night: #eef0ff;
  --on-night-soft: #b9bde6;

  --w-heroes: #d4614a;
  --w-mirror: #2f9c94;
  --w-stones: #4a8fc9;
  --w-beams: #9a63c7;
  --w-gold: #d9a62e;

  --font-display: "Fraunces", "Georgia", "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;

  --measure: 68ch;
  --wide: 72rem;
  --radius: 14px;
  --radius-sm: 8px;
  --gap: clamp(1rem, 2.5vw, 1.5rem);
  --shadow: 0 1px 2px rgba(18, 20, 51, .08), 0 8px 24px rgba(18, 20, 51, .08);
  --grid-line: rgba(255, 255, 255, .055);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: #1f6f8c; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: #0f4f68; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; color: var(--ink); font-weight: 650; letter-spacing: -.005em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); margin: 0 0 .6rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.25rem; margin: 1.8rem 0 .5rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.3rem; margin: 0 0 1rem; }
li { margin: .25rem 0; }
kbd {
  font: 600 .85em/1 var(--font-body);
  background: #fff; border: 1px solid #c9c0ad; border-bottom-width: 2px;
  border-radius: 5px; padding: .15em .45em; white-space: nowrap;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--gold); color: var(--deep); padding: .5rem .9rem; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- shell ---------- */
.site-header {
  background: var(--deep);
  color: var(--on-night);
  border-bottom: 1px solid rgba(242, 196, 90, .25);
}
.site-header__inner {
  max-width: var(--wide); margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--on-night); text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { width: 40px; height: 40px; }
.brand__name { font-family: var(--font-display); font-weight: 650; font-size: 1.15rem; line-height: 1.1; display: block; }
.brand__tag { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
  display: inline-block; padding: .45rem .75rem; border-radius: 999px;
  color: var(--on-night); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.site-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.site-nav a[aria-current="page"] { background: rgba(242, 196, 90, .16); color: var(--gold); }

.site-footer {
  background: var(--deep); color: var(--on-night-soft); margin-top: 4rem;
  border-top: 3px solid var(--gold);
  font-size: .95rem;
}
.site-footer__inner {
  max-width: var(--wide); margin: 0 auto; padding: 2rem 1rem 2.2rem;
  display: grid; gap: 1.2rem; grid-template-columns: 1fr auto; align-items: start;
}
.site-footer .brand__name { color: var(--on-night); }
.site-footer p { margin: .4rem 0 0; max-width: 60ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem 1.1rem; flex-wrap: wrap; justify-content: flex-end; }
.footer-links a, .site-footer a { color: var(--on-night); }
.footer-links a:hover, .site-footer a:hover { color: var(--gold); }
.footer-check { grid-column: 1 / -1; max-width: none !important; font-size: .85rem; color: #9ea3d4; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1rem; }

/* faint puzzle grid used on night bands */
.gridded {
  background-color: var(--night);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    radial-gradient(120% 90% at 85% 0%, rgba(47, 156, 148, .35), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, rgba(154, 99, 199, .25), transparent 60%);
  background-size: 48px 48px, 48px 48px, 100% 100%, 100% 100%;
}

/* ---------- home ---------- */
.hero { color: var(--on-night); }
.hero__inner {
  max-width: var(--wide); margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) 1rem clamp(2.2rem, 5vw, 3.5rem);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 .9rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
}
.eyebrow::before { content: ""; width: .7rem; height: .7rem; background: var(--gold); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.hero h1 { color: #fff; font-size: clamp(2rem, 3.6vw, 2.9rem); }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero__lede { font-size: 1.15rem; color: var(--on-night); max-width: 36rem; }
.hero__facts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 1.4rem; padding: 0; list-style: none; }
.hero__facts li {
  margin: 0; padding: .3rem .75rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .7rem 1.15rem; border-radius: 999px;
  font-weight: 700; text-decoration: none; border: 2px solid transparent; line-height: 1.2;
}
.btn--gold { background: var(--gold); color: var(--deep); }
.btn--gold:hover { background: #ffd57a; color: var(--deep); }
.btn--ghost { border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.hero__note { margin-top: 1rem; font-size: .88rem; color: var(--on-night-soft); }
.hero__note a { color: var(--on-night); }

.hero__art { position: relative; }
.hero__art figure { margin: 0; }
.hero__art img {
  border-radius: var(--radius); border: 1px solid rgba(242, 196, 90, .4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.hero__art figcaption { font-size: .78rem; color: var(--on-night-soft); margin-top: .5rem; }

/* compass of the four worlds */
.compass {
  max-width: var(--wide); margin: 0 auto; padding: 0 1rem;
  display: grid; gap: .9rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  transform: translateY(-1.6rem);
}
.world {
  position: relative; background: var(--card); border-radius: var(--radius); padding: 1rem 1rem 1.05rem;
  box-shadow: var(--shadow); border-top: 5px solid var(--wc, var(--sea));
}
.world__dir {
  display: inline-block; font: 700 .75rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--wc, var(--sea)); padding: .32rem .55rem; border-radius: 6px; margin-bottom: .55rem;
}
.world h3 { margin: 0 0 .35rem; font-size: 1.12rem; }
.world p { margin: 0; font-size: .95rem; color: var(--ink-soft); line-height: 1.55; }
.world--heroes { --wc: var(--w-heroes); }
.world--mirror { --wc: var(--w-mirror); }
.world--stones { --wc: var(--w-stones); }
.world--beams { --wc: var(--w-beams); }

.section { max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1rem; }
.section > h2:first-child { margin-top: .5rem; }
.section__intro { max-width: var(--measure); color: var(--ink-soft); }

.status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .8rem; margin: 1rem 0 .6rem;
}
.stat { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.stat dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-soft); }
.stat dd { margin: .2rem 0 0; font-weight: 600; line-height: 1.45; }
.stat dd small { display: block; font-weight: 400; color: var(--ink-soft); font-size: .85rem; }
.checked { font-size: .88rem; color: var(--ink-soft); }

.intent-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.intent {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.2rem; box-shadow: var(--shadow); position: relative;
}
.intent::before {
  content: ""; position: absolute; top: 1.2rem; right: 1.2rem; width: 1.1rem; height: 1.1rem; background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.intent h3 { margin: 0 2rem .45rem 0; font-size: 1.2rem; }
.intent h3 a { color: var(--ink); text-decoration: none; }
.intent h3 a:hover { color: #1f6f8c; text-decoration: underline; }
.intent p { color: var(--ink-soft); font-size: .98rem; }
.intent__answer { color: var(--ink) !important; font-weight: 600; }
.intent__more { margin-top: auto; font-weight: 700; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2.2rem; }
.split > div > h2:first-child { margin-top: .5rem; }

/* ---------- article ---------- */
.page-head { color: var(--on-night); }
.page-head__inner { max-width: var(--wide); margin: 0 auto; padding: 1.6rem 1rem 2.2rem; }
.page-head h1 { color: #fff; max-width: 24ch; }
.page-head .lede { font-size: 1.12rem; max-width: 62ch; color: var(--on-night); margin: 0; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .3rem; font-size: .88rem; }
.breadcrumb li { margin: 0; color: var(--on-night-soft); }
.breadcrumb li + li::before { content: "›"; margin-right: .35rem; color: var(--gold); }
.breadcrumb a { color: var(--on-night); }
.page-meta { margin-top: 1rem; font-size: .88rem; color: var(--on-night-soft); }

.article { max-width: var(--wide); margin: 0 auto; padding: 2rem 1rem 0; }
.article__body { max-width: 62rem; }
.article__body > :not(.table-wrap):not(.figure) { max-width: var(--measure); }
.article__body > :first-child { margin-top: 0; }
.answer {
  background: var(--card); border: 1px solid var(--rule); border-left: 5px solid var(--gold);
  border-radius: var(--radius-sm); padding: 1rem 1.15rem; margin: 0 0 1.6rem; box-shadow: var(--shadow);
}
.answer p:last-child, .answer ul:last-child, .answer ol:last-child { margin-bottom: 0; }
.answer__label { display: block; font: 700 .76rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: .5rem; }
.toc { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .8rem 1.1rem; margin: 0 0 1.8rem; background: rgba(255,255,255,.5); }
.toc p { margin: 0 0 .3rem; font-weight: 700; font-size: .9rem; }
.toc ol { margin: 0; font-size: .97rem; }

.figure { margin: 1.6rem 0; }
.figure img { border-radius: var(--radius-sm); border: 1px solid var(--rule); }
.figure figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .45rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 2px; }
.data-table { border-collapse: collapse; width: 100%; font-size: .96rem; line-height: 1.5; }
.data-table caption { text-align: left; font-weight: 700; padding: .7rem .9rem 0; font-size: .92rem; color: var(--ink-soft); }
.data-table th, .data-table td { padding: .6rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.data-table thead th { background: #efe7d6; font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wide-table { min-width: 44rem; }

.note { border-radius: var(--radius-sm); padding: .85rem 1rem; margin: 1.2rem 0; background: var(--sea-soft); border: 1px solid #b6ddd6; }
.note p:last-child { margin-bottom: 0; }
.note--warn { background: #fdf0d8; border-color: #edd29a; }
.note--spoiler { background: #efe8f8; border-color: #d3c3ea; }
.note strong:first-child { display: inline; }

.tag {
  display: inline-block; font: 700 .72rem/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  padding: .28rem .45rem; border-radius: 5px; color: #fff; background: var(--sea); vertical-align: .12em; white-space: nowrap;
}
.tag--heroes { background: var(--w-heroes); }
.tag--mirror { background: var(--w-mirror); }
.tag--stones { background: var(--w-stones); }
.tag--beams { background: var(--w-beams); }
.tag--gold { background: var(--w-gold); color: var(--deep); }
.tag--fixed { background: #2f7d4f; }
.tag--open { background: #9a3b2b; }
.tag--workaround { background: #8a6512; }

.bar { display: flex; align-items: center; gap: .5rem; min-width: 9rem; }
.bar__track { flex: 1; height: .55rem; background: #ece3d1; border-radius: 99px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--wc, var(--sea)); border-radius: 99px; }
.bar__val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.2rem; text-align: right; }

.steps { counter-reset: s; list-style: none; padding-left: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 2.6rem; margin: .9rem 0; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: .05rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--night); color: var(--gold); font: 700 .95rem/1.8rem var(--font-body); text-align: center;
}

details.hint { border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card); margin: .7rem 0; }
details.hint summary { cursor: pointer; padding: .7rem 1rem; font-weight: 700; list-style-position: inside; }
details.hint[open] summary { border-bottom: 1px solid var(--rule); }
details.hint > div { padding: .8rem 1rem .2rem; }

a.ext::after { content: " ↗"; font-size: .85em; }

.related { max-width: var(--measure); margin: 2.6rem 0 0; padding: 1.2rem 1.25rem; border-radius: var(--radius); background: var(--night); color: var(--on-night); }
.related h2 { color: #fff; margin: 0 0 .6rem; font-size: 1.25rem; }
.related ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.related a { color: var(--gold); font-weight: 700; }
.related span { color: var(--on-night-soft); }

.source-line { font-size: .9rem; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 2rem; }

/* 404 */
.notfound { max-width: 40rem; margin: 0 auto; padding: 4rem 1rem 2rem; text-align: center; }
.notfound .code { font: 700 4.5rem/1 var(--font-display); color: var(--gold); margin: 0; }
.notfound h1 { color: #fff; }
.notfound p { color: var(--on-night); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .compass { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .site-footer__inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
}
@media (max-width: 640px) {
  body { font-size: 1.03rem; }
  .site-header__inner { padding: .6rem 1rem; }
  .site-nav { width: 100%; }
  .site-nav ul { gap: .1rem; }
  .site-nav a { padding: .35rem .55rem; font-size: .9rem; }
  .site-nav ul { flex-wrap: nowrap; }
  .compass { grid-template-columns: 1fr; transform: translateY(-1rem); }
  .brand__name { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .site-nav a { transition: background-color .15s, color .15s, border-color .15s; }
}
.page-meta a, .page-head a { color: var(--on-night); }
