/*
  darapu.net: an AI civilization. Agents on a canvas regroup for each
  generation (career era). One family, Archivo; colour encodes generation.
*/

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: block;
}

:root {
  --sea: #0e1e2a;
  --text: #f3eee4;
  --muted: #a9b8c2;
  --line: rgba(243, 238, 228, 0.14);
  --panel: rgba(14, 30, 42, 0.62);
  --g0: #f2d7a0; --g1: #8fd3c1; --g2: #8db8f2; --g3: #c3a8f0; --g4: #f0a3bc; --g5: #fff4d6;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  color-scheme: dark;
}

/* Generation colours (classes, because the CSP blocks inline styles) */
.c0 { --c: var(--g0); }
.c1 { --c: var(--g1); }
.c2 { --c: var(--g2); }
.c3 { --c: var(--g3); }
.c4 { --c: var(--g4); }
.c5 { --c: var(--g5); }

* { box-sizing: border-box; }
html { scroll-snap-type: y proximity; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sea);
  color: var(--text);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 65% 45%, transparent 40%, rgba(6, 14, 20, 0.55) 100%);
}

a { color: var(--g0); text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--g5); outline-offset: 3px; border-radius: 4px; }

.skip { position: fixed; left: -999px; top: 1rem; z-index: 10; }
.skip:focus { left: 1rem; background: var(--sea); padding: 0.5rem 1rem; }

/* ---------- Header ---------- */

header.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem var(--gutter);
  font-size: 0.9375rem;
}
header.top .mark { font-stretch: 118%; font-weight: 650; color: var(--text); text-decoration: none; }
header.top nav { display: flex; gap: 1.25rem; }
header.top nav a { color: var(--muted); text-decoration: none; }
header.top nav a:hover { color: var(--text); }

main { position: relative; z-index: 2; }

/* ---------- Generations ---------- */

.gen {
  min-height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  padding: 6rem var(--gutter) 4rem;
}
.gen:first-child { align-items: flex-end; }

.panel {
  max-width: 30rem;
  padding: 1.5rem 1.6rem 1.6rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gen:first-child .panel { max-width: 36rem; }

/* Only dim other generations when the simulation is running */
.js .gen .panel { opacity: 0.35; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .gen.current .panel { opacity: 1; transform: none; }

/* The agents spell the name, so the heading is for screen readers then */
.hero-name { font-size: 2.6rem; line-height: 1.05; font-stretch: 118%; font-weight: 750; margin: 0 0 0.75rem; }
.js .hero-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.era { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.9375rem; margin: 0 0 0.6rem; }
.era i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }

h2 { font-size: 1.6rem; line-height: 1.2; font-stretch: 112%; font-weight: 620; margin: 0 0 0.2rem; }
.org { color: var(--muted); margin: 0 0 1rem; }
.panel p { margin: 0; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.results li { display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.9rem; align-items: baseline; }
.results b { font-stretch: 118%; font-size: 1.35rem; font-weight: 680; color: var(--c); line-height: 1.1; }

.role { color: var(--muted); margin-bottom: 0.9rem !important; }
.lede { font-size: 1.3rem; line-height: 1.4; font-stretch: 104%; }
.hint { margin-top: 1.25rem !important; color: var(--muted); font-size: 0.9375rem; display: flex; gap: 0.5rem; align-items: center; }
.hint span { display: inline-block; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

.work { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.work li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.work strong { font-stretch: 112%; font-weight: 650; }
.work span { color: var(--muted); display: block; font-size: 0.9375rem; }

.panel .actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; margin-top: 1.25rem; }
.button {
  background: var(--g5); color: var(--sea); text-decoration: none; font-weight: 650;
  padding: 0.7rem 1.15rem; border-radius: 999px; font-size: 0.9375rem;
}
.button:hover { background: var(--g0); }

/* ---------- After the simulation ---------- */

.after {
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 2rem var(--gutter) 1rem;
}
.panel.wide { max-width: 46rem; padding: 1.75rem 1.9rem 1.9rem; }
.panel.wide > h2 { margin-bottom: 1.25rem; }
.panel.wide p + p { margin-top: 0.8rem; }

.projects { display: grid; gap: 1.5rem; }
.project h3 { margin: 0 0 0.3rem; font-size: 1.15rem; font-stretch: 112%; font-weight: 650; }
.project p + p { margin-top: 0.4rem; }
.project-meta { color: var(--muted); font-size: 0.9375rem; }
.project-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; font-size: 0.9375rem; }

.more { margin-top: 1.5rem; }
.more h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.more ul { list-style: none; margin: 0; padding: 0; }
.more li { padding: 0.5rem 0; border-top: 1px solid var(--line); }
.more li span { color: var(--muted); font-size: 0.9375rem; }

.skills { margin: 0; }
.skills div { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.skills dt { font-weight: 620; }
.skills dd { margin: 0; color: var(--muted); }

.live { color: var(--g1); }

.footer { color: var(--muted); font-size: 0.875rem; padding: 1rem 0 2rem; }

/* ---------- Generation picker and legend ---------- */

nav.gens {
  position: fixed; z-index: 3; right: clamp(0.75rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.35rem;
  transition: opacity 0.3s;
}
nav.gens button {
  font: inherit; font-size: 0.8125rem; color: var(--muted);
  background: none; border: 0; cursor: pointer; padding: 0.3rem 0.4rem;
  display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end;
}
nav.gens button i { width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 1.5px solid var(--c); display: inline-block; }
nav.gens button[aria-current="step"] { color: var(--text); }
nav.gens button[aria-current="step"] i { background: var(--c); }

.legend {
  position: fixed; z-index: 3; left: var(--gutter); bottom: 1rem; margin: 0;
  font-size: 0.8125rem; color: var(--muted);
  transition: opacity 0.3s;
}
:root:not(.js) .legend, :root:not(.js) nav.gens { display: none; }
/* Out of the way once the reader is past the last generation */
.past nav.gens, .past .legend { opacity: 0; pointer-events: none; }

/* ---------- Narrow screens ---------- */

@media (min-width: 900px) {
  .gen:not(:first-child) { justify-content: flex-start; }
}
@media (max-width: 899px) {
  .gen { align-items: flex-end; padding-bottom: 3rem; }
  .gen:not(:first-child) { padding-top: 46vh; }
  .gen-last { padding-top: 30vh; padding-bottom: 4.5rem; }
  .gen:first-child { padding-bottom: 4.5rem; }
  header.top nav { display: none; }
  nav.gens {
    top: auto; bottom: 0.75rem; transform: none; right: 50%; translate: 50% 0; flex-direction: row; gap: 0.1rem;
    background: rgba(14, 30, 42, 0.8); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.4rem;
  }
  nav.gens button span { display: none; }
  nav.gens button { padding: 0.45rem; }
  .legend { display: none; }
  .panel { padding: 1.2rem 1.25rem; }
  .panel.wide { padding: 1.4rem 1.3rem; }
  .lede { font-size: 1.15rem; }
  h2 { font-size: 1.35rem; }
  .skills div { grid-template-columns: 1fr; gap: 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .gen .panel { transition: none; }
  .hint span { animation: none; }
}
