:root {
  /* — Ink & ground (deep space is never pure black) — */
  --void:        #080B18;   /* page ground / plate */
  --panel:       #0E1329;   /* raised card / inset plate */
  --panel-2:     #0B1022;   /* deeper inset */

  /* — Engraving inks — */
  --star-ink:    #F3ECD9;   /* PRIMARY text — warm parchment white */
  --faded-ink:   #A29C86;   /* muted / caption / secondary text */
  --gilt:        #C9A24E;   /* engraving lines, links, ornament */
  --gilt-bright: #E6C878;   /* link/ornament hover, focus ring */
  --verdigris:   #6EA79D;   /* coordinate grid, secondary rules, hover */
  --rubric:      #C1543B;   /* rare accent: active nav, a star of note (lifted from #B0472F for AA on void) */

  /* — Rules & grid tuning (kept faint on purpose) — */
  --rule:        rgba(201,162,78,0.38);   /* gilt hairline frame */
  --rule-soft:   rgba(201,162,78,0.16);   /* inner double-rule */
  --grid-ra:     rgba(110,167,157,0.15);  /* verdigris meridians (vertical) */
  --grid-dec:    rgba(110,167,157,0.11);  /* verdigris parallels (horizontal) */
  --grid-fine:   rgba(110,167,157,0.06);  /* finer sub-grid (graph-paper density) */

  /* — Type — */
  --font-display: "Marcellus", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-caps:    "Marcellus SC", "Marcellus", Georgia, "Times New Roman", serif;
  --font-body:    "EB Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-mono:    ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  /* — Metrics — */
  --maxw:        1080px;
  --frame-inset: clamp(0.75rem, 2.4vw, 2rem);  /* plate distance from viewport edge */
  --pad-x:       clamp(1.1rem, 4vw, 2.6rem);   /* content inner padding */
  --focus:       var(--gilt-bright);
}

/* ======================================================================
   RESET / BASE
   ====================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--star-ink);
  font-family: var(--font-body);
  line-height: 1.6;
  background-color: var(--void);
  /* A star chart: dense star field, curved celestial grid, dotted
     constellation boundaries, and the ecliptic/equator phase lines —
     all drawn in assets/chart.svg. */
  background-image: url('assets/chart.svg');
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--gilt);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: var(--gilt-bright); text-decoration: underline; text-underline-offset: 3px; }

/* Global visible focus — never removed */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ======================================================================
   PLATE FRAME (.plate) — the constant "atlas plate" identity
   ====================================================================== */
.plate {
  position: relative;
  min-height: 100vh;
  margin: var(--frame-inset);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
}

/* inner double rule */
.plate::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--rule-soft);
  pointer-events: none;
  z-index: 0;
}

/* degree ticks along top & bottom inner margins */
.plate::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 12px;
  bottom: 12px;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(90deg, var(--rule) 0, var(--rule) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(90deg, var(--rule) 0, var(--rule) 1px, transparent 1px, transparent 28px);
  background-repeat: no-repeat, no-repeat;
  background-position: top left, bottom left;
  background-size: 100% 6px, 100% 6px;
}

/* numbers read off the top degree ruler (built by assets/scale.js) */
.plate-scale {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 19px;
  height: 10px;
  pointer-events: none;
  z-index: 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--rule);
}
.plate-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  opacity: 0.6;
}

/* keep real content above the frame pseudo-layers */
.masthead, main, .colophon { position: relative; z-index: 2; }

/* ======================================================================
   NAV (.masthead / .chart-nav / .seal / .seal-mark / .nav-links / .active)
   ====================================================================== */
.masthead {
  /* Scrolls away with the page (was position: sticky, which kept it pinned). */
  border-bottom: 1px solid var(--rule-soft);
}

.chart-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.seal {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-caps);
  letter-spacing: 0.14em;
  font-size: 1.05rem;
  color: var(--star-ink);
}
.seal:hover { color: var(--star-ink); text-decoration: none; opacity: 0.9; }

.seal-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--rule-soft);
  display: block;
}

.nav-links {
  display: flex;
  gap: clamp(0.15rem, 1.2vw, 0.6rem);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.nav-links a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--faded-ink);
  /* generous hit area — the links used to be tiny and hard to click */
  padding: 0.55rem 0.7rem;
}
.nav-links a:hover { color: var(--star-ink); text-decoration: none; }

