/* COOLDIS public site.
   Two skies: harbor night and marine day. International orange is
   spent only on what is kept. Tokens shared with the portrait series. */

:root {
  --ground: #0a0f14;
  --fog: #93a4b1;
  --ink: #dfe7ec;
  --accent: #cf6a3c;
  --faint: rgba(223, 231, 236, 0.42);
  --edge: rgba(223, 231, 236, 0.14);
  --panel: rgba(10, 15, 20, 0.8);
  --veil: rgba(10, 15, 20, 0.9);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --serif: Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #edf0f2;
    --fog: #7e8b94;
    --ink: #242c33;
    --accent: #b3562e;
    --faint: rgba(36, 44, 51, 0.56);
    --edge: rgba(36, 44, 51, 0.16);
    --panel: rgba(237, 240, 242, 0.85);
    --veil: rgba(237, 240, 242, 0.92);
  }
}

:root[data-theme='dark'] {
  --ground: #0a0f14;
  --fog: #93a4b1;
  --ink: #dfe7ec;
  --accent: #cf6a3c;
  --faint: rgba(223, 231, 236, 0.42);
  --edge: rgba(223, 231, 236, 0.14);
  --panel: rgba(10, 15, 20, 0.8);
  --veil: rgba(10, 15, 20, 0.9);
}

:root[data-theme='light'] {
  --ground: #edf0f2;
  --fog: #7e8b94;
  --ink: #242c33;
  --accent: #b3562e;
  --faint: rgba(36, 44, 51, 0.56);
  --edge: rgba(36, 44, 51, 0.16);
  --panel: rgba(237, 240, 242, 0.85);
  --veil: rgba(237, 240, 242, 0.92);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ground);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--ground); }

a { color: inherit; }
button { font: inherit; }
:is(a, button):focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- stage: the sky, pinned to the right ---------- */

.stage {
  position: fixed;
  top: 0;
  right: 0;
  width: 47vw;
  height: 100vh;
  height: 100svh;
  z-index: 0;
}
#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}
#sky.dragging { cursor: grabbing; }

/* :where() keeps this at class specificity, so a child's own
   pointer-events: auto (the drawer) can win back its taps */
