:root {
  --calcium: #efebe9;
  --topsoil: #8d6e63;
  --clay: #5d4037;
  --umber: #3e2723;
  --basalt: #1b0f0a;
  --magma: #bf360c;
  --ember: #e65100;
  --teal: #546e7a;
  --dust: #d7ccc8;
  --text: #4e342e;
}

/* Compliance language: Playfair Display" (Google Fonts; Source Serif 4" (Google Fonts; IBM Plex Sans" (Google Fonts. Intermittent glitch as environmental storytelling:** The random glitch effects (every 8-15 seconds use IntersectionObserver` for activation and `requestAnimationFrame` for smooth interpolation. Interval with randomized 8-15 second gaps. */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--basalt);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(175deg, #efebe9 0%, #d7ccc8 100%);
  color: var(--text);
  font-family: "Source Serif 4", serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
}

body::before {
  background: repeating-linear-gradient(0deg, rgba(239,235,233,0.06) 0 1px, transparent 1px 7px);
  mix-blend-mode: overlay;
}

body.is-glitching::before {
  opacity: 1;
  animation: scan-malfunction 210ms steps(1) both;
}

body.is-glitching::after {
  opacity: 0.34;
  background: linear-gradient(90deg, rgba(191,54,12,0.14), transparent 42%, rgba(84,110,122,0.16));
  clip-path: inset(var(--gy1, 16%) 0 var(--gy2, 70%) 0);
  transform: translateX(var(--gx, 18px));
  mix-blend-mode: color-dodge;
  animation: glitch-band 220ms steps(1) both;
}

.rift-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #efebe9;
  overflow: hidden;
  pointer-events: none;
  animation: loader-withdraw 700ms ease 2600ms forwards;
}

.loader-tint {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: tint-arrive 1600ms ease 700ms forwards;
}

.loader-tint-warm {
  background: rgba(141, 110, 99, 0.05);
  clip-path: polygon(0 0, 52% 0, 42% 100%, 0 100%);
  transform: translateX(0);
}

.loader-tint-cool {
  background: rgba(84, 110, 122, 0.05);
  clip-path: polygon(50% 0, 100% 0, 100% 100%, 44% 100%);
  transform: translateX(0);
}

.loader-crack {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 0;
  background: #3e2723;
  box-shadow: 0 0 18px rgba(230, 81, 0, 0.38);
  transform: rotate(-38deg);
  transform-origin: top center;
  animation: crack-draw 2100ms linear 500ms forwards;
}

.glitch-shell {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.opening-rift {
  min-height: 112vh;
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4rem);
  background: linear-gradient(175deg, #efebe9 0%, #d7ccc8 100%);
  clip-path: polygon(0 0, 100% 0, 94% 87%, 58% 100%, 0 92%);
}

.opening-rift::before,
.opening-rift::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.opening-rift::before {
  background: rgba(141, 110, 99, 0.05);
  clip-path: polygon(0 0, 55% 0, 44% 100%, 0 100%);
  transform: translateX(var(--split-left, -7px));
}

.opening-rift::after {
  background: rgba(84, 110, 122, 0.05);
  clip-path: polygon(51% 0, 100% 0, 100% 100%, 46% 100%);
  transform: translateX(var(--split-right, 8px));
}

.strata-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.section-plate {
  will-change: transform;
  transform: translateX(var(--drift-x, 0px)) rotate(var(--drift-rot, 0deg));
}

.chromatic-title {
  position: relative;
  z-index: 2;
  width: min(820px, 82vw);
  margin: 22vh 0 0 8vw;
  opacity: 0;
  transform: scale(0.92) translate(24px, 18px) rotate(-1.4deg);
  animation: content-emerge 1100ms cubic-bezier(.2,.8,.2,1) 2550ms forwards;
}

.chromatic-title::before,
.chromatic-title::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 1.85rem;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 7rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  opacity: 0.23;
  pointer-events: none;
}