.nav-links a.active {
  color: var(--rubric);
  position: relative;
}
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.32rem;
  height: 2px;
  background: var(--gilt);
}

/* cross-link to the blueprint edition */
.nav-links a.alt-edition { color: var(--gilt); }
.nav-links a.alt-edition:hover { color: var(--gilt-bright); }

/* ======================================================================
   LAYOUT / MAIN
   ====================================================================== */
main {
  flex: 1 0 auto;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad-x) clamp(3rem, 8vw, 5rem);
}

/* ======================================================================
   TYPOGRAPHY
   ====================================================================== */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--faded-ink);
  margin: 0 0 1.1rem;
}
.eyebrow::before {
  content: "\25CF\00A0";  /* ● + nbsp */
  color: var(--gilt);
}

.plate-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  color: var(--star-ink);
  margin: 0 0 1.1rem;
  font-weight: 400;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--star-ink);
  margin: 2.75rem 0 0.6rem;
}

p {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.6;
  color: var(--star-ink);
  max-width: 70ch;
  margin: 0 0 1rem;
}

.lede {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--star-ink);
  opacity: 0.92;
  max-width: 66ch;
  margin: 0 0 1.25rem;
}

/* Text-only pages (about/resume have no chart): let the prose fill the
   full plate width instead of being capped to one side. */
.hero:not(:has(.chart)) p,
.hero:not(:has(.chart)) .lede {
  max-width: none;
}

.readout {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--faded-ink);
  max-width: none;
  margin: 0 0 1rem;
}

/* ======================================================================
   HERO
   ====================================================================== */
.hero {
  animation: rise 0.5s ease both;
}

/* Home: two-column grid (text + chart). Keyed on the presence of the
   signature .chart so it applies wherever the constellation is embedded. */
.hero:has(.chart),
.hero.hero--home {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
}

/* staggered entry for direct children */
.hero > * { animation: rise 0.5s ease both; }
.hero > *:nth-child(1) { animation-delay: 0.00s; }
.hero > *:nth-child(2) { animation-delay: 0.06s; }
.hero > *:nth-child(3) { animation-delay: 0.12s; }
.hero > *:nth-child(4) { animation-delay: 0.18s; }
.hero > *:nth-child(5) { animation-delay: 0.24s; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.4rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ======================================================================
   BUTTONS (.chart-btn / .chart-btn--ghost)
   ====================================================================== */
.chart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--gilt);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gilt);
  background: transparent;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.chart-btn span { transition: transform 0.18s ease; display: inline-block; }
.chart-btn:hover,
.chart-btn:focus-visible {
  background: var(--gilt-bright);
  color: var(--void);
  border-color: var(--gilt-bright);
  text-decoration: none;
}
.chart-btn:hover span,
.chart-btn:focus-visible span { transform: translateX(3px); }

.chart-btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--faded-ink);
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}
.chart-btn--ghost:hover,
.chart-btn--ghost:focus-visible {
  background: transparent;
  color: var(--gilt-bright);
  border-color: transparent;
}

/* ======================================================================
   SIGNATURE — THE CORVUS CHART (.chart / .chart-svg / .chart-line /
   .chart-star / .chart-label)
   ====================================================================== */
.chart {
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.75rem;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
  /* inset coordinate grid */
  background-image:
    repeating-linear-gradient(90deg, transparent 0, transparent 43px, var(--grid-ra) 43px, var(--grid-ra) 44px),
    repeating-linear-gradient(0deg, transparent 0, transparent 43px, var(--grid-dec) 43px, var(--grid-dec) 44px);
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 440 / 320;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--gilt);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-in 0.9s ease forwards;
}

.chart-star {
  fill: var(--star-ink);
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 4s ease-in-out infinite;
}
.chart-star.chart-star--note { fill: var(--rubric); }

/* Home constellation only: bright, glowing gold orbs.
   Scoped to .chart-svg so the flat card glyphs are unaffected. */