.stage > :where(:not(#sky)) { position: absolute; z-index: 2; pointer-events: none; }

.dial {
  top: 20px;
  right: 26px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.coords {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

/* the day/night toggle: a horizon. click, and the sun sets while
   the moon rises on the same wheel; the whole palette turns with it. */
.horizon {
  pointer-events: auto;
  width: 46px;
  height: 34px;
  padding: 0;
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
}
.horizon:hover { color: var(--ink); }
.horizon svg { display: block; width: 100%; height: 100%; }
.horizon .hz { stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; opacity: 0.8; }
.horizon .sun circle { fill: currentColor; }
.horizon .sun line { stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; }
.horizon .moon { fill: currentColor; }
.horizon .wheel {
  transform-box: view-box;
  transform-origin: 24px 27px;
  transition: transform 0.9s cubic-bezier(0.55, 0, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .horizon .wheel { transition: none; }
}

.hint {
  top: 28px;
  left: 26px;
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
  transition: opacity 2s ease;
}
.hint.gone { opacity: 0; }

/* the count line: a scoreboard, not a map — the chart itself lives in
   the text column, one epigraph per section */
.legend {
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
}
.lg-count {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--faint);
  white-space: nowrap;
  text-align: center;
}

/* the strip label and the drawer pull exist only on narrow screens */
.strip, .drawer { display: none; }

/* ---------- column: the text, on the left ---------- */

.col {
  position: relative;
  z-index: 1;
  width: 53vw;
}

.top {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 648px;
  margin: 0 auto;
  padding: 26px 24px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mast h1 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: clamp(28px, 4.4vw, 54px);
  font-weight: 500;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: var(--ink);
}
.mast p {
  margin: 0;
  font-style: italic;
  font-size: 14px;
  color: var(--faint);
}
/* the quiet way home */
a.es { color: inherit; text-decoration: none; }
a.es:hover { color: var(--ink); }

/* the lede floats to the visual center of the first screen;
   the cue alone holds the bottom edge */
.lede { margin: auto 0; padding: 5vh 0; }
.lede .tagline {
  margin: 0 0 20px;
  font-style: italic;
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.55;
  color: var(--ink);
}
.top .cue {
  display: inline-block;
  align-self: flex-start;
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.top .cue:hover { color: var(--ink); border-color: var(--edge); }

/* ---------- install chip ---------- */

.install {
  position: relative;
  display: block;
  background: var(--panel);
  border: 1px solid var(--edge);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 10px 13px;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  overflow-x: auto;
}
.install code { font-family: inherit; white-space: nowrap; }
.install:hover { color: var(--ink); border-color: var(--faint); }
.install .copied {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--accent);
  font-style: italic;
  font-family: var(--serif);
  font-size: 13px;
}
.install.done .copied { display: flex; }

/* the source stands beside the install: same chip, it just leaves */
.get { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; }
.get .src {
  display: flex;
  align-items: center;
  border: 1px solid var(--edge);
  padding: 10px 13px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  text-decoration: none;
  white-space: nowrap;
}
.get .src:hover { color: var(--ink); border-color: var(--faint); }

.install-wide {
  width: 100%;
  margin: 24px 0 10px;
  padding: 14px 16px;
  font-size: 13px;
}

/* ---------- panels ---------- */

main { padding-top: 8px; }

.panel {
  max-width: 648px;
  margin: 0 auto;
  padding: 72px 24px 8px;
}
.panel p { margin: 0 0 16px; }

.panel em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.86em;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.32em;
  color: var(--faint);
  margin: 0 0 22px;
}

.equation {
  font-family: var(--mono);
  font-size: clamp(24px, 2.6vw, 42px);
  line-height: 1.15;
  color: var(--ink);
  margin: 6px 0 36px;
  overflow-x: auto;
}

.laws {
  list-style: none;
  margin: 28px 0;
  padding: 0;
}
.laws li {
  display: flex;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--edge);
}
.laws li:last-child { border-bottom: 1px solid var(--edge); }
.laws .n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  padding-top: 4px;
}
.laws p { margin: 0; }

.pull {
  font-style: italic;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  margin: 30px 0;
}

/* the epigraph: one line reserved under each eyebrow, empty until its
   constellation is observed in the sky. the poem assembles inside the
   argument, in place, as it is earned. */
.panel .epigraph {
  min-height: 24px;
  margin: -8px 0 20px;
}
.ep {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.6;
  color: var(--faint);
  cursor: pointer;
  text-align: left;
  animation: ep-in 1.4s ease;
}
.ep:hover { color: var(--ink); }
.epigraph.active .ep, .ep.active { color: var(--accent); }
.ep svg { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.ep svg path { stroke: currentColor; fill: none; stroke-width: 0.14; stroke-linecap: round; }
.ep .ep-n {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding-top: 1px;
}
@keyframes ep-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ep { animation: none; }
}

/* below the last section: the lines that are not contracts. nothing is
   here — no space, no slot — until it is earned. */
.afterglow {
  max-width: 648px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 56px 24px 0;
}
.afterglow:empty { padding: 0; }

/* ---------- lexicon band ---------- */

.lexicon {
  max-width: 648px;
  margin: 72px auto 0;
  padding: 0 24px;
}
.lexicon .eyebrow { margin-bottom: 16px; }
.lexicon p {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 2.2;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* ---------- receipts ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 26px 18px;
  margin: 30px 0 28px;
}
.stats .v {
  display: block;
  font-family: var(--mono);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.stats .k {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 7px;
}

.provenance {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 14px;
}

.aside-note {
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
}
.aside-note code {
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  color: var(--ink);
}

/* ---------- footer ---------- */

footer {
  max-width: 648px;
  margin: 0 auto;
  padding: 96px 24px 72px;
}
footer .meta {
  display: flex;
  gap: 20px;
  margin-bottom: 22px;
}
footer .meta a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid var(--edge);
}
footer .meta a:hover { color: var(--ink); border-color: var(--ink); }
footer .eyebrow { margin-bottom: 14px; }
.skynote {
  margin: 0;
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
}

/* ---------- top nav: a quiet row above the wordmark ---------- */

.topnav {
  display: flex;
  gap: 20px;
  margin: 0 0 34px;
}
.topnav a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid var(--edge);
}
.topnav a:hover { color: var(--ink); border-color: var(--ink); }
.topnav a[aria-current='page'] { color: var(--ink); }

