:root {
  --deep: #2B2518;
  --surface: #E8DFD0;
  --brass: #7A6F5E;
  --olive: #8B7D69;
  --body-text: #4A4233;
  --sage: #C4B8A3;
  --walnut: #3D3628;
  --copper: #B85C3A;
  --rose: #C8907A;
  --cream: #F2EBE0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--deep);
  color: var(--sage);
  font-family: "Nunito Sans", sans-serif;
  font-weight: 300;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, rgba(232,223,208,0.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  z-index: 20;
}

h1, h2 { font-family: "Jost", sans-serif; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(1.5rem, 3vw, 2.8rem); color: var(--surface); }
h2 { font-size: clamp(1.1rem, 2vw, 1.7rem); color: inherit; }
p { font-size: clamp(0.875rem, 1.4vw, 1.1rem); line-height: 1.72; margin: 0; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: var(--deep);
  display: grid;
  place-content: center;
  gap: 2rem;
  text-align: left;
  animation: bootAway 900ms ease 3.6s forwards;
}

.boot-indicator { margin: 0 auto; animation: bootIn 500ms ease 500ms both, pulse 3s ease-in-out infinite 1s; }

.indicator {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-block;
  background: var(--copper);
  border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%;
  animation: pulse 3s ease-in-out infinite;
}
.indicator.rose { background: var(--rose); }

.boot-lines { font-family: "Inconsolata", monospace; color: var(--sage); font-size: clamp(0.9rem, 2vw, 1.25rem); letter-spacing: 0.05em; }
.type-line { width: 0; overflow: hidden; white-space: nowrap; border-right: 2px solid var(--copper); margin: 0.6rem 0; }
.line-one { animation: typing 900ms steps(33) 1s forwards, blink 700ms step-end infinite; }
.line-two { animation: typing 800ms steps(29) 2.05s forwards, blink 700ms step-end infinite; }
.line-three { animation: typing 950ms steps(39) 2.95s forwards, blink 700ms step-end infinite; }

.station { position: relative; padding: 5rem clamp(1rem, 3vw, 3rem) 4rem; opacity: 0; animation: stationOn 1ms linear 3.7s forwards; }
.dashboard { display: grid; grid-template-columns: 1fr 1.618fr 1fr 1fr 1.618fr 1fr; gap: 2rem; align-items: stretch; max-width: 1600px; margin: 0 auto; }

.panel {
  opacity: 0;
  transform: translateY(12px);
  animation: panelReveal 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(3.85s + (var(--i, 0) * 100ms));
}
.panel[data-index="0"]{--i:0}.panel[data-index="1"]{--i:1}.panel[data-index="2"]{--i:2}.panel[data-index="3"]{--i:3}.panel[data-index="4"]{--i:4}.panel[data-index="5"]{--i:5}.panel[data-index="6"]{--i:6}.panel[data-index="7"]{--i:7}.panel[data-index="8"]{--i:8}.panel[data-index="9"]{--i:9}.panel[data-index="10"]{--i:10}.panel[data-index="11"]{--i:11}

.status-bar {
  grid-column: 1 / -1;
  background: var(--walnut);
  color: var(--sage);
  font-family: "Inconsolata", monospace;
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--brass);
}
.alert { color: var(--copper); }

.monitor {
  grid-column: span 2;
  min-height: 420px;
  background: rgba(61,54,40,0.92);
  border: 3px solid var(--brass);
  border-radius: 24px 24px 4px 4px;
  padding: 1.3rem;
  box-shadow: inset 0 0 40px rgba(122,111,94,0.15);
  overflow: hidden;
}
.monitor header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.monitor p { color: var(--sage); margin-top: 1rem; }
.wide-monitor { grid-column: span 4; }

.data-strip {
  grid-column: span 1;
  grid-row: span 2;
  min-height: 520px;
  background: rgba(232,223,208,0.92);
  color: var(--deep);
  border: 1px solid var(--sage);
  border-radius: 4px;
  padding: 1rem;
  overflow-y: auto;
}
.data-strip h2, .scroll-log { font-family: "Inconsolata", monospace; letter-spacing: 0.05em; }
.data-strip h2 { color: var(--copper); font-size: 0.9rem; margin-bottom: 1rem; }
.scroll-log { color: var(--olive); font-size: clamp(0.65rem, 1vw, 0.85rem); }
.scroll-log p { font: inherit; margin: 0 0 0.8rem; }
.reverse { animation: logDrift 16s linear infinite alternate; }

