/* =========================================================
   Beauty as OS — The Machine of Creation
   Palette: cold substrate + deep-cyan bioluminescent growth
   ========================================================= */

:root {
  --substrate: #0a0a0c;
  --substrate-2: #07070a;
  --bone: #eef2f2;
  --bone-dim: #9aa3a5;
  --bone-faint: #545c5e;

  /* bioluminescence — set by the palette selector (JS), deep cyan default.
     the -rgb channel vars let the alpha uses below follow the palette too. */
  --cyan: #12d3e6;
  --cyan-bright: #5cf0ff;
  --cyan-deep: #0a8ea0;
  --cyan-rgb: 18, 211, 230;
  --cyan-deep-rgb: 10, 142, 160;
  --cyan-glow: rgba(var(--cyan-rgb), 0.55);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 34rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--substrate);
  color: var(--bone);
  font-family: var(--serif);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- generative background layers ---------- */

#growth {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

/* soft reaction-diffusion "tissue" — grows opacity with scroll (--grow: 0..1) */
.tissue {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: calc(0.15 + var(--grow, 0) * 0.55);
  transition: opacity 0.6s ease;
  background:
    radial-gradient(45% 55% at 22% 30%, rgba(var(--cyan-deep-rgb), 0.22), transparent 70%),
    radial-gradient(40% 50% at 78% 68%, rgba(var(--cyan-rgb), 0.14), transparent 72%),
    radial-gradient(60% 60% at 50% 100%, rgba(var(--cyan-deep-rgb), 0.18), transparent 70%);
  mix-blend-mode: screen;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 120% at 50% 40%, transparent 55%, rgba(5, 5, 8, 0.75) 100%);
}

/* ---------- boot / POST overlay ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--substrate-2);
  transition: opacity 0.9s ease;
}
.boot.is-done {
  opacity: 0;
  pointer-events: none;
}
.boot__log {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--cyan);
  margin: 0;
  min-width: 20ch;
  text-shadow: 0 0 14px var(--cyan-glow);
}

/* ---------- runtime HUD ---------- */

.hud {
  position: fixed;
  top: 1.4rem;
  left: 1.6rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--bone-faint);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hud.is-live { opacity: 1; }
.hud__line { text-transform: lowercase; }

/* ---------- scroll / layers ---------- */

.scroll {
  position: relative;
  z-index: 10;
}

.layer {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1.6rem;
  padding: 12vh 8vw;
  max-width: 60rem;
}

.layer__index {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  margin: 0;
  padding-left: 0.15em;
  border-left: 2px solid var(--cyan-deep);
  padding: 0.1rem 0 0.1rem 0.9rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.stanza {
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--bone);
  max-width: var(--measure);
  margin: 0;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.stanza em {
  font-style: italic;
  color: var(--cyan-bright);
  text-shadow: 0 0 24px var(--cyan-glow);
}

/* reveal when in view */
.layer.is-visible .layer__index,
.layer.is-visible .stanza {
  opacity: 1;
  transform: translateY(0);
}
.layer.is-visible .stanza { transition-delay: 0.12s; }

/* ---------- hero ---------- */

.layer--hero { gap: 2.2rem; }

.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.title__main {
  font-size: clamp(3rem, 11vw, 8rem);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.03em;
}
.title__sub {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan-glow);
  padding-left: 0.3em;
}

.hero-select {
  width: min(100%, 46rem);
}
.hero-select__label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--bone-dim);
  margin: 0 0 0.85rem;
}
.programs--hero {
  gap: 0.55rem;
}
.programs--hero .program {
  font-size: 0.72rem;
  padding: 0.5rem 0.8rem;
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bone-faint);
  margin-top: 1rem;
}
.scroll-cue__mark {
  display: inline-block;
  animation: drift 2.4s ease-in-out infinite;
  color: var(--cyan);
}
@keyframes drift {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(7px); opacity: 1; }
}

/* ---------- shell / prompt ---------- */

.layer--shell { gap: 2rem; }

.shell {
  width: min(100%, 40rem);
  font-family: var(--mono);
}
.shell__cmd {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--bone-dim);
  letter-spacing: 0.02em;
}
.shell__prompt {
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan-glow);
}
.shell__blink {
  color: var(--cyan);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.programs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.program {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--bone-dim);
  background: rgba(8, 20, 22, 0.35);
  border: 1px solid rgba(var(--cyan-rgb), 0.28);
  border-radius: 3px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease, background 0.25s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.program::before {
  content: "› ";
  color: var(--cyan-deep);
}
.program:hover,
.program:focus-visible {
  color: var(--bone);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(var(--cyan-rgb), 0.16);
  outline: none;
}
.program.is-running {
  color: var(--substrate);
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 34px rgba(var(--cyan-rgb), 0.4);
}
.program.is-running::before {
  content: "■ ";
  color: var(--substrate);
}

.shell__out {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--cyan-bright);
  min-height: 3.6em;
  margin: 1.4rem 0 0;
  white-space: pre-wrap;
  text-shadow: 0 0 16px var(--cyan-glow);
}

/* ---------- palette selector ---------- */

.palettes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.palette {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--bone-dim);
  background: rgba(8, 20, 22, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.palette .swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex: none;
}
.palette:hover,
.palette:focus-visible {
  color: var(--bone);
  border-color: var(--cyan);
  outline: none;
}
.palette.is-active {
  color: var(--bone);
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(var(--cyan-rgb), 0.22);
}
.hero-select__label--sub,
.shell__cmd--sub {
  margin-top: 1.6rem;
}

/* ---------- colophon ---------- */

.colophon {
  position: relative;
  z-index: 10;
  padding: 14vh 8vw 10vh;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.colophon p { margin: 0.3rem 0; }
.colophon__meta { color: var(--cyan-deep); }
.colophon a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--cyan-rgb), 0.4);
  transition: color 0.25s ease, border-color 0.25s ease;
}
.colophon a:hover,
.colophon a:focus-visible {
  color: var(--cyan-bright);
  border-color: var(--cyan);
  outline: none;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue__mark { animation: none; }
  .layer__index, .stanza {
    opacity: 1 !important;
    transform: none !important;
    transition: none;
  }
}

@media (max-width: 640px) {
  .layer { padding: 12vh 7vw; }
  .hud { font-size: 0.6rem; top: 1rem; left: 1rem; }
}

/* widen the reading measure on large screens so each stanza line fits one row */
@media (min-width: 1000px) {
  :root { --measure: 44rem; }
}

/* extra-large screens (e.g. 5K / Studio Display): scale the composition up so
   the text column doesn't shrink to a sliver. Font and measure grow together,
   so each stanza keeps its four line breaks. Continuous with the tier above. */
@media (min-width: 2000px) {
  .stanza { font-size: clamp(2.5rem, 2vw, 4rem); }
  :root { --measure: clamp(44rem, 34vw, 96rem); }
  .layer { max-width: 104rem; }
}