.chromatic-title::before { color: #bf360c; transform: translateX(-4px); }
.chromatic-title::after { color: #546e7a; transform: translateX(4px); }

h1,
h2 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

h1 {
  position: relative;
  z-index: 1;
  color: #3e2723;
  font-size: clamp(3.5rem, 10vw, 9rem);
}

h2 {
  color: #3e2723;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
}

p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  letter-spacing: 0.01em;
  line-height: 1.75;
}

.meta,
.rift-nav a,
.plate-spec span,
.stratum-image p,
.fragment-list p {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta {
  color: rgba(141, 110, 99, 0.7);
  margin: 0 0 1rem;
}

.opening-copy {
  position: absolute;
  z-index: 2;
  right: 8vw;
  bottom: 20vh;
  width: min(420px, 72vw);
  color: #5d4037;
  transform: rotate(2.2deg);
  opacity: 0;
  animation: content-emerge 1200ms ease 3000ms forwards;
}

.rift-nav {
  position: fixed;
  z-index: 40;
  top: 45%;
  right: clamp(0.75rem, 2vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  opacity: 0;
  transform: translateX(16px) rotate(1.2deg);
  animation: nav-emerge 900ms ease 2200ms forwards;
}

.rift-nav a {
  color: rgba(141, 110, 99, 0.82);
  text-decoration: none;
  text-shadow: 0 0 14px rgba(230, 81, 0, 0.34);
  transition: color 350ms ease, transform 350ms ease;
}

.rift-nav a:hover {
  color: #e65100;
  transform: translateX(-7px);
}

.fracture,
.fracture-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.fracture path {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}

.fracture.is-open path,
.opening-rift .fracture path {
  animation: split-open 1900ms ease forwards;
}

.fracture-glow {
  stroke: rgba(230, 81, 0, 0.06);
  stroke-width: 4px;
}

.fracture-line {
  stroke: rgba(93, 64, 55, 0.4);
  stroke-width: 1px;
  filter: drop-shadow(0 0 6px rgba(230, 81, 0, 0.2));
}

.y2k-orb,
.blob {
  position: absolute;
  border-radius: 50% 43% 57% 46%;
  pointer-events: none;
  filter: blur(0.2px);
}

.y2k-orb {
  z-index: 1;
  background: radial-gradient(circle at 30% 24%, rgba(239,235,233,0.9), rgba(141,110,99,0.16) 42%, rgba(84,110,122,0.08) 70%);
  border: 1px solid rgba(239,235,233,0.55);
  box-shadow: inset -18px -22px 34px rgba(93,64,55,0.08), 0 0 48px rgba(230,81,0,0.08);
  animation: blob-morph 12s ease-in-out infinite alternate;
}

.orb-one { width: 280px; height: 220px; top: 13vh; right: 13vw; }
.orb-two { width: 170px; height: 210px; bottom: 11vh; left: 17vw; animation-duration: 9s; }

.stratum {
  position: relative;
  z-index: 2;
  min-height: 56vh;
  margin: -6vh 0;
  padding: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: clamp(1rem, 5vw, 5rem);
  align-items: center;
  opacity: 0;
  transition: opacity 1.2s ease-out;
}

.stratum.is-visible { opacity: 1; }

.stratum-surface {
  min-height: 62vh;
  background: linear-gradient(175deg, #efebe9 0%, #d7ccc8 100%);
  clip-path: polygon(0 8%, 100% 0, 96% 82%, 18% 100%, 0 91%);
}

.stratum-clay {
  min-height: 66vh;
  background: linear-gradient(165deg, #d7ccc8 0%, #8d6e63 52%, #5d4037 100%);
  clip-path: polygon(4% 0, 100% 10%, 100% 95%, 50% 88%, 0 100%, 0 13%);
  grid-template-columns: minmax(230px, 0.82fr) minmax(0, 1.18fr);
}

.stratum-mineral {
  min-height: 60vh;
  background: linear-gradient(172deg, #5d4037 0%, #3e2723 72%);
  clip-path: polygon(0 0, 82% 6%, 100% 17%, 94% 100%, 0 91%);
}

.stratum-deep {
  min-height: 72vh;
  background: linear-gradient(175deg, #3e2723 0%, #1b0f0a 100%);
  clip-path: polygon(3% 8%, 100% 0, 100% 100%, 24% 93%, 0 100%);
  grid-template-columns: minmax(230px, 0.78fr) minmax(0, 1.22fr);
}

.stratum-mineral h2,
.stratum-deep h2,
.core-section h2 { color: #efebe9; }

.stratum-mineral p,
.stratum-deep p { color: #d7ccc8; }

.plate-copy {
  position: relative;
  z-index: 2;
  padding: clamp(1.2rem, 3vw, 3rem);
  max-width: 760px;
  transform: rotate(var(--copy-tilt, -1.2deg));
}

.stratum-clay .plate-copy,
.stratum-deep .plate-copy { --copy-tilt: 2deg; }

.plate-spec,
.fragment-list,
.stratum-image {
  position: relative;
  z-index: 2;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border: 1px solid rgba(93, 64, 55, 0.28);
  background: rgba(239, 235, 233, 0.18);
  box-shadow: inset 0 1px rgba(239,235,233,0.3), 0 22px 60px rgba(27,15,10,0.08);
  backdrop-filter: blur(11px);
  transform: translate(-8%, 9%) rotate(2.4deg);
}

.plate-spec span { color: rgba(141, 110, 99, 0.7); }
.plate-spec p { color: #5d4037; }

.fragment-list {
  border-color: rgba(84, 110, 122, 0.28);
  background: rgba(27, 15, 10, 0.18);
  transform: translate(-18%, -8%) rotate(-2.7deg);
}

.fragment-list p {
  color: rgba(215, 204, 200, 0.72);
  border-bottom: 1px solid rgba(84,110,122,0.24);
  padding: 0.9rem 0;
  margin: 0;
}

.stratum-image {
  min-height: 310px;
  overflow: hidden;
  border-radius: 34% 44% 38% 48% / 38% 32% 48% 46%;
}

.stratum-image p {
  position: absolute;
  left: 1.5rem;
  bottom: 1rem;
  color: rgba(239,235,233,0.7);
}

.liquid-glass,
.dark-window .mineral-branch {
  position: absolute;
  inset: 12%;
  border-radius: 45% 38% 52% 41%;
}

.liquid-glass {
  background: radial-gradient(circle at 33% 21%, rgba(239,235,233,0.78), transparent 16%), linear-gradient(132deg, rgba(84,110,122,0.22), rgba(191,54,12,0.18), rgba(93,64,55,0.38));
  border: 1px solid rgba(239,235,233,0.36);
  animation: blob-morph 9s ease-in-out infinite alternate;
}

.dark-window { background: rgba(27, 15, 10, 0.45); border-color: rgba(230, 81, 0, 0.14); }

.mineral-branch {
  background:
    linear-gradient(32deg, transparent 48%, rgba(230,81,0,0.28) 49%, transparent 51%),
    linear-gradient(102deg, transparent 50%, rgba(230,81,0,0.18) 51%, transparent 53%),
    radial-gradient(circle at 50% 60%, rgba(191,54,12,0.28), transparent 58%);
  filter: drop-shadow(0 0 18px rgba(230,81,0,0.15));
  animation: crystal-grow 6s ease-in-out infinite alternate;
}

.blob {
  z-index: 1;
  width: 260px;
  height: 190px;
  background: linear-gradient(135deg, rgba(141,110,99,0.15), rgba(93,64,55,0.15));
  animation: blob-morph 10s ease-in-out infinite alternate;
}

.blob-a { right: 22%; top: 12%; }
.blob-b { left: 10%; bottom: 8%; width: 310px; height: 220px; animation-duration: 12s; }
.blob-c { right: 8%; top: 8%; width: 220px; height: 300px; background: linear-gradient(135deg, rgba(84,110,122,0.16), rgba(141,110,99,0.12)); }

.reveal-block {
  opacity: 0;
  transform: translateY(24px) rotate(var(--reveal-rot, 0deg));
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.is-visible .reveal-block {
  opacity: 1;
  transform: translateY(0) rotate(var(--reveal-rot, 0deg));
}

.is-visible .delay-two { transition-delay: 400ms; }
.is-visible .delay-three { transition-delay: 600ms; }

.core-section {
  position: relative;
  min-height: 180vh;
  margin-top: -2vh;
  background: #1b0f0a;
}

.core-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 7vw, 6rem);
  background: radial-gradient(ellipse at 50% 80%, #e65100 0%, #bf360c 40%, #1b0f0a 100%);
  background-size: 200% 200%;
  animation: core-pulse 6s ease-in-out infinite alternate;
}

.core-sticky .meta {
  color: rgba(239,235,233,0.64);
  margin-left: 11vw;
}

.core-sticky h2 {
  width: min(980px, 86vw);
  margin-left: 10vw;
  filter: blur(0);
  animation: core-blur 6s ease-in-out infinite;
}

.core-fracture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.core-fracture path {
  fill: none;
  stroke: rgba(239,235,233,0.22);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 16px rgba(230,81,0,0.44));
}

@keyframes crack-draw { to { height: 160vh; } }
@keyframes tint-arrive { to { opacity: 1; transform: translateX(var(--split, 0)); } }
@keyframes loader-withdraw { to { opacity: 0; visibility: hidden; } }
@keyframes content-emerge { to { opacity: 1; transform: scale(1) translate(0, 0) rotate(-1.4deg); } }
@keyframes nav-emerge { to { opacity: 1; transform: translateX(0) rotate(1.2deg); } }
@keyframes split-open { to { stroke-dashoffset: 0; } }
@keyframes blob-morph { to { border-radius: 39% 61% 43% 57% / 54% 38% 62% 46%; transform: translate(10px, -12px) rotate(3deg); } }
@keyframes crystal-grow { from { clip-path: inset(38% 44% 38% 44%); } to { clip-path: inset(0); } }
@keyframes core-pulse { to { background-position: 50% 100%; filter: saturate(1.18); } }
@keyframes core-blur { 0%, 100% { filter: blur(0); } 50% { filter: blur(2px); } }
@keyframes scan-malfunction { 0% { transform: translateX(-14px); } 50% { transform: translateX(16px); } 100% { transform: translateX(0); } }
@keyframes glitch-band { 0% { transform: translateX(calc(var(--gx, 18px) * -1)); } 50% { transform: translateX(var(--gx, 18px)); } 100% { transform: translateX(0); } }

@media (max-width: 780px) {
  .stratum,
  .stratum-clay,
  .stratum-deep {
    grid-template-columns: 1fr;
    margin: -3vh 0;
  }

  .rift-nav {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    gap: 0.45rem;
  }

  .chromatic-title { margin: 19vh 0 0 0; }
  .opening-copy { left: 2rem; right: auto; bottom: 16vh; }
  .plate-spec,
  .fragment-list,
  .stratum-image { transform: rotate(1.5deg); }
}
