/* ============================================================================
   STATION GUIDE  ·  style.css
   ----------------------------------------------------------------------------
   Design tokens follow pages/home/style.css.
   grep -n targets
     tokens ............... ":root"
     top nav .............. ".top"
     hero ................. ".hero"
     chapter layout ....... ".ch"
     figure ............... ".fig"
     palettes ............. ".pk" / ".ore" / ".job"
     wiki chips ........... ".wk"
     production line ...... ".chain"
     tiers ................ ".tiers" / ".tn" / ".tier-detail"
     phone ................ "@media (max-width: 760px)"
     touch sizes .......... "@media (hover: none)"
     pinned tier detail ... "PINNED DETAIL"
   ============================================================================ */
:root {
  --bg: #0a0c12; --bg2: #0e1119; --bg3: #131826;
  --ink: #eef3fb; --text: #c3d0e2; --dim: #7f91ad; --faint: #3a4866;
  --line: rgba(150, 200, 255, 0.09); --line2: rgba(150, 200, 255, 0.18);
  --blue: #96c8ff; --gold: #ffc832; --orange: #ff7b00; --red: #ff6a6a; --green: #6fe0a8;
  --glass: rgba(16, 21, 33, 0.62);
  --f-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --f-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --r: 16px; --gutter: clamp(16px, 4vw, 56px); --nav-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
body { font: 400 16px/1.6 var(--f-sans); color: var(--text); background: var(--bg); overflow-x: hidden; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse 80% 50% at 70% 0%, rgba(150, 200, 255, .07), transparent 70%), radial-gradient(ellipse 60% 40% at 0% 30%, rgba(255, 200, 50, .035), transparent 70%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: default; }
img { display: block; max-width: 100%; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--gold); letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- top nav ---- */
.top { position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center; gap: 18px; padding: 0 var(--gutter); background: rgba(10, 12, 18, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--blue), var(--gold), transparent); opacity: .3; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 500; color: var(--ink); }
.brand .mark { color: var(--gold); font-size: 12px; filter: drop-shadow(0 0 6px rgba(255, 200, 50, .6)); }
.brand em { font-size: 19px; }
.chaps { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 6px 2px; mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
.chaps::-webkit-scrollbar { display: none; }
/* Auto margins centre the links but keep the first link reachable when the row overflows. */
.chaps a:first-child { margin-left: auto; }
.chaps a:last-child { margin-right: auto; }
.chaps a { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; font-size: 13px; color: var(--dim); border: 1px solid transparent; transition: color .2s, border-color .2s, background .2s; }
.chaps a b { font: 500 11px/1 var(--f-mono); color: var(--faint); }
.chaps a:hover { color: var(--ink); }
.chaps a.on { color: var(--ink); border-color: var(--line2); background: rgba(150, 200, 255, .06); }
.chaps a.on b { color: var(--gold); }
.cta { flex: none; height: 36px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 13px; color: #1a1204; background: linear-gradient(135deg, #ffd65c, #ffb31a); transition: box-shadow .3s, transform .3s var(--ease); }
.cta:hover { box-shadow: 0 6px 24px -6px rgba(255, 190, 40, .8); transform: translateY(-1px); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line2); font-size: 14px; color: var(--ink); background: rgba(150, 200, 255, .04); transition: border-color .2s, background .2s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: rgba(150, 200, 255, .45); background: rgba(150, 200, 255, .08); }
.btn.pri { border: 0; color: #1a1204; font-weight: 600; background: linear-gradient(135deg, #ffd65c, #ffb31a); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 12.5px; border-radius: 10px; }

/* ---- hero ---- */
main { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter) 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 56px); align-items: center; padding: clamp(36px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }
.kick { font: 500 11px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--dim); margin-bottom: 18px; }
h1 { font-weight: 400; font-size: clamp(36px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -.02em; color: var(--ink); margin-bottom: 20px; }
h1 em { display: block; }
.lead { font-size: clamp(15px, 1.4vw, 17px); color: var(--text); max-width: 56ch; }
.hero-act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-art { border-radius: 22px; padding: 10px; background: linear-gradient(180deg, rgba(22, 28, 44, .8), rgba(12, 15, 24, .8)); border: 1px solid var(--line2); box-shadow: 0 40px 100px -40px rgba(150, 200, 255, .25), 0 0 0 1px rgba(0, 0, 0, .4); }
.cvbox { width: 100%; display: flex; justify-content: center; }
.cvbox canvas { display: block; border-radius: 12px; touch-action: manipulation; }

/* ---- chapter layout ---- */
.ch { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 56px); align-items: start; padding: clamp(48px, 7vw, 96px) 0; border-top: 1px solid var(--line); }
.ch:nth-of-type(even) .ch-text { order: 2; }
.ch-text { position: sticky; top: calc(var(--nav-h) + 24px); }
.num { font: 500 12px/1 var(--f-mono); color: var(--gold); letter-spacing: .14em; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.num::after { content: ''; height: 1px; width: 48px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .6; }
h2 { font-weight: 400; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.05; letter-spacing: -.015em; color: var(--ink); margin-bottom: 16px; }
.notes { list-style: none; margin: 20px 0 22px; display: flex; flex-direction: column; gap: 10px; }
.notes li { position: relative; padding-left: 20px; font-size: 14.5px; color: var(--text); }
.notes li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); background: var(--blue); opacity: .7; }
.notes b { color: var(--ink); font-weight: 500; }

