:root {
  /* Font source note: Cormorant Garamond, Source Serif 4, and IBM Plex Mono (Google Fonts). */
  --archive-black: #17110B;
  --old-vellum: #E8D8B8;
  --oxidized-sepia: #7B5735;
  --candle-gold: #C89B4A;
  --tea-stain: #B48963;
  --sky-ash: #8D9A9A;
  --dried-ink: #2B2118;
  --serif: "Cormorant Garamond", serif;
  --body: "Source Serif 4", serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--archive-black);
  color: var(--old-vellum);
  font-family: var(--body);
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: .22;
  background:
    radial-gradient(circle at 20% 10%, rgba(232,216,184,.08), transparent 22%),
    radial-gradient(circle at 80% 40%, rgba(180,137,99,.07), transparent 26%),
    repeating-linear-gradient(90deg, rgba(232,216,184,.025) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(43,33,24,.4) 0 2px, transparent 2px 6px);
  mix-blend-mode: soft-light;
}

.mono, .stamp, .code { font-family: var(--mono); }

.prologue {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6vw;
  background:
    radial-gradient(circle at 18% 78%, rgba(200,155,74,.18), transparent 24%),
    radial-gradient(circle at 75% 22%, rgba(141,154,154,.11), transparent 28%),
    linear-gradient(145deg, #17110B 0%, #2B2118 68%, #17110B 100%);
}

.terminal-frame {
  position: relative;
  width: min(1180px, 100%);
  min-height: 72vh;
  border: 1px solid rgba(200,155,74,.42);
  padding: clamp(1.5rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: inset 0 0 80px rgba(43,33,24,.9), 0 35px 100px rgba(0,0,0,.35);
  background: linear-gradient(180deg, rgba(43,33,24,.72), rgba(23,17,11,.58));
}

.registry-mark {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: var(--candle-gold);
  opacity: .72;
}
.top-left { top: 18px; left: 18px; border-top: 1px solid; border-left: 1px solid; }
.top-right { top: 18px; right: 18px; border-top: 1px solid; border-right: 1px solid; }

.eyebrow { color: var(--tea-stain); letter-spacing: .12em; font-size: .75rem; }

.command-line {
  font-family: var(--mono);
  color: var(--old-vellum);
  font-size: clamp(1rem, 2vw, 1.45rem);
  min-height: 2rem;
  margin-bottom: 1rem;
}

.prompt { color: var(--candle-gold); margin-right: .65rem; }
.caret {
  display: inline-block;
  width: .55em;
  height: 1.1em;
  margin-left: .18rem;
  transform: translateY(.2em);
  background: var(--candle-gold);
  animation: blink 1.08s steps(1) infinite;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.035em;
  margin: 0;
}

h1 {
  font-size: clamp(4rem, 12vw, 11rem);
  line-height: .78;
  color: var(--old-vellum);
  text-shadow: 0 0 36px rgba(200,155,74,.08);
}

.opening-copy {
  max-width: 640px;
  color: rgba(232,216,184,.82);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.first-output {
  width: min(420px, 100%);
  margin-top: 1.8rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(123,87,53,.8);
  background: rgba(43,33,24,.74);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 900ms ease, transform 900ms ease, border-color 900ms ease;
}
.first-output.visible { opacity: 1; transform: translateY(0); border-color: rgba(200,155,74,.74); }
.first-output span { display: block; font-family: var(--mono); color: var(--candle-gold); font-size: .72rem; letter-spacing: .12em; }
.first-output strong { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }

.ledger {
  position: relative;
  padding: clamp(3rem, 8vw, 8rem) clamp(1rem, 4vw, 5rem);
  background:
    radial-gradient(circle at 50% 0%, rgba(232,216,184,.06), transparent 22%),
    linear-gradient(180deg, #17110B 0%, #2B2118 34%, #17110B 100%);
}

.curve-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .62;
}
.route {
  fill: none;
  stroke: var(--tea-stain);
  stroke-width: 1.15;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 160ms linear;
}
.route-two { stroke: var(--sky-ash); opacity: .5; }
.route-three { stroke: var(--candle-gold); opacity: .38; }

.folio-shell {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  border: 1px solid rgba(123,87,53,.48);
  padding: clamp(1rem, 3vw, 2.4rem);
  background: rgba(23,17,11,.38);
}

.folio-shell::before, .folio-shell::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--candle-gold);
  opacity: .65;
}
.folio-shell::before { left: -9px; top: -9px; }
.folio-shell::after { right: -9px; bottom: -9px; }

.folio-heading {
  display: grid;
  grid-template-columns: minmax(160px, .45fr) 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: end;
}
.folio-heading p { color: var(--candle-gold); font-size: .75rem; letter-spacing: .14em; }
.folio-heading h2 { font-size: clamp(2.6rem, 7vw, 6rem); line-height: .88; max-width: 720px; }

.masonry-grid {
  columns: 4 250px;
  column-gap: 1.05rem;
}

.fragment {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 1.05rem;
  break-inside: avoid;
  padding: 1.1rem;
  min-height: 220px;
  border: 1px solid rgba(123,87,53,.7);
  background:
    radial-gradient(circle at 10% 0%, rgba(232,216,184,.09), transparent 28%),
    linear-gradient(145deg, rgba(43,33,24,.96), rgba(23,17,11,.88));
  box-shadow: inset 0 0 0 1px rgba(232,216,184,.025), 0 18px 42px rgba(0,0,0,.22);
  transform: translateY(24px);
  opacity: 0;
  transition: opacity 900ms cubic-bezier(.2,.7,.2,1), transform 900ms cubic-bezier(.2,.7,.2,1), border-color 700ms ease, background 700ms ease;
}
.fragment.revealed { opacity: 1; transform: translateY(0); }
.fragment:hover { border-color: rgba(200,155,74,.92); background: linear-gradient(145deg, rgba(54,40,28,.98), rgba(43,33,24,.94)); }
.fragment::before, .fragment::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(200,155,74,.55);
  top: .7rem;
}
.fragment::before { left: .7rem; }
.fragment::after { right: .7rem; }

