:root {
  /* Design compliance: Interactive IntersectionObserver` with `threshold: 0.15` to trigger entries. Apply `transform: translateY(40px Playfair Display" (Google Fonts */
  --deep-amethyst: #1a0e2e;
  --burnished-gold: #d4a843;
  --lavender-chrome: #c9a0dc;
  --rose-quartz: #e8b4c8;
  --moonstone: #f0e6f6;
  --charcoal-velvet: #3d2a50;
  --chrome-silver: #b8c0d0;
  --glass: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--moonstone);
  font-family: "Cormorant Garamond", serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(232, 180, 200, 0.18), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(212, 168, 67, 0.12), transparent 30%),
    linear-gradient(135deg, #1a0e2e 0%, #3d2a50 48%, #1a0e2e 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -3;
  background: radial-gradient(ellipse at center, rgba(201, 160, 220, 0.16) 0%, transparent 58%);
  animation: ambientRipple 20s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(115deg, transparent 0 47%, rgba(184, 192, 208, 0.08) 48%, transparent 49% 100%),
    repeating-linear-gradient(90deg, rgba(240, 230, 246, 0.035) 0 1px, transparent 1px 8.333vw);
}

.ambient-orb {
  position: fixed;
  width: 38vmax;
  height: 38vmax;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.28;
  z-index: -1;
  pointer-events: none;
}

.orb-one { left: -16vmax; top: 18vh; background: var(--lavender-chrome); }
.orb-two { right: -18vmax; bottom: -4vmax; background: var(--burnished-gold); }

.leaf-watermark {
  position: fixed;
  width: 46vw;
  height: 60vh;
  z-index: -1;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  pointer-events: none;
  background: var(--burnished-gold);
  clip-path: polygon(50% 0%, 62% 26%, 96% 16%, 72% 43%, 100% 58%, 66% 61%, 76% 100%, 50% 70%, 24% 100%, 34% 61%, 0% 58%, 28% 43%, 4% 16%, 38% 26%);
  transform: translate3d(0, 0, 0) rotate(-18deg);
}

.leaf-one { left: -12vw; top: 9vh; }
.leaf-two { right: -15vw; bottom: 2vh; transform: rotate(24deg); }

.time-rail {
  position: fixed;
  top: 50%;
  right: 1.3rem;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
}

.time-rail a {
  color: var(--chrome-silver);
  text-decoration: none;
  border: 1px solid rgba(212, 168, 67, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(16px) saturate(180%);
  transition: color 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.time-rail a.active,
.time-rail a:hover {
  color: var(--moonstone);
  border-color: rgba(212, 168, 67, 0.8);
  box-shadow: 0 0 18px rgba(212, 168, 67, 0.22);
}

.chronicle { position: relative; }

.era-section {
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, minmax(72px, auto));
  gap: clamp(1rem, 2vw, 2rem);
  padding: clamp(5rem, 8vh, 7rem) clamp(1.2rem, 7vw, 7rem);
  position: relative;
  align-items: center;
  isolation: isolate;
}

.era-section:nth-child(even) { margin-top: 8vh; }
.era-section:nth-child(odd):not(:first-child) { margin-top: 16vh; }

.era-section::before {
  content: "";
  position: absolute;
  inset: 10% 5%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(201, 160, 220, 0.1) 0%, transparent 70%);
}

.era-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 3rem);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 400ms ease, opacity 650ms ease;
}

.era-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 24px rgba(212, 168, 67, 0.15);
}

.era-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.22), transparent 24%, transparent 72%, rgba(232,180,200,0.12));
  pointer-events: none;
}

.era-card .ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.36), transparent 68%);
  transform: translate(-50%, -50%) scale(0);
  animation: clickRipple 600ms ease-out forwards;
}

.era-card.in-view { animation: cardPulse 800ms ease-out 1; }