/* ---- figure ---- */
.fig { border-radius: 20px; padding: 14px; background: linear-gradient(180deg, rgba(22, 28, 44, .82), rgba(12, 15, 24, .82)); border: 1px solid var(--line2); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9); min-width: 0; }
.fig-pal { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fig-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.fig-status { flex: 1; min-width: 0; font-size: 13px; color: var(--text); padding: 8px 12px; border-radius: 10px; background: rgba(150, 200, 255, .05); border: 1px solid var(--line); min-height: 36px; }
.fig-status b { color: var(--ink); font-weight: 500; }
.fig-status.bad { color: #ffc4c4; background: rgba(255, 106, 106, .07); border-color: rgba(255, 106, 106, .25); }
.fig figcaption { font-size: 12px; color: var(--dim); margin-top: 10px; }
.fig canvas { cursor: pointer; }

.pk { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(19, 24, 38, .6); transition: border-color .2s, background .2s; }
.pk img { width: 36px; height: 36px; object-fit: contain; }
.pk span { font-size: 12.5px; color: var(--ink); line-height: 1.2; text-align: center; }
.pk em { font: 400 10.5px/1 var(--f-mono); color: var(--dim); }
.pk:hover { border-color: var(--line2); }
.pk.on { border-color: rgba(255, 200, 50, .6); background: linear-gradient(180deg, rgba(255, 200, 50, .1), rgba(19, 24, 38, .7)); }
.pk.on em { color: var(--gold); }
.ore { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: rgba(19, 24, 38, .6); font-size: 12px; color: var(--text); }
.ore img { width: 24px; height: 24px; object-fit: contain; }
.ore.on { border-color: rgba(255, 200, 50, .6); color: var(--ink); background: rgba(255, 200, 50, .08); }
.job { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--dim); background: rgba(19, 24, 38, .6); }
.job i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--jc); }
.job.on { color: var(--ink); border-color: color-mix(in srgb, var(--jc) 55%, transparent); }
.job.on i { background: var(--jc); box-shadow: 0 0 8px var(--jc); }

/* ---- wiki chips ---- */
.wks { display: flex; flex-wrap: wrap; gap: 6px; }
.wk { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12.5px; color: var(--text); background: rgba(150, 200, 255, .03); transition: border-color .2s, color .2s; }
.wk:hover { border-color: rgba(150, 200, 255, .5); color: var(--ink); }
.wk img, .wk i { width: 24px; height: 24px; border-radius: 50%; object-fit: contain; background: rgba(150, 200, 255, .08); display: grid; place-items: center; font-style: normal; font-size: 11px; color: var(--blue); flex: none; }
.pair { display: inline-flex; align-items: center; gap: 6px; }
.via { font: 400 10.5px/1 var(--f-mono); color: var(--faint); }
#jobChips { gap: 8px 14px; }

/* ---- production line ---- */
.chain-wrap { grid-column: 1 / -1; margin-top: 8px; order: 3; }
.chain-wrap h3 { font: 500 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 14px; }
.chain { display: flex; align-items: stretch; gap: 10px; }
.stage-card { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(22, 28, 44, .7), rgba(14, 18, 28, .7)); transition: border-color .2s, transform .3s var(--ease); }
.stage-card:hover { border-color: rgba(150, 200, 255, .4); transform: translateY(-2px); }
.sc-art { height: 64px; display: grid; place-items: center; margin-bottom: 4px; }
.sc-art img { max-height: 60px; max-width: 70%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .6)); }
.stage-card b { font-weight: 500; color: var(--ink); }
.stage-card small { font: 400 11.5px/1.4 var(--f-mono); color: var(--dim); }
.chain .arrow { display: grid; place-items: center; color: var(--gold); flex: none; }
.chain .arrow svg { width: 26px; height: 13px; }

