/* The World page: an atlas of the Outcasts. Builds on brand.css (Outcasts theme).
   Light paper for places and plates, black for blueprints and the ship. One world accent: vermilion, the seal's colour. */

:root[data-theme="outcasts"] .world, .world {
  --shu: #C8402A;                 /* vermilion, the world's one accent */
  --shu-ink: #A8321F;
  --gold: #C9A55A;
  --paper: #F2F1EE; --night: #0B0B0D;
  --accent: var(--shu); --accent-ink: var(--shu-ink);
  --jp: "Trograin JP Serif", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", "Songti SC", serif;
  --jp-sans: "Trograin JP Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
.jp { font-family: var(--jp); font-weight: 600; letter-spacing: .08em; }
.jp-sans { font-family: var(--jp-sans); }
.mono { font-family: var(--font-mono); }
.seal { display: inline-block; width: 10px; height: 10px; background: var(--shu); vertical-align: middle; }

/* ---------- Hero ---------- */
.w-hero { position: relative; min-height: max(100svh, 680px); overflow: clip; isolation: isolate; background: var(--paper); }
.w-hero__img { position: absolute; inset: 0; z-index: -1; }
.w-hero__img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; animation: w-settle 3.2s var(--ease-out) both; }
.w-hero__img::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(242 241 238 / .55) 0%, transparent 22%, transparent 62%, var(--paper) 100%),
              linear-gradient(90deg, rgb(242 241 238 / .85) 0%, rgb(242 241 238 / .2) 42%, transparent 60%); }
@keyframes w-settle { from { transform: scale(1.08); filter: blur(6px); opacity: 0; } }
.w-hero__copy { position: absolute; left: var(--gutter); top: clamp(110px, 20svh, 220px); z-index: 3; }
.w-hero__title { margin: 0; font: 900 clamp(64px, 13vw, 240px)/.82 var(--font-display); font-stretch: 75%; text-transform: uppercase; letter-spacing: -.01em; }
.w-hero__title .line { display: block; overflow: clip; }
.w-hero__title .line > span { display: inline-block; animation: rise 1.3s var(--ease-out) both, breathe 2.4s var(--ease-out) both; }
.w-hero__title .line:nth-child(2) > span { animation-delay: .14s, .14s; color: var(--shu); }
.w-hero__lede { max-width: 38ch; margin: clamp(18px, 3svh, 32px) 0 0; color: var(--ink-2); font-size: clamp(15px, 1.15vw, 18px); animation: fade 1.2s .6s var(--ease-out) both; }
.w-hero__kanji { position: absolute; right: var(--gutter); top: clamp(100px, 16svh, 180px); z-index: 3; writing-mode: vertical-rl;
  font: 600 clamp(56px, 8vw, 150px)/1 var(--jp); letter-spacing: .12em; color: var(--ink); opacity: .9; animation: fade 1.6s .4s var(--ease-out) both; }
.w-hero__kanji::after { content: ""; display: block; width: .26em; height: .26em; margin-top: .3em; background: var(--shu); }
.w-readout { position: absolute; left: var(--gutter); bottom: clamp(24px, 5svh, 56px); z-index: 3; display: flex; gap: clamp(20px, 4vw, 64px); flex-wrap: wrap; }
.w-readout div { display: grid; gap: 6px; }
.w-readout b { font: 800 clamp(16px, 1.4vw, 22px)/1 var(--font-display); font-stretch: 90%; text-transform: uppercase; }
.w-readout .tick { font-variant-numeric: tabular-nums; }

/* our ink: one great brush stroke cutting from one section into the next */
.w-band { position: relative; z-index: 4; pointer-events: none; margin: -7vw 0 -5vw; overflow: clip; }  /* the ink carries its own transparency: no blending */
.w-band img { display: block; width: 104vw; max-width: none; margin-left: -2vw; height: auto;
  clip-path: inset(0 100% 0 0); transition: clip-path 1.8s var(--ease-out); }
.w-band.is-in img { clip-path: inset(0 0 0 0); }

