:root {
  --paper: #f4efe4;
  --paper-strong: #f9f5eb;
  --ink: #161a1d;
  --ink-soft: #4c545b;
  --line: #c9bda8;
  --line-strong: #a8977d;
  --accent: #0d4c6a;
  --accent-soft: #dceaf0;
  --alert: #8f2c1f;
  --alert-soft: #f4ddd7;
  --focus: #c8781e;
  --max: 1160px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 8%, rgba(13, 76, 106, 0.12), transparent 28%),
    radial-gradient(circle at 94% 88%, rgba(143, 44, 31, 0.12), transparent 32%),
    linear-gradient(155deg, #ece6d9 0%, var(--paper) 35%, #e4ddce 100%);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
}

.site-shell {
  width: min(var(--max), 94vw);
  margin: 1.4rem auto 2rem;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(249, 245, 235, 0.88);
  box-shadow: 0 18px 50px rgba(18, 27, 38, 0.16);
  backdrop-filter: blur(3px);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
  padding: 1.25rem 1.4rem 1rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
}

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

.tagline {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 650;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  border: 1px solid transparent;
}

.site-nav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.site-nav a[aria-current="page"] {
  background: var(--accent-soft);
  border-color: rgba(13, 76, 106, 0.35);
  color: #08344a;
}

.theme-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  padding: 0.38rem 0.74rem 0.38rem 0.55rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.78rem;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(220, 234, 240, 0.8);
}

.theme-toggle-dot {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffeeb7, #f0b64d 58%, #b87b2c 100%);
  box-shadow: 0 0 0 0 rgba(240, 182, 77, 0.45);
  animation: pulse-dot 2.3s ease-out infinite;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-dot {
  background: radial-gradient(circle at 32% 30%, #cce7ff, #7eaed7 62%, #3f6792 100%);
  box-shadow: 0 0 0 0 rgba(126, 174, 215, 0.42);
}

.notice {
  margin: 1rem 1.4rem 0;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(143, 44, 31, 0.3);
  border-left-width: 5px;
  border-left-color: var(--alert);
  background: var(--alert-soft);
  color: #552219;
}

.content {
  padding: 1rem 1.4rem 1.5rem;
  display: grid;
  gap: 1rem;
}

.hero {
  padding: 1.1rem 1.1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-strong);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.79rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0.25rem 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 0.95;
  max-width: 13ch;
}

.hero p {
  margin: 0.8rem 0 0;
  max-width: 72ch;
  color: var(--ink-soft);
  line-height: 1.65;
}

.stats {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcf9f1;
  padding: 0.75rem 0.8rem;
}

.stat-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
}

.stat-value {
  margin: 0.35rem 0 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 1.16rem;
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfaf4;
  padding: 1rem;
}

.card h2,
.card h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.65rem;
}

.card p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.update-banner {
  border: 1px solid rgba(13, 76, 106, 0.35);
  border-radius: 14px;
  background:
    linear-gradient(115deg, rgba(13, 76, 106, 0.1), rgba(255, 255, 255, 0.9) 42%),
    #fdfbf5;
  padding: 0.95rem 1rem;
}

.update-banner h2 {
  margin: 0.2rem 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.45rem, 4.3vw, 2.2rem);
  line-height: 1;
}

.update-banner p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
}

.stamp-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.stamp-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.34rem 0.68rem;
  border: 1px solid rgba(13, 76, 106, 0.45);
  background: rgba(13, 76, 106, 0.1);
  color: #08344a;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.83rem;
}

.stamp-pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #0d4c6a;
  box-shadow: 0 0 0 0 rgba(13, 76, 106, 0.45);
  animation: pulse-dot 2.3s ease-out infinite;
}

.stamp-note {
  font-size: 0.83rem;
  color: #4b5f6b;
}

@keyframes pulse-dot {
  70% {
    box-shadow: 0 0 0 8px rgba(13, 76, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 76, 106, 0);
  }
}

.tree-box {
  margin: 0.8rem 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf7;
  padding: 0.9rem;
  overflow-x: auto;
}

.tree-box pre {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #1f2b35;
}

.alert-card {
  border-color: rgba(143, 44, 31, 0.35);
  background: #fcf3ef;
}