/* ---- tiers ---- */
.ch.wide { grid-template-columns: 1fr; }
.ch.wide .ch-text { position: static; order: 0; }
.tier-fig { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.tier-wrap { position: relative; min-width: 0; }
.tiers { display: grid; grid-template-columns: 1fr 1fr 1fr 1.7fr 1fr; gap: 18px; position: relative; z-index: 1; }
.tier-lines { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.tier-lines path { fill: none; stroke-width: 1.4; }
.tcol h4 { font: 500 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.tlist { display: flex; flex-direction: column; gap: 4px; }
.tcol.wide .tlist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 6px; }
.tn { display: flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; border-radius: 9px; border: 1px solid transparent; text-align: left; font-size: 12px; color: var(--text); background: rgba(19, 24, 38, .7); transition: opacity .2s, border-color .2s, background .2s; min-width: 0; }
.tn img, .tn i { width: 24px; height: 24px; object-fit: contain; flex: none; display: grid; place-items: center; font-style: normal; color: var(--blue); font-size: 11px; }
.tn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn:hover { border-color: var(--line2); }
.has-sel .tn.dim { opacity: .28; }
.tn.sel { border-color: var(--ink); background: rgba(238, 243, 251, .1); color: var(--ink); }
.tn.up { border-color: rgba(255, 200, 50, .6); background: rgba(255, 200, 50, .1); color: var(--ink); }
.tn.down { border-color: rgba(111, 224, 168, .55); background: rgba(111, 224, 168, .08); color: var(--ink); }
.tier-detail { position: sticky; top: calc(var(--nav-h) + 16px); border-radius: var(--r); padding: 16px; border: 1px solid var(--line); background: rgba(10, 12, 18, .5); }
.td-h { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; position: relative; }
.td-h img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .6)); }
.td-h small { font: 400 10.5px/1 var(--f-mono); color: var(--dim); }
.td-h h4 { font-size: 18px; font-weight: 500; color: var(--ink); margin: 4px 0; }
.td-h .more { font-size: 12.5px; color: var(--blue); }
.td-h .x { position: absolute; right: -4px; top: -4px; width: 32px; height: 32px; border-radius: 8px; font-size: 20px; color: var(--dim); }
.tier-detail h5 { font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 14px 0 8px; }
.fine { font-size: 13px; color: var(--dim); }
.gold { color: var(--gold); font-weight: 500; }
.green { color: var(--green); font-weight: 500; }

/* ---- outro ---- */
.outro { text-align: center; padding: clamp(56px, 8vw, 110px) 0 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; }
.outro .lead { margin: 0 auto; }
.outro .hero-act { justify-content: center; }

/* ---- responsive ---- */
@media (max-width: 1080px) {
  .tier-fig { grid-template-columns: 1fr; }
  /* Narrow tree columns: wrap long names to two lines, do not cut them. */
  .tn span { white-space: normal; line-height: 1.15; overflow-wrap: break-word; }
  .tcol.wide .tlist { grid-template-columns: 1fr; }
  /* PINNED DETAIL: the detail sits under the whole tree here. It sticks to
     the bottom of the screen while the tree is in view, so a tap on a
     resource shows its detail without a scroll. */
  .tier-detail { position: sticky; top: auto; bottom: 0; z-index: 2; max-height: min(42vh, 360px); max-height: min(42dvh, 360px); overflow-y: auto; overscroll-behavior: contain; background: #0c0f18; border-color: var(--line2); box-shadow: 0 -18px 40px -18px rgba(0, 0, 0, .9); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .hero, .ch { grid-template-columns: 1fr; }
  .ch:nth-of-type(even) .ch-text { order: 0; }
  .ch-text { position: static; }
  .chain { flex-wrap: wrap; }
  .chain .arrow { display: none; }
  .stage-card { flex: 1 1 calc(50% - 10px); }
}
@media (max-width: 760px) {
  :root { --nav-h: 52px; }
  .top { gap: 8px; padding: 0 0 0 14px; }
  .brand { font-size: 14px; }
  .brand em { font-size: 17px; }
  .chaps { justify-content: flex-start; }
  .chaps a { padding: 7px 10px; font-size: 12.5px; }
  .chaps a b { display: none; }
  .cta { display: none; }
  .fig { padding: 10px; border-radius: 16px; }
  .pk { padding: 8px 4px 6px; }
  .pk img { width: 30px; height: 30px; }
  .pk span { font-size: 11.5px; }
  .pk em { display: none; }
  .pal-ores { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -10px 10px; padding: 0 10px; }
  .pal-ores::-webkit-scrollbar { display: none; }
  .ore { flex: none; }
  .fig-bar { flex-wrap: wrap; }
  .fig-status { flex-basis: 100%; font-size: 14px; }
  .fig figcaption { font-size: 14px; }
  .fine { font-size: 14px; }
  .tiers { grid-template-columns: 1fr; gap: 14px; }
  .tlist, .tcol.wide .tlist { display: flex; flex-direction: row; flex-wrap: wrap; gap: 5px; }
  .tn { padding: 3px 9px 3px 3px; }
  .tn img, .tn i { width: 22px; height: 22px; }
  .tier-lines { display: none; }
  .stage-card { flex: 1 1 calc(50% - 10px); padding: 12px; }
}
@media (hover: none) {
  .btn { min-height: 44px; }
  .btn.sm { min-height: 44px; }
  .ore, .job, .wk { min-height: 40px; }
  .tn { min-height: 36px; }
  .brand, .chaps a { min-height: 44px; }
  .cta { height: 44px; }
  .td-h .x { width: 44px; height: 44px; right: -10px; top: -10px; }
}
/* Landscape phone: the pinned detail takes less of the short screen. */
@media (max-height: 500px) and (max-width: 1080px) {
  .tier-detail { max-height: 46vh; max-height: 46dvh; }
  /* The figure status and caption are body text: 14px on a phone, also
     when it is held sideways and wider than 760px. */
  .fig-status, .fig figcaption { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
