/* ============================================================
   1. Design tokens
   ============================================================ */
:root {
  /* palette */
  --vw-pink: #ff6ec7;
  --vw-cyan: #01cdfe;
  --vw-purple: #8c52ff;
  --vw-yellow: #fffb96; /* sparing accent only */
  --vw-coral: #ff9a76; /* sunset warm stop, chrome gradient only */
  --vw-ink: #241134; /* body text */
  --vw-panel: #fff8fb; /* legacy near-white, used only as a frosted tint base now */
  --vw-panel-alt: #f5e9ff; /* infobox row alt tint base */
  --vw-chrome-gradient: linear-gradient(
    120deg,
    var(--vw-coral),
    var(--vw-pink) 40%,
    var(--vw-purple) 70%,
    var(--vw-cyan)
  );
  --vw-sky-gradient: linear-gradient(
    180deg,
    var(--vw-purple) 0%,
    var(--vw-pink) 45%,
    var(--vw-coral) 100%
  );

  /* type */
  --font-display: "Monoton", cursive;
  --font-body: "Noto Serif", serif;
  --tracking-wide: 0.25em;

  /* spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;

  /* layout */
  --content-max: 46rem;
  --infobox-width: 260px;
  --radius: 4px;
  --bp-stack: 720px; /* below this, infobox stacks under the article */
}

/* ============================================================
   2. Reset / base
   ============================================================ */
* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  color: var(--vw-ink);
  font-family: var(--font-body);
  line-height: 1.65;
  background-color: var(--vw-purple);
  background-image: var(--vw-sky-gradient);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% 100vh;
  background-attachment: fixed;
}

/* the sun: a striped disc centered on the horizon (50vh) */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: clamp(140px, 30vw, 320px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background-image: radial-gradient(
    circle,
    var(--vw-coral),
    var(--vw-pink) 65%,
    var(--vw-purple) 100%
  );
  mask-image:
    repeating-linear-gradient(0deg, #000 0 7px, transparent 7px 12px),
    radial-gradient(circle, #000 60%, transparent 62%);
  mask-composite: intersect;
  pointer-events: none;
}

/* the horizon: a perspective grid receding from 50vh to the bottom */
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 50% 0 0;
  box-shadow: 0 0 24px 2px rgb(255 255 255 / 65%);
  background-image: repeating-linear-gradient(
    90deg,
    rgb(255 255 255 / 30%) 0 1px,
    transparent 1px 60px
  );
  transform: perspective(320px) rotateX(60deg);
  transform-origin: top;
  opacity: 0.7;
  pointer-events: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   3. Layout primitives
   ============================================================ */
.page-shell {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--infobox-width);
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4);
}

/* real photographic cutout (palm_tree.png), static background scenery,
   full viewport height, sitting mostly on-page with its outer third
   hanging off the edge, mirrored on the right */
.scenery-figure {
  position: fixed;
  z-index: -1;
  top: 0;
  height: 100vh;
  width: auto;
  max-width: none;
  pointer-events: none;
}

.scenery-figure-left {
  left: 0;
  transform: translateX(-33%);
}

.scenery-figure-right {
  right: 0;
  transform: translateX(33%) scaleX(-1);
}

/* ============================================================
   4. Typography
   ============================================================ */
h1,
h2,
h3,
.site-title,
.infobox-title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

h1 {
  font-size: 2rem;
  line-height: 1.4;
  margin: 0 0 var(--space-4);
}

h2 {
  font-size: 1.1rem;
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: 0.85rem;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--vw-purple);
}

a:hover {
  color: var(--vw-pink);
}

.citation a {
  font-size: 0.75em;
  text-decoration: none;
}

h2,
h3,
.chrome-text {
  text-shadow:
    2px 0 var(--vw-cyan),
    -2px 0 var(--vw-pink);
}

@keyframes blink-cycle {
  0%,
  49% {
    opacity: 1;
    color: var(--vw-pink);
  }

  50%,
  100% {
    opacity: 1;
    color: var(--vw-cyan);
  }
}

.site-nav a[aria-current="page"] {
  animation: blink-cycle 1.6s steps(1, end) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .site-nav a[aria-current="page"] {
    animation: none;
  }
}

/* ============================================================
   5. Site header / nav / footer
   ============================================================ */
.site-header,
.site-footer {
  position: relative;
  padding: var(--space-4) var(--space-4);
  text-align: center;
  overflow: hidden;
  color: var(--vw-panel);
}