.subhead {
  margin: 1.1rem 0 0.35rem;
  font-size: 1.18rem;
  font-family: "Cormorant Garamond", Georgia, serif;
}

.compact-list {
  margin: 0.3rem 0 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.compact-list li {
  margin-bottom: 0.42rem;
  line-height: 1.45;
}

.col-8 {
  grid-column: span 8;
}

.col-7 {
  grid-column: span 7;
}

.col-6 {
  grid-column: span 6;
}

.col-5 {
  grid-column: span 5;
}

.col-4 {
  grid-column: span 4;
}

.kicker-list,
.timeline,
.doc-list {
  margin: 0.8rem 0 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.kicker-list li,
.timeline li,
.doc-list li {
  margin-bottom: 0.55rem;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  background: #fffdfa;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #e0d8c9;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #2e3a43;
  background: #efe8da;
}

td code {
  font-size: 0.88rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.17em;
}

a:focus,
button:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-footer {
  padding: 1rem 1.4rem 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--ink-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.26rem 0.62rem;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.84rem;
}

body[data-theme="dark"] {
  --paper: #111a27;
  --paper-strong: #182233;
  --ink: #e7eef8;
  --ink-soft: #a7b8ce;
  --line: #314359;
  --line-strong: #4b627f;
  --accent: #8dc4e5;
  --accent-soft: #1f334b;
  --alert: #d7927e;
  --alert-soft: #352624;
  --focus: #f2c66a;
  background:
    radial-gradient(circle at 8% 10%, rgba(141, 196, 229, 0.2), transparent 30%),
    radial-gradient(circle at 90% 88%, rgba(215, 146, 126, 0.18), transparent 34%),
    linear-gradient(160deg, #0a111b 0%, #0f1724 48%, #121b2a 100%);
}

body[data-theme="dark"] .site-shell {
  background: rgba(14, 22, 34, 0.9);
  box-shadow: 0 20px 60px rgba(4, 8, 14, 0.62);
}

body[data-theme="dark"] .site-nav a:hover {
  background: rgba(141, 196, 229, 0.14);
}

body[data-theme="dark"] .site-nav a[aria-current="page"] {
  border-color: rgba(141, 196, 229, 0.45);
  color: #dcf1ff;
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(19, 32, 48, 0.92);
  border-color: #4b627f;
  color: #dceeff;
}

body[data-theme="dark"] .theme-toggle:hover {
  background: rgba(31, 51, 75, 0.95);
  border-color: #8dc4e5;
}

body[data-theme="dark"] .notice {
  color: #f3d3cb;
  border-color: rgba(215, 146, 126, 0.48);
}

body[data-theme="dark"] .stat {
  background: #172436;
}

body[data-theme="dark"] .card {
  background: #141f30;
}

body[data-theme="dark"] .update-banner {
  border-color: rgba(141, 196, 229, 0.45);
  background:
    linear-gradient(115deg, rgba(141, 196, 229, 0.18), rgba(18, 30, 45, 0.92) 48%),
    #142132;
}

body[data-theme="dark"] .stamp-pill {
  border-color: rgba(141, 196, 229, 0.54);
  background: rgba(141, 196, 229, 0.14);
  color: #d7eefe;
}

body[data-theme="dark"] .stamp-note {
  color: #9eb2ca;
}

body[data-theme="dark"] .tree-box {
  background: #0f1928;
}

body[data-theme="dark"] .tree-box pre {
  color: #d6e8fc;
}

body[data-theme="dark"] .alert-card {
  background: #322625;
  border-color: rgba(215, 146, 126, 0.5);
}

body[data-theme="dark"] table {
  background: #101b2b;
}

body[data-theme="dark"] th {
  color: #d4e3f6;
  background: #1c2d43;
}

body[data-theme="dark"] td,
body[data-theme="dark"] th {
  border-bottom: 1px solid #2f435c;
}

body[data-theme="dark"] .badge {
  background: rgba(141, 196, 229, 0.11);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal-up 700ms ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 950px) {
  .nav-cluster {
    width: 100%;
    justify-content: space-between;
  }

  .col-8,
  .col-7,
  .col-6,
  .col-5,
  .col-4 {
    grid-column: span 12;
  }

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-shell {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .site-nav,
  .badge,
  .theme-toggle {
    display: none;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