[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

.primary-card { z-index: 3; }
.context-card, .shard-card, .artifact-card { z-index: 2; }

.opening .primary-card { grid-column: 2 / 8; grid-row: 1 / 5; }
.opening .context-card { grid-column: 7 / 12; grid-row: 3 / 6; }
.opening .chrome-divider { grid-column: 3 / 11; grid-row: 6; }

.empires .primary-card { grid-column: 5 / 12; grid-row: 1 / 4; }
.empires .shard-card { grid-column: 2 / 7; grid-row: 3 / 6; }
.empires .artifact-card { grid-column: 8 / 11; grid-row: 5 / 7; }

.revolt .primary-card { grid-column: 2 / 9; grid-row: 2 / 5; }
.revolt .context-card { grid-column: 8 / 12; grid-row: 1 / 4; }
.revolt .vine-center { grid-column: 3 / 11; grid-row: 5 / 6; }
.revolt .chrome-divider { grid-column: 5 / 10; grid-row: 6; }

.industry .primary-card { grid-column: 4 / 11; grid-row: 2 / 5; }
.industry .shard-card { grid-column: 2 / 6; grid-row: 1 / 3; }
.industry .artifact-card { grid-column: 9 / 12; grid-row: 4 / 7; }

.signal .primary-card { grid-column: 3 / 10; grid-row: 1 / 4; }
.signal .context-card { grid-column: 6 / 12; grid-row: 3 / 6; }
.signal .final-mark { grid-column: 2 / 4; grid-row: 5 / 6; }

h1, h2, h3 {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0.35em 0 0.25em;
  color: var(--moonstone);
  text-shadow: 0 0 28px rgba(201, 160, 220, 0.22);
}

h1 { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 0.96; }
h2 { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1; }
h3 { font-size: clamp(1.8rem, 3vw, 3rem); line-height: 1.05; }

p {
  position: relative;
  z-index: 1;
  margin: 0.7rem 0 0;
  font-size: clamp(1.05rem, 1.55vw, 1.35rem);
  line-height: 1.7;
  color: rgba(240, 230, 246, 0.88);
}

.badge, .label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  font-family: "DM Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--chrome-silver);
}

.badge {
  border: 1px solid rgba(212, 168, 67, 0.5);
  border-radius: 999px;
  padding: 4px 16px;
  color: var(--burnished-gold);
  box-shadow: inset 0 0 12px rgba(212, 168, 67, 0.12), 0 0 16px rgba(232, 180, 200, 0.1);
}

.label { color: var(--lavender-chrome); }

.chrome-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #d4a843, #c9a0dc, #d4a843, transparent);
  filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.4));
}

.short { max-width: 38rem; width: 100%; }

.diagonal-line {
  position: absolute;
  width: 72vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a0dc, transparent);
  z-index: 0;
  opacity: 0.72;
  transform: rotate(13deg);
}

.line-a { left: -7vw; top: 32%; }
.line-b { right: -8vw; top: 58%; transform: rotate(-14deg); }
.line-c { left: 10vw; top: 25%; transform: rotate(12deg); }
.line-d { right: 1vw; top: 45%; transform: rotate(15deg); }
.line-e { left: -5vw; top: 64%; transform: rotate(-12deg); }

.bloom {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 16px;
  height: 16px;
  background: #e8b4c8;
  clip-path: polygon(50% 0%, 62% 34%, 98% 24%, 74% 51%, 98% 76%, 62% 66%, 50% 100%, 38% 66%, 2% 76%, 26% 51%, 2% 24%, 38% 34%);
  box-shadow: 0 0 8px rgba(232, 180, 200, 0.4);
}

.vine {
  position: absolute;
  z-index: 1;
  fill: none;
  stroke: #c9a0dc;
  stroke-width: 0.5px;
  opacity: 0.7;
  pointer-events: none;
}

.vine path {
  stroke-dasharray: 700;
  stroke-dashoffset: 700;
}

.era-section.in-view .vine path { animation: draw 1.2s ease forwards; }

.vine-left { left: 1.2rem; top: 12vh; height: 70vh; }
.vine-right { right: 2rem; top: 16vh; height: 68vh; }
.vine-center { position: relative; width: 100%; height: 140px; }

.artifact-card {
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
}

.artifact-gem {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #f0e6f6, #c9a0dc 38%, #d4a843 72%, #e8b4c8);
  clip-path: polygon(50% 0, 100% 32%, 82% 100%, 18% 100%, 0 32%);
  box-shadow: 0 0 28px rgba(232, 180, 200, 0.32);
}

.final-mark {
  font-family: "Playfair Display", serif;
  font-size: clamp(5rem, 12vw, 11rem);
  color: var(--burnished-gold);
  text-shadow: 0 0 25px rgba(212, 168, 67, 0.52), 0 0 54px rgba(232, 180, 200, 0.25);
}

@keyframes ambientRipple {
  0% { transform: translate(-8%, -4%) scale(0.95); }
  50% { transform: translate(10%, 8%) scale(1.08); }
  100% { transform: translate(-2%, 12%) scale(1); }
}

@keyframes clickRipple {
  to { transform: translate(-50%, -50%) scale(24); opacity: 0; }
}

@keyframes cardPulse {
  0% { box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 0 rgba(201, 160, 220, 0.4); }
  100% { box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 20px rgba(201, 160, 220, 0); }
}

@keyframes draw { to { stroke-dashoffset: 0; } }

@media (max-width: 767px) {
  .time-rail { display: none; }
  .era-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    padding: 5rem 5vw;
  }

  .era-section > *:nth-child(odd):not(.diagonal-line) { margin-left: 8vw; }
  .era-section > *:nth-child(even):not(.diagonal-line) { margin-right: 8vw; }

  .vine-left, .vine-right { height: 42vh; opacity: 0.42; }
  .leaf-watermark { width: 76vw; }
  .diagonal-line { width: 110vw; }
  .era-card { width: auto; }
}