.lexicon .lexicon-link {
  margin-top: 20px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: normal;
  line-height: 1.6;
}
.lexicon .lexicon-link a {
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid var(--edge);
}
.lexicon .lexicon-link a:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- manifest excerpt ---------- */

.manifest {
  margin: 26px 0;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--edge);
  overflow-x: auto;
}
.manifest pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink);
}

/* ---------- abstractions page: no sky, one quiet column ---------- */

.col.full { width: 100%; }
.top.slim { min-height: 0; padding-bottom: 0; }
.top.slim .lede { margin: 26px 0 0; padding: 0 0 6px; }
.mast h1 a { color: inherit; text-decoration: none; }

.defs {
  margin: 26px 0 8px;
}
.defs > div {
  padding: 14px 0;
  border-top: 1px solid var(--edge);
}
.defs > div:last-child { border-bottom: 1px solid var(--edge); }
.defs dt {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin: 0 0 4px;
}
.defs dd { margin: 0; }

/* ---------- narrow: the page splits into two rooms ---------- */
/* the sky holds a fixed band above; the text is an ordinary document
   below it and slides under the band as you scroll. no veil, no
   overlay: the animation is never covered. */

@media (max-width: 960px) {
  :root {
    --band: 54vh;
    --band: 54svh;
  }
  :root[data-band='mini'] { --band: 96px; }

  .stage {
    width: 100vw;
    left: 0;
    height: var(--band);
    z-index: 2;
    background: var(--ground);
    border-bottom: 1px solid var(--edge);
    transition: height 0.5s cubic-bezier(0.6, 0, 0.25, 1);
  }
  .col {
    width: 100%;
    padding-top: var(--band);
    transition: padding-top 0.5s cubic-bezier(0.6, 0, 0.25, 1);
  }

  .top { min-height: 0; padding-top: 36px; }
  .lede { margin: 26px 0 0; padding: 0 0 6px; }

  .hint { top: auto; bottom: 44px; left: 50%; transform: translateX(-50%); }

  .legend { bottom: 10px; }

  /* the pull on the horizon line: tap, and the sky tucks into a strip */
  .drawer {
    display: block;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
    width: 46px;
    height: 22px;
    padding: 0;
    background: var(--ground);
    border: 1px solid var(--edge);
    color: var(--faint);
    cursor: pointer;
    pointer-events: auto;
  }
  .drawer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
  .drawer:hover { color: var(--ink); }
  .drawer svg { display: block; width: 18px; height: 8px; margin: 0 auto; }
  .drawer svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform-box: view-box;
    transform-origin: center;
    transition: transform 0.5s cubic-bezier(0.6, 0, 0.25, 1);
  }
  :root[data-band='mini'] .drawer svg path { transform: rotate(180deg); }

  /* tucked: the name holds the left, the cloud lives small on the right */
  .strip {
    display: block;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3em;
    color: var(--ink);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
  }
  :root[data-band='mini'] .strip { opacity: 1; visibility: visible; }

  .dial, .legend { transition: opacity 0.35s ease, visibility 0.35s; }
  :root[data-band='mini'] :is(.dial, .hint, .legend) { opacity: 0; visibility: hidden; }

  .panel { padding-top: 60px; }
  .panel, footer { scroll-margin-top: var(--band); }
}

@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
  .stage, .col, .drawer svg path, .strip, .dial, .hint, .legend { transition: none; }
}

@media (max-width: 560px) {
  .coords { display: none; }
  .hint { font-size: 12px; }
  .panel { padding-top: 52px; }
}