/* ---------- Section heads ---------- */
.w-sec { position: relative; padding: clamp(80px, 14svh, 170px) var(--gutter); }
.w-head { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: clamp(16px, 3vw, 48px); margin-bottom: clamp(40px, 7svh, 90px); }
.w-head__num { font: 900 clamp(64px, 9vw, 150px)/.8 var(--font-display); font-stretch: 75%; color: transparent; -webkit-text-stroke: 1px currentColor; opacity: .5; }
.w-head h2 { margin: 0; font: 900 clamp(40px, 6.4vw, 112px)/.86 var(--font-display); font-stretch: 75%; text-transform: uppercase; }
.w-head h2 .jp { display: block; margin-top: .25em; font-size: .3em; color: var(--shu); letter-spacing: .3em; }
.w-head p { margin: 0; max-width: 40ch; color: var(--ink-2); }

/* ---------- Atlas ---------- */
.atlas { background: var(--paper); }
.atlas__chart { position: relative; }
.atlas svg { width: 100%; height: auto; display: block; overflow: visible; }
.atlas .grid line { stroke: var(--ink); stroke-opacity: .06; }
.atlas .draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); transition: stroke-dashoffset 2.4s var(--ease-out); }
.atlas.is-in .draw { stroke-dashoffset: 0; }
.atlas .fadein { opacity: 0; transition: opacity 1.2s 1.2s var(--ease-out); }
.atlas.is-in .fadein { opacity: 1; }
.atlas text { font-family: var(--font-mono); font-size: 13px; letter-spacing: .14em; fill: var(--ink-2); text-transform: uppercase; }
.atlas text.jp { font-family: var(--jp); letter-spacing: .2em; fill: var(--ink); font-size: 15px; text-transform: none; }
.atlas text.big { font-family: var(--font-display); font-weight: 800; font-size: 22px; fill: var(--ink); letter-spacing: .04em; }
.atlas .pin { cursor: pointer; }
.atlas .pin circle { fill: var(--paper); stroke: var(--shu); stroke-width: 1.5; transition: fill .3s, r .3s; }
.atlas .pin text { fill: var(--shu); font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.atlas .pin:hover circle, .atlas .pin:focus circle { fill: var(--shu); }
.atlas .pin:hover text, .atlas .pin:focus text { fill: var(--paper); }
.atlas .pin:focus { outline: none; }
.atlas__legend { list-style: none; margin: clamp(28px, 5svh, 56px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 0; border-top: 1px solid var(--line); }
.atlas__legend a { display: grid; grid-template-columns: 34px 1fr auto; align-items: baseline; gap: 10px; padding: 16px 12px 16px 0; border-bottom: 1px solid var(--line); transition: background .3s, padding .4s var(--ease-out); }
.atlas__legend a:hover { background: rgb(200 64 42 / .05); padding-left: 10px; }
.atlas__legend .n { font: 700 12px/1 var(--font-mono); color: var(--shu); }
.atlas__legend b { font: 800 17px/1.1 var(--font-display); font-stretch: 88%; text-transform: uppercase; }
.atlas__legend .jp { font-size: 14px; color: var(--muted); }

/* ---------- Places ---------- */
.place { position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 90px); align-items: center;
  padding: clamp(60px, 11svh, 140px) var(--gutter); background: var(--paper); }
.place--flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.place--flip .place__img { order: 2; }
.place__img { position: relative; margin: 0; }
.place__img img { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; object-fit: cover;
  -webkit-mask: radial-gradient(120% 100% at 50% 50%, #000 58%, transparent 100%); mask: radial-gradient(120% 100% at 50% 50%, #000 58%, transparent 100%); }
.place__num { position: absolute; left: 0; top: -.42em; font: 900 clamp(80px, 12vw, 200px)/.8 var(--font-display); font-stretch: 75%;
  color: transparent; -webkit-text-stroke: 1px var(--ink); opacity: .35; pointer-events: none; }
.place__body { position: relative; display: grid; gap: 18px; align-content: start; padding-right: clamp(56px, 5vw, 88px); }
.place__kanji { position: absolute; right: 0; top: 0; margin: 0; writing-mode: vertical-rl; font: 600 clamp(28px, 3vw, 48px)/1 var(--jp); letter-spacing: .3em; opacity: .85; }
.place__kanji::after { content: ""; display: block; width: .22em; height: .22em; margin-top: .4em; background: var(--shu); }
.place h3 { margin: 0; font: 900 clamp(36px, 4.6vw, 80px)/.88 var(--font-display); font-stretch: 75%; text-transform: uppercase; }
.place p { margin: 0; color: var(--ink-2); max-width: 46ch; }
.spec { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 6px 0 0; border-top: 1px solid var(--line); font: 500 12px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.spec dt, .spec dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.spec dt { color: var(--muted); padding-right: 22px; white-space: nowrap; }
.spec dt .jp-sans { letter-spacing: .1em; margin-right: 6px; color: var(--ink-2); }
.spec dd { color: var(--ink); }
.spec dd a { text-decoration: underline; text-decoration-color: var(--shu); text-underline-offset: .2em; }
.place__plate { margin-top: 6px; display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; cursor: zoom-in; }
.place__plate img { width: 120px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; box-shadow: inset 0 0 0 1px var(--line); }
.place--night { background: var(--night); color: var(--paper); --ink: var(--paper); --ink-2: #C9CCD3; --muted: #8B8E97; --line: rgb(242 241 238 / .14); }
.place--night .place__img img { -webkit-mask: none; mask: none; }

/* ---------- The diagonal cut (dark band entering at a slant) ---------- */
.w-cut { position: relative; height: clamp(90px, 12vw, 200px); background: var(--night); clip-path: polygon(0 100%, 100% 0, 100% 100%, 0 100%); margin-top: -1px; }
.w-cut--out { clip-path: polygon(0 0, 100% 0, 0 100%); }

/* ---------- Blueprints (dark) ---------- */
.prints { background: var(--night); color: var(--paper); --ink: var(--paper); --ink-2: #C9CCD3; --muted: #8B8E97; --line: rgb(242 241 238 / .14); padding-inline: 0; }
.prints .w-head { padding-inline: var(--gutter); }
.rail { scroll-padding-inline: var(--gutter); display: flex; gap: clamp(16px, 2.4vw, 36px); overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px var(--gutter) 28px; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; cursor: grab; }
.rail:active { cursor: grabbing; }
.rail > figure { flex: 0 0 min(78vw, 980px); scroll-snap-align: start; margin: 0; display: grid; gap: 14px; }
.rail img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #111; transition: transform .8s var(--ease-out), box-shadow .8s var(--ease-out); cursor: zoom-in;
  box-shadow: 0 0 0 1px rgb(201 165 90 / .12), 0 24px 70px -30px rgb(201 165 90 / .35); }
.rail img:hover { transform: translateY(-6px); }
.rail figcaption { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: baseline; }
.rail figcaption b { font: 800 clamp(18px, 1.6vw, 24px)/1 var(--font-display); font-stretch: 88%; text-transform: uppercase; }
.rail figcaption .jp { color: var(--gold); font-size: 16px; }
.rail__hint { padding: 0 var(--gutter); display: flex; justify-content: space-between; color: var(--muted); }

/* ---------- The ship (dark) ---------- */
.ship { background: var(--night); color: var(--paper); --ink: var(--paper); --ink-2: #C9CCD3; --muted: #8B8E97; --line: rgb(242 241 238 / .14); }
.ship__stage { position: relative; }
.ship__stage img { width: 100%; height: auto; display: block; }
.ship__grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.key { list-style: none; margin: 0; padding: 0; counter-reset: k; border-top: 1px solid var(--line); }
.key li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.key li::before { counter-increment: k; content: counter(k); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--shu); color: var(--shu); font: 700 11px/1 var(--font-mono); }
.key b { display: block; color: var(--ink); font: 800 15px/1.2 var(--font-display); font-stretch: 90%; text-transform: uppercase; letter-spacing: .03em; }
.key .jp-sans { color: var(--gold); font-size: 12px; letter-spacing: .12em; }
.redact { display: inline-block; background: var(--ink); color: transparent; user-select: none; padding: 0 .3em; border-radius: 1px; }

/* ---------- Instruments (light) ---------- */
.instruments { background: var(--paper); }
.inst { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(36px, 5vw, 80px) clamp(24px, 3vw, 48px); }
.inst figure { margin: 0; display: grid; gap: 14px; }
.inst figure:nth-child(3n+1) { grid-column: 1 / -1; }
.inst img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.inst figcaption { display: grid; gap: 8px; }
.inst figcaption b { font: 800 clamp(20px, 1.8vw, 28px)/1 var(--font-display); font-stretch: 85%; text-transform: uppercase; }
.inst figcaption .row { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.inst figcaption .jp { color: var(--shu); font-size: 15px; }
.inst figcaption p { margin: 0; color: var(--ink-2); max-width: 70ch; font-size: 15px; }
.inst .today { font: 500 11px/1.5 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Viewer (full-screen plate with its key) ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: none; grid-template-columns: minmax(0, 1fr) min(360px, 34vw); background: #0B0B0D; color: var(--paper);
  --ink: var(--paper); --ink-2: #C9CCD3; --muted: #8B8E97; --line: rgb(242 241 238 / .14); }
.viewer.is-open { display: grid; animation: fade .4s var(--ease-out) both; }
.viewer__img { display: grid; place-items: center; padding: clamp(16px, 3vw, 48px); min-height: 0; }
.viewer__img img { max-width: 100%; max-height: calc(100svh - 64px); object-fit: contain; }
.viewer__side { overflow: auto; padding: clamp(24px, 3vw, 48px) clamp(20px, 2.4vw, 36px); border-left: 1px solid var(--line); display: grid; gap: 18px; align-content: start; }
.viewer__side h3 { margin: 0; font: 900 clamp(28px, 2.6vw, 44px)/.9 var(--font-display); font-stretch: 78%; text-transform: uppercase; }
.viewer__close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--paper); font: 400 26px/1 var(--font-text); }

/* ---------- Footer ---------- */
.w-foot { background: var(--paper); padding: clamp(60px, 10svh, 120px) var(--gutter); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; border-top: 1px solid var(--line); }
.w-foot p { margin: 0; max-width: 52ch; color: var(--ink-2); }

/* ---------- Reveal on scroll ---------- */
.rv { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out); }
.rv.is-in { opacity: 1; transform: none; }

/* ---------- Phone ---------- */
@media (max-width: 900px) {
  .w-hero { display: flex; flex-direction: column; justify-content: flex-end; padding: 96px 16px 28px; min-height: 92svh; }
  .w-hero__img::after { background: linear-gradient(180deg, rgb(242 241 238 / .7) 0%, transparent 30%, transparent 50%, var(--paper) 92%); }
  .w-hero__copy { position: static; }
  .w-hero__kanji { top: 88px; right: 16px; font-size: 54px; }
  .w-readout { position: static; margin-top: 26px; gap: 18px 26px; }
  .w-head { grid-template-columns: 1fr; gap: 14px; }
  .w-head__num { display: none; }
  .place, .place--flip { grid-template-columns: 1fr; padding-inline: 16px; }
  .place--flip .place__img { order: 0; }
  .place__body { padding-right: 0; }
  .place__kanji { position: static; order: -1; writing-mode: horizontal-tb; font-size: 22px; }
  .place__kanji::after { display: none; }
  .atlas__chart { overflow-x: auto; margin-inline: -16px; padding-inline: 16px; }
  .atlas__chart svg { min-width: 860px; }
  .atlas__chart::after { content: "Swipe the chart →"; display: block; position: sticky; left: 0; margin-top: 8px; font: 500 11px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .ship__grid { grid-template-columns: 1fr; }
  .inst { grid-template-columns: 1fr; }
  .rail > figure { flex-basis: 86vw; }
  .viewer { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .viewer__side { border-left: 0; border-top: 1px solid var(--line); }
  .w-foot { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; }
  .w-band img { clip-path: none; }
  .atlas .draw { stroke-dashoffset: 0; }
  .atlas .fadein { opacity: 1; }
}

/* the ship's other views, side by side under the main sheet */
.ship__views { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(20px, 3vw, 48px); margin-top: clamp(36px, 6svh, 80px); align-items: end; }
.ship__views figure { margin: 0; display: grid; gap: 10px; }
.ship__views img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.ship__stage img { cursor: zoom-in; }
.redact-line { display: flex; gap: 12px; align-items: baseline; margin-top: 18px; font: 500 12px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 900px) { .ship__views { grid-template-columns: 1fr; } }
.ship__where { margin: 0 calc(var(--gutter) * -1) clamp(40px, 7svh, 90px); display: grid; gap: 12px; }
.ship__where img { width: 100%; height: auto; display: block; aspect-ratio: 16 / 7; object-fit: cover; }
.ship__where figcaption { padding-inline: var(--gutter); }
/* a picture of black space keeps hard edges: a lit window onto the dark, not a fog that fades */
.place--space .place__img img { -webkit-mask: none; mask: none; box-shadow: 0 30px 80px -40px rgb(11 11 13 / .55); }