.specimen-card {
  grid-column: span 3;
  min-height: 300px;
  border-radius: 32px;
  overflow: hidden;
  padding: 1.5rem;
  color: var(--deep);
  border: 1px solid rgba(122,111,94,0.8);
  background: linear-gradient(135deg, #F2EBE0 0%, #E8DFD0 100%), repeating-linear-gradient(42deg, transparent, transparent 12px, rgba(122,111,94,0.08) 12px, rgba(122,111,94,0.08) 13px), repeating-linear-gradient(158deg, transparent, transparent 18px, rgba(184,92,58,0.05) 18px, rgba(184,92,58,0.05) 19px), radial-gradient(ellipse at 30% 60%, rgba(122,111,94,0.06) 0%, transparent 70%), repeating-conic-gradient(#F2EBE0 0% 25%, transparent 0% 50%);
  background-blend-mode: multiply, normal, normal, normal, normal;
  background-size: auto, auto, auto, auto, 3px 3px;
  position: relative;
}
.specimen-card p { color: var(--walnut); max-width: 36rem; }
.ghost-blob { position: absolute; right: 7%; bottom: -28px; width: 210px; height: 190px; background: rgba(184,92,58,0.22); border-radius: 30% 70% 55% 45% / 65% 35% 48% 52%; animation: blobMorph 15s ease-in-out infinite; }

.specimen-stage { min-height: 230px; display: grid; place-items: center; border-radius: 18px; background: rgba(43,37,24,0.45); box-shadow: inset 0 0 40px rgba(122,111,94,0.15); }
.specimen-stage.alt { background: rgba(232,223,208,0.08); }
.specimen, .anomaly-blob, .thumb {
  background: linear-gradient(135deg, #F2EBE0 0%, #E8DFD0 100%), repeating-linear-gradient(42deg, transparent, transparent 12px, rgba(122,111,94,0.08) 12px, rgba(122,111,94,0.08) 13px), repeating-linear-gradient(158deg, transparent, transparent 18px, rgba(184,92,58,0.05) 18px, rgba(184,92,58,0.05) 19px), radial-gradient(ellipse at 30% 60%, rgba(122,111,94,0.06) 0%, transparent 70%), repeating-conic-gradient(#F2EBE0 0% 25%, transparent 0% 50%);
  background-size: auto, auto, auto, auto, 3px 3px;
  border-radius: 30% 70% 55% 45% / 65% 35% 48% 52%;
  animation: blobMorph 15s ease-in-out infinite;
  will-change: border-radius;
}
.blob-a { width: 230px; height: 190px; }
.blob-b { width: 185px; height: 245px; filter: sepia(0.2); }
.blob-c { width: 260px; height: 220px; background-color: var(--brass); }
.dual-readout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: center; height: 80%; }
.readout-copy { font-family: "Inconsolata", monospace; color: var(--sage); letter-spacing: 0.05em; }
.readout-copy p { margin: 0.5rem 0; color: var(--sage); }

.circuit { width: 100%; margin-top: 1rem; overflow: visible; }
.circuit path { fill: none; stroke: var(--olive); stroke-width: 1; stroke-dasharray: 260; stroke-dashoffset: 260; transition: stroke-dashoffset 2s ease, stroke 300ms ease; }
.circuit circle { fill: var(--olive); stroke: none; border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%; transition: fill 300ms ease, transform 300ms ease; transform-origin: center; }
.schematic:hover path { stroke-dashoffset: 0; stroke: var(--copper); }
.schematic:hover circle { fill: var(--copper); transform: scale(1.2); }

.error-panel {
  grid-column: 1 / -1;
  min-height: 100vh;
  background: var(--deep);
  border: 3px solid var(--brass);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2rem;
  color: var(--copper);
  font-family: "Inconsolata", monospace;
  letter-spacing: 0.05em;
}
.error-text { font-size: clamp(1rem, 2vw, 1.5rem); }
.error-panel p { color: var(--sage); font-family: "Inconsolata", monospace; }
.anomaly-blob { width: min(44vw, 470px); height: min(36vw, 360px); background-color: var(--copper); transition: background-color 2s ease, opacity 2s ease; }
.anomaly-blob.shake { animation: shakeError 500ms ease both, blobMorph 15s ease-in-out infinite; opacity: 0.7; }
.anomaly-blob.stable { background-color: var(--rose); opacity: 1; }

.archive { grid-column: 1 / -1; min-height: 75vh; }
.thumb-row { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: center; padding: 3rem 0 1rem; }
.thumb { width: 130px; height: 115px; position: relative; transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); cursor: crosshair; }
.thumb:hover { transform: scale(1.2); z-index: 4; }
.thumb span { position: absolute; top: calc(100% + 0.8rem); left: 50%; transform: translateX(-50%); width: 170px; opacity: 0; transition: opacity 300ms ease; color: var(--copper); font-family: "Inconsolata", monospace; font-size: 0.72rem; letter-spacing: 0.05em; text-align: center; }
.thumb:hover span { opacity: 1; }
.t2 { border-radius: 60% 40% 42% 58% / 45% 70% 30% 55%; animation-duration: 17s; }
.t3 { border-radius: 36% 64% 70% 30% / 68% 42% 58% 32%; animation-duration: 13s; }
.t4 { filter: hue-rotate(18deg) saturate(1.2); animation-duration: 19s; }
.t5 { filter: sepia(0.35); animation-duration: 14s; }
.t6 { filter: brightness(0.82); animation-duration: 20s; }
.t7 { filter: contrast(1.1); animation-duration: 16s; }