.site-title {
  position: relative;
  margin: 0 0 var(--space-2);
  font-size: 1.5rem;
}

.site-nav {
  position: relative;
}

.site-nav ul {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--vw-panel);
  font-size: 0.75rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--vw-panel);
}

.site-footer {
  margin-top: var(--space-5);
  font-size: 0.75rem;
}

.site-footer p {
  position: relative;
  margin: 0;
}

/* purely decorative, hardcoded — an old-web visitor-counter badge, no JS */
.visitor-counter {
  display: inline-block;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--vw-yellow);
  background: var(--vw-ink);
  border: 2px solid var(--vw-panel);
  border-radius: var(--radius);
}

/* ============================================================
   6. Infobox
   ============================================================ */
.infobox {
  border-radius: var(--radius);
  overflow: hidden;
  background: rgb(255 248 251 / 55%);
  font-size: 0.9rem;
}

.infobox-title {
  position: relative;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  color: var(--vw-panel);
  text-align: center;
  overflow: hidden;

  /* solid, not the chrome gradient: small text needs a background dark
     enough end-to-end, not just at its darkest stop */
  background: linear-gradient(120deg, var(--vw-ink), var(--vw-purple));
}

.infobox-list {
  margin: 0;
}

.infobox-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--vw-panel-alt);
}

.infobox-row:nth-child(even) {
  background: rgb(245 233 255 / 55%);
}

.infobox-row dt {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--vw-purple);
}

.infobox-row dd {
  margin: 0;
}

/* ============================================================
   7. Table of contents
   ============================================================ */
.toc {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: rgb(245 233 255 / 55%);
  border-radius: var(--radius);
}

.toc h2 {
  margin-top: 0;
  font-size: 0.85rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
}

/* ============================================================
   8. Article sections
   ============================================================ */
.article section,
.article section + section {
  scroll-margin-top: var(--space-4);
}

.article hr {
  margin: var(--space-5) 0;
  border: none;
  border-top: 2px solid;
  border-image: var(--vw-chrome-gradient) 1;
}

.lead {
  font-size: 1.05rem;
}

.bust-figure {
  display: block;
  max-width: 220px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius);
  filter: sepia(0.15) saturate(1.4) hue-rotate(-10deg);
}

/* ============================================================
   9. Citations / references
   ============================================================ */
.references-list {
  padding-left: 1.5rem;
}

.references-list li {
  margin-bottom: var(--space-3);
}

.back-link {
  margin-left: var(--space-2);
  font-size: 0.85em;
}

/* ============================================================
   10. Glossary
   ============================================================ */
.glossary-list {
  margin: 0;
}

.glossary-entry {
  margin-bottom: var(--space-4);
}

.glossary-term {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-wide);
  font-size: 0.9rem;
  color: var(--vw-purple);
}

.glossary-def {
  margin: var(--space-1) 0 0;
}

/* ============================================================
   12. Decorative utilities (header/footer bands; the full-page scene
   lives on body/.page-shell above)
   ============================================================ */
.bg-grid-horizon {
  /* dark scrim first: keeps header/footer text legible over the
     gradient's lightest (coral) stop */
  background-color: var(--vw-purple);
  background-image:
    linear-gradient(rgb(20 10 40 / 55%), rgb(20 10 40 / 55%)),
    var(--vw-chrome-gradient),
    repeating-linear-gradient(
      transparent 0 23px,
      rgb(255 255 255 / 35%) 23px 25px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 38px,
      rgb(255 255 255 / 35%) 38px 40px
    );
  background-blend-mode: normal, normal, overlay, overlay;
}

.bg-grid-horizon::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgb(255 255 255 / 25%) 0 1px,
    transparent 1px 48px
  );
  transform: perspective(220px) rotateX(55deg);
  transform-origin: bottom;
  opacity: 0.6;
  pointer-events: none;
}

.bg-checker {
  background-image: repeating-conic-gradient(
    rgb(255 255 255 / 18%) 0% 25%,
    transparent 0% 50%
  );
  background-size: 20px 20px;
}

.bg-scanline {
  position: relative;
}

.bg-scanline::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    rgb(0 0 0 / 8%) 0 1px,
    transparent 1px 4px
  );
  pointer-events: none;
}

/* ============================================================
   13. Responsive (single breakpoint, see --bp-stack above)
   ============================================================ */
@media (width <= 720px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}