.tall { min-height: 430px; }
.medium { min-height: 310px; }
.compact { min-height: 180px; }
.square { min-height: 290px; }
.wide { min-height: 265px; }

.stamp {
  display: inline-block;
  margin: 1.1rem 0 1.3rem;
  color: var(--candle-gold);
  font-size: .66rem;
  letter-spacing: .13em;
  border-bottom: 1px solid rgba(200,155,74,.42);
  padding-bottom: .32rem;
}

.fragment h3 { font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: .95; margin-bottom: 1rem; }
.fragment p { color: rgba(232,216,184,.82); line-height: 1.48; }
.caption, .fragment .code { color: var(--tea-stain); font-size: .82rem; }
.mini-rule { height: 1px; background: rgba(200,155,74,.36); margin: 1.6rem 0; }

.counter-row { position: absolute; left: 1.1rem; bottom: 1.1rem; display: flex; align-items: end; gap: .7rem; }
.counter-row span, .large-counter { font-family: var(--serif); color: var(--candle-gold); font-size: 3.4rem; line-height: .8; }
.counter-row small { font-family: var(--mono); color: var(--sky-ash); font-size: .7rem; max-width: 90px; }
.large-counter { font-size: 5.3rem; margin-top: 2rem; }

.iso-cloud, .sundial, .tile-stack, .cube, .tower {
  transition: transform 700ms cubic-bezier(.2,.7,.2,1);
}
.fragment:hover .iso-cloud, .fragment:hover .sundial, .fragment:hover .tile-stack, .fragment:hover .cube, .fragment:hover .tower { transform: rotate(3deg); }