.chart-svg .chart-star {
  fill: url(#starGlow);
  filter: url(#starHalo);
}
.chart-star:nth-of-type(2) { animation-delay: 0.6s; }
.chart-star:nth-of-type(3) { animation-delay: 1.2s; }
.chart-star:nth-of-type(4) { animation-delay: 1.8s; }
.chart-star:nth-of-type(5) { animation-delay: 2.4s; }

.chart-label {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--faded-ink);
}

/* Instrument time-panel BELOW the chart box: three timescales */
.chart-times {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  max-width: 440px;
  margin: 0.8rem auto 0;
  padding: 0 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faded-ink);
}
.chart-times span { display: flex; flex-direction: column; gap: 0.22rem; }
.chart-times b {
  color: var(--star-ink);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

@keyframes draw-in {
  to { stroke-dashoffset: 0; }
}
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ======================================================================
   CATALOGUE (games) — .catalogue / .catalogue-grid / .object-card /
   .object-glyph / .object-desig / .object-mag / .enter
   ====================================================================== */
.catalogue {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.object-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 1.25rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
/* corner tick marks echoing the plate frame */
.object-card::before,
.object-card::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--gilt);
  pointer-events: none;
}
.object-card::before {
  top: 7px; left: 7px;
  border-top: 1px solid var(--gilt);
  border-left: 1px solid var(--gilt);
}
.object-card::after {
  bottom: 7px; right: 7px;
  border-bottom: 1px solid var(--gilt);
  border-right: 1px solid var(--gilt);
}
.object-card:hover {
  border-color: var(--gilt);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.object-card header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.object-glyph {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.object-glyph line,
.object-glyph polyline,
.object-glyph path {
  fill: none;
  stroke: var(--faded-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.18s ease;
}
.object-glyph circle {
  fill: var(--faded-ink);
  transition: fill 0.18s ease;
}
.object-card:hover .object-glyph line,
.object-card:hover .object-glyph polyline,
.object-card:hover .object-glyph path { stroke: var(--gilt-bright); }
.object-card:hover .object-glyph circle { fill: var(--gilt-bright); }

/* Glyphs reuse .chart-line/.chart-star for markup convenience, but the ONE
   moving idea is the home constellation — keep card glyphs static (ignite on
   hover only), so we strip the inherited twinkle/draw-in here. */
.object-glyph .chart-line {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  animation: none;
}
.object-glyph .chart-star { animation: none; }

.object-desig {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gilt);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.object-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--star-ink);
  margin: 0;
}

.object-card p {
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--faded-ink);
  max-width: none;
  margin: 0;
  flex: 1;
}

.object-mag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--faded-ink);
}

.enter {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--gilt);
  margin-top: 0.15rem;
}
.enter:hover { color: var(--gilt-bright); text-decoration: none; }
.enter span { display: inline-block; transition: transform 0.18s ease; }
.enter:hover span,
.enter:focus-visible span { transform: translateX(3px); }

/* ======================================================================
   RESUME — .status-plate / .armillary / .status-light
   ====================================================================== */
.status-plate {
  margin-top: 2.25rem;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 2rem 1.8rem;
  max-width: 42ch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

/* Rings/strokes take their color from currentColor via the SVG's own
   inline fill/stroke attributes; we only set color, size and rotation so
   we never clobber the filled center star. */
.armillary {
  width: 120px;
  height: 120px;
  color: var(--gilt);
  transform-origin: center;
  animation: spin 40s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.status-plate .readout { margin: 0; }
.status-plate .readout.sub { color: var(--faded-ink); }

.status-light {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gilt);
  box-shadow: 0 0 8px var(--gilt);
  margin-right: 0.4rem;
  vertical-align: baseline;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ======================================================================
   FOOTER (.colophon)
   ====================================================================== */
.colophon {
  flex-shrink: 0;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 2rem var(--pad-x) 3rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--faded-ink);
}

/* ======================================================================
   RESPONSIVE
   ====================================================================== */
@media (max-width: 760px) {
  .hero:has(.chart),
  .hero.hero--home {
    grid-template-columns: 1fr;
  }
  .hero:has(.chart) .chart,
  .hero.hero--home .chart {
    max-width: 380px;
    margin-top: 0.5rem;
  }
}

@media (max-width: 560px) {
  .chart-nav {
    justify-content: center;
    text-align: center;
  }
  .nav-links { justify-content: center; }
  .catalogue-grid { grid-template-columns: 1fr; }
}

/* ======================================================================
   REDUCED MOTION
   ====================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hero,
  .hero > *,
  .chart-star,
  .status-light {
    animation: none;
  }
  .chart-line {
    stroke-dashoffset: 0;
    animation: none;
  }
  .armillary {
    animation: none;
  }
}

