:root {
  --bg-1: #f4efe7;
  --bg-2: #e6dfd6;
  --paper: #fdfaf4;
  --accent: #2d4aa8;
  --accent-2: #c95b3f;
  --text: #1f2433;
  --muted: #5f6472;
  --border: rgba(31, 36, 51, 0.08);
  --shadow: 0 18px 60px rgba(20, 26, 43, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(45, 74, 168, 0.08), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(201, 91, 63, 0.08), transparent 32%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Playfair Display", "DM Sans", serif;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.doc-shell {
  position: relative;
}

.page-lines,
.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.page-lines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(45, 74, 168, 0.06) 0,
    rgba(45, 74, 168, 0.06) 1px,
    transparent 28px,
    transparent 32px
  ), linear-gradient(to right, rgba(201, 91, 63, 0.08) 60px, transparent 60px);
  opacity: 0.45;
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.paper-noise {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0.32;
  transition: transform 0.2s ease;
}

body:not(.show-guides) .page-lines {
  opacity: 0.08;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 38px;
  padding: 78px clamp(18px, 4vw, 70px) 40px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--accent-2);
  font-size: 12px;
}

.lede {
  margin: 16px 0 22px;
  max-width: 56ch;
}

.hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 14px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fdfaf4;
  box-shadow: 0 10px 30px rgba(45, 74, 168, 0.2);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.65);
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.hero__note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.note__label {
  font-weight: 700;
  color: var(--accent);
}

.note__text {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.hero__visual {
  position: relative;
}

.doc-window {
  border: 1px solid rgba(31, 36, 51, 0.15);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-window__bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(45, 74, 168, 0.08), rgba(201, 91, 63, 0.08));
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot--red { background: #f25f5c; }
.dot--amber { background: #ffba3b; }
.dot--green { background: #3ecf8e; }

.doc-window__title {
  color: var(--text);
}

.doc-window__status {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.doc-window__toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(45, 74, 168, 0.06);
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.doc-window__ruler {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(45, 74, 168, 0.06);
}

.ruler__tick {
  height: 10px;
  background: rgba(31, 36, 51, 0.08);
  border-radius: 4px;
}

.ruler__tick--mark {
  height: 16px;
  background: rgba(45, 74, 168, 0.2);
}

.doc-window__page {
  padding: 22px 18px 26px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, rgba(31, 36, 51, 0.02), transparent);
  position: relative;
  min-height: 280px;
}

.page__line {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page__line--note {
  color: var(--accent);
  font-weight: 700;
}

.page__line--highlight {
  background: linear-gradient(120deg, rgba(45, 74, 168, 0.12), rgba(201, 91, 63, 0.12));
  padding: 6px 8px;
  border-radius: 10px;
}

.page__caret {
  width: 2px;
  height: 22px;
  background: var(--accent-2);
  position: absolute;
  bottom: 20px;
  left: 18px;
  animation: blink 1.2s steps(2) infinite;
}

.floating-card {
  position: absolute;
  bottom: -18px;
  right: -16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-width: 320px;
}

.floating-list {
  padding-left: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.subhero {
  padding: 72px clamp(18px, 4vw, 70px) 36px;
  background: linear-gradient(120deg, rgba(45, 74, 168, 0.08), rgba(201, 91, 63, 0.08));
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.subhero h1 {
  margin: 12px 0 8px;
  font-size: clamp(32px, 4.6vw, 50px);
}

.subhero .lede {
  max-width: 68ch;
}

.subhero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.article {
  padding: 14px clamp(18px, 4vw, 70px) 70px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.section {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}

.section__header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section__header h2 {
  font-size: clamp(22px, 3vw, 30px);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  align-items: start;
}

.longform p + p {
  margin-top: 10px;
}

.timeline-vertical {
  display: grid;
  gap: 12px;
}

.timeline-vertical__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  background: rgba(31, 36, 51, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.timeline {
  padding: 26px clamp(18px, 4vw, 70px) 50px;
}

.timeline__head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.timeline__note {
  max-width: 42ch;
}

.topics {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.topic {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  min-height: 180px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
  opacity: 0.85;
}

.topic::before {
  content: attr(data-era);
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: rgba(31, 36, 51, 0.16);
}

.topic:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(45, 74, 168, 0.18);
  opacity: 1;
}

.topic.visible {
  opacity: 1;
  transform: translateY(0);
}

.topic__label {
  display: inline-block;
  padding: 6px 10px;
  background: rgba(45, 74, 168, 0.08);
  border-radius: 10px;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--accent);
}

.topic__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(31, 36, 51, 0.06);
  border-radius: 999px;
  font-weight: 600;
  color: var(--text);
}

.chip--tone {
  background: rgba(201, 91, 63, 0.12);
  color: var(--accent-2);
}

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
}

.chip-link::after {
  content: "→";
  font-size: 16px;
  transition: transform 0.2s ease;
}

.topic:hover .chip-link::after {
  transform: translateX(4px);
}

.lab {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  padding: 60px clamp(18px, 4vw, 70px) 90px;
  align-items: start;
}

.lab__panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.lab__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0 12px;
}

.fact-card {
  background: rgba(31, 36, 51, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.fact-card .label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 6px;
}

.fact-card.highlight {
  background: linear-gradient(120deg, rgba(45, 74, 168, 0.08), rgba(201, 91, 63, 0.08));
  border-color: rgba(45, 74, 168, 0.2);
}

.toggle-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  display: none;
}

.slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(31, 36, 51, 0.12);
  border-radius: 20px;
  transition: background 0.2s ease;
  border: 1px solid var(--border);
}

.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(45, 74, 168, 0.25);
}

.switch input:checked + .slider {
  background: rgba(45, 74, 168, 0.16);
}

.switch input:checked + .slider::after {
  transform: translateX(18px);
}

.switch .label {
  color: var(--muted);
  font-weight: 700;
}

.lab__cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.lab__scene {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(45, 74, 168, 0.08), rgba(201, 91, 63, 0.08));
  box-shadow: var(--shadow);
}

.scene__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  color: var(--accent);
}

.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}

.timeline-list li {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.badge--year {
  background: rgba(45, 74, 168, 0.08);
  color: var(--accent);
}

.quote {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}

.quote__attr {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 500;
}

.play-card {
  background: linear-gradient(120deg, rgba(45, 74, 168, 0.08), rgba(201, 91, 63, 0.08));
}

.footer {
  padding: 24px clamp(18px, 4vw, 70px) 36px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
}

.footer__brand {
  font-weight: 700;
  color: var(--accent);
}

.footer__meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mono-mode .doc-window__page,
.mono-mode .page__line,
.mono-mode .note__text {
  font-family: "IBM Plex Mono", monospace;
}

@keyframes blink {
  0%, 60%, 100% { opacity: 1; }
  70% { opacity: 0; }
}

@media (max-width: 1000px) {
  .hero, .lab {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    order: -1;
  }
}

@media (max-width: 680px) {
  .hero, .timeline, .lab {
    padding-inline: 16px;
  }

  .doc-window__toolbar {
    flex-wrap: wrap;
  }

  .topics {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