.iso-cloud { position: absolute; right: 1.1rem; bottom: 5.2rem; width: 112px; height: 80px; }
.iso-cloud i, .iso-cloud b, .iso-cloud em { position: absolute; display: block; background: var(--sky-ash); border: 1px solid rgba(232,216,184,.35); transform: skewY(-22deg); }
.iso-cloud i { width: 72px; height: 34px; left: 20px; top: 20px; }
.iso-cloud b { width: 42px; height: 42px; border-radius: 50%; left: 10px; top: 6px; }
.iso-cloud em { width: 54px; height: 54px; border-radius: 50%; left: 44px; top: 0; }

.sundial { width: 140px; height: 140px; border: 1px solid rgba(200,155,74,.6); border-radius: 50%; margin: 1.2rem auto; background: radial-gradient(circle, rgba(200,155,74,.18), transparent 58%); }
.sundial span { display: block; width: 2px; height: 78px; background: var(--candle-gold); margin: 26px auto; transform: rotate(34deg); transform-origin: bottom; }

.horizon-lines { margin-top: 2rem; display: grid; gap: .65rem; }
.horizon-lines span { height: 1px; background: linear-gradient(90deg, transparent, var(--sky-ash), var(--candle-gold), transparent); }

.tile-stack { position: relative; height: 120px; margin-top: 1.8rem; }
.tile-stack span { position: absolute; width: 120px; height: 64px; left: 30%; border: 1px solid rgba(141,154,154,.8); background: rgba(141,154,154,.18); transform: rotate(-22deg) skewX(25deg); }
.tile-stack span:nth-child(2) { top: 26px; left: 35%; background: rgba(180,137,99,.16); }
.tile-stack span:nth-child(3) { top: 52px; left: 40%; background: rgba(200,155,74,.13); }

.cube { position: relative; width: 110px; height: 110px; margin: 2rem auto; transform-style: preserve-3d; }
.cube span { position: absolute; width: 78px; height: 78px; border: 1px solid rgba(200,155,74,.74); background: rgba(180,137,99,.17); }
.cube span:nth-child(1) { transform: skewY(30deg); left: 0; top: 22px; }
.cube span:nth-child(2) { transform: skewY(-30deg); right: 0; top: 22px; background: rgba(141,154,154,.16); }
.cube span:nth-child(3) { transform: rotate(45deg) skew(-15deg,-15deg); left: 16px; top: -18px; background: rgba(200,155,74,.14); }

.tower { width: 120px; height: 120px; margin: 1.5rem auto 1rem; position: relative; border-bottom: 1px solid rgba(200,155,74,.55); }
.tower span:first-child { position: absolute; left: 43px; bottom: 0; width: 34px; height: 88px; border: 1px solid var(--tea-stain); background: rgba(43,33,24,.7); }
.tower span:last-child { position: absolute; left: 25px; top: 8px; width: 70px; height: 28px; border: 1px solid var(--sky-ash); border-radius: 50% 50% 0 0; }

.night-terminal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6vw;
  background: radial-gradient(circle at 50% 35%, rgba(200,155,74,.11), transparent 28%), #17110B;
}
.log-card {
  width: min(920px, 100%);
  border: 1px solid rgba(200,155,74,.55);
  padding: clamp(1.5rem, 5vw, 4rem);
  background: rgba(43,33,24,.62);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms ease, transform 900ms ease;
}
.log-card.revealed { opacity: 1; transform: translateY(0); }
.log-card > p { color: var(--candle-gold); letter-spacing: .12em; font-size: .78rem; }
.log-card h2 { font-size: clamp(3rem, 8vw, 7rem); line-height: .86; }
.command-log { margin-top: 2rem; display: grid; gap: .75rem; font-family: var(--mono); color: var(--tea-stain); }

@keyframes blink { 0%, 42% { opacity: 1; } 43%, 100% { opacity: 0; } }

@media (max-width: 720px) {
  .folio-heading { grid-template-columns: 1fr; gap: .3rem; }
  .terminal-frame { min-height: 78vh; }
  .masonry-grid { columns: 1; }
}