.signoff {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  color: var(--sage);
  font-family: "Inconsolata", monospace;
  letter-spacing: 0.05em;
}
.signoff p { font-family: inherit; position: relative; z-index: 1; }
.final-ambient { opacity: 0.08; z-index: 0; left: 50%; top: 45%; transform: translate(-50%,-50%); }

.ambient { position: fixed; width: 420px; height: 360px; pointer-events: none; background: var(--copper); opacity: 0.15; border-radius: 30% 70% 55% 45% / 65% 35% 48% 52%; animation: blobMorph 15s ease-in-out infinite, drift 30s ease-in-out infinite alternate; z-index: -1; }
.ambient-one { left: -110px; top: 20vh; }
.ambient-two { right: -130px; top: 120vh; background: var(--rose); animation-delay: -6s; }

.blob-index {
  position: fixed;
  right: 1.6rem;
  bottom: 1.6rem;
  width: 72px;
  height: 64px;
  background: var(--walnut);
  border: 1px solid var(--brass);
  border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%;
  z-index: 10;
  transition: width 350ms ease, height 350ms ease, border-radius 350ms ease;
  font-family: "Inconsolata", monospace;
  letter-spacing: 0.05em;
}
.blob-index a { position: absolute; color: var(--sage); text-decoration: none; font-size: 0.78rem; opacity: 0; transition: opacity 250ms ease 100ms, color 250ms ease; }
.blob-index:hover { width: 190px; height: 170px; border-radius: 36% 64% 65% 35% / 42% 48% 52% 58%; }
.blob-index:hover a { opacity: 1; }
.blob-index a:hover { color: var(--rose); }
.blob-index a:nth-child(1){ top:22px; left:70px; }
.blob-index a:nth-child(2){ top:70px; left:24px; }
.blob-index a:nth-child(3){ top:92px; right:24px; }
.blob-index a:nth-child(4){ bottom:22px; left:72px; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(43,37,24,0.2); }
::-webkit-scrollbar-thumb { background: var(--brass); }

@keyframes bootIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes bootAway { to { opacity: 0; visibility: hidden; } }
@keyframes stationOn { to { opacity: 1; } }
@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { border-color: transparent; } }
@keyframes panelReveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes drift { 0% { transform: translate(0,0) rotate(0deg); } 100% { transform: translate(70px, -45px) rotate(8deg); } }
@keyframes logDrift { from { transform: translateY(0); } to { transform: translateY(-90px); } }
@keyframes blobMorph {
  0% { border-radius: 30% 70% 55% 45% / 65% 35% 48% 52%; }
  25% { border-radius: 58% 42% 39% 61% / 44% 62% 38% 56%; }
  50% { border-radius: 42% 58% 66% 34% / 60% 37% 63% 40%; }
  75% { border-radius: 64% 36% 48% 52% / 35% 58% 42% 65%; }
  100% { border-radius: 30% 70% 55% 45% / 65% 35% 48% 52%; }
}
@keyframes shakeError {
  0% { transform: translateX(0); opacity: 1; }
  10% { transform: translateX(-8px) rotate(-1deg); opacity: 0.7; }
  20% { transform: translateX(8px) rotate(1deg); opacity: 1; }
  30% { transform: translateX(-5px); opacity: 0.72; }
  40% { transform: translateX(5px); opacity: 1; }
  50%,100% { transform: translateX(0); opacity: 0.7; }
}

@media (max-width: 1000px) {
  .dashboard { grid-template-columns: 1fr 1fr; }
  .monitor, .data-strip, .specimen-card, .wide-monitor { grid-column: span 2; }
  .dual-readout { grid-template-columns: 1fr; }
  .status-bar { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  .dashboard { grid-template-columns: 1fr; gap: 1rem; }
  .monitor, .data-strip, .specimen-card, .wide-monitor, .status-bar, .error-panel, .archive, .signoff { grid-column: 1 / -1; }
  .station { padding-inline: 0.7rem; }
  .type-line { font-size: 0.78rem; }
}
