:root {
  --parchment: #f5f4ed;
  --ivory: #faf9f5;
  --sand: #e8e6dc;
  --warm-panel: #eee6d9;
  --warm-panel-strong: #e7ddce;
  --warm-card: #f8f2e8;
  --border-cream: #f0eee6;
  --near-black: #141413;
  --dark-surface: #30302e;
  --olive-gray: #5e5d59;
  --stone-gray: #87867f;
  --warm-silver: #b0aea5;
  --charcoal: #4d4c48;
  --terracotta: #c96442;
  --coral: #d97757;
  --muted-green: #71806a;
  --ring: #d1cfc5;
  --shadow-whisper: rgba(0, 0, 0, 0.05) 0 4px 24px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--parchment);
  color: var(--near-black);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

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

p,
li {
  color: inherit;
  font-size: 1rem;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.12;
}

button,
.button,
.language-chip,
.toc-link,
summary {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(240, 238, 230, 0.92);
  background: rgba(245, 244, 237, 0.9);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.brand-block {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  letter-spacing: 0.02em;
}

.brand-block p {
  margin: 0;
  color: var(--olive-gray);
  font-size: 0.88rem;
  line-height: 1.4;
  max-width: 34ch;
}

.language-switcher {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.language-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.85rem;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid var(--border-cream);
  background: var(--ivory);
  box-shadow: 0 0 0 1px transparent;
  color: var(--charcoal);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.language-chip:hover,
.toc-link:hover,
.button:hover,
summary:hover {
  transform: translateY(-1px);
}

.language-chip.is-current {
  background: var(--terracotta);
  color: var(--ivory);
  border-color: var(--terracotta);
  box-shadow: 0 0 0 1px var(--terracotta);
}

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 2.5rem;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 1.5rem;
}

.hero-panel::before,
.hero-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.18;
}

.hero-panel::before {
  width: 180px;
  height: 180px;
  right: 6%;
  top: -22px;
  background: var(--terracotta);
}

.hero-panel::after {
  width: 120px;
  height: 120px;
  left: -18px;
  bottom: 12%;
  background: var(--muted-green);
}

.hero-copy,
.hero-stats {
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-xl);
  background: var(--ivory);
  box-shadow: var(--shadow-whisper);
}

.hero-copy {
  padding: 2.25rem;
}

.hero-copy h1 {
  margin-top: 0.5rem;
  font-size: clamp(2.8rem, 5vw, 4rem);
}

.hero-lede {
  margin: 1.25rem 0 0;
  color: var(--olive-gray);
  font-size: clamp(1.08rem, 2vw, 1.24rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px var(--ring);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button-primary {
  background: var(--terracotta);
  color: var(--ivory);
  box-shadow: 0 0 0 1px var(--terracotta);
}

.button-secondary {
  background: var(--sand);
  color: var(--charcoal);
}

.hero-summary {
  margin: 1.75rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.75rem;
}

.hero-note {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-cream);
  color: var(--stone-gray);
}

.hero-stats {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--warm-panel);
  border-color: rgba(77, 76, 72, 0.12);
  color: var(--near-black);
}

.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(77, 76, 72, 0.12);
  background: rgba(250, 249, 245, 0.85);
}

.stat-label {
  margin: 0;
  color: var(--stone-gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.stat-card h2 {
  margin-top: 0.55rem;
  color: var(--near-black);
  font-size: 2rem;
}

.stat-card p:last-child {
  margin: 0.7rem 0 0;
}

.hero-ad-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.hero-ad-slot {
  min-height: 90px;
  padding: 1rem;
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  background: var(--ivory);
  box-shadow: var(--shadow-whisper);
  overflow: hidden;
}

.content-shell {
  display: grid;
  grid-template-columns: minmax(260px, 290px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.toc-panel {
  position: sticky;
  top: 6rem;
  align-self: start;
}

.toc-card {
  position: static;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-cream);
  background: var(--ivory);
  box-shadow: 0 0 0 1px var(--ring);
  max-height: calc(100vh - 7rem);
  overflow: auto;
}

.overline,
.chapter-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stone-gray);
  font-size: 0.72rem;
}

.toc-card h2,
.site-footer h2 {
  margin-top: 0.6rem;
  font-size: 1.8rem;
}

.toc-text {
  margin-top: 0.8rem;
  color: var(--olive-gray);
}

.toc-links {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.65rem;
}

.toc-link {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border-cream);
  background: var(--parchment);
  transition: transform 0.2s ease, background 0.2s ease;
}

.toc-link.is-active {
  background: var(--sand);
  border-color: rgba(201, 100, 66, 0.35);
  box-shadow: 0 0 0 1px rgba(201, 100, 66, 0.2);
}

.toc-link.is-active strong {
  color: var(--near-black);
}

.toc-link span {
  color: var(--stone-gray);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toc-link strong {
  font-size: 0.95rem;
}

.chapter-stack {
  display: grid;
  gap: 1.5rem;
}

.chapter {
  scroll-margin-top: 6.5rem;
  padding: 2rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-cream);
  box-shadow: var(--shadow-whisper);
}

.theme-light {
  background: var(--ivory);
  color: var(--near-black);
}

.theme-dark {
  background: var(--warm-panel);
  border-color: rgba(77, 76, 72, 0.12);
  color: var(--near-black);
}

.theme-dark .chapter-label,
.theme-dark .overline,
.theme-dark .toc-link span {
  color: var(--stone-gray);
}

.theme-dark .block-title,
.theme-dark .callout h3,
.theme-dark h2,
.theme-dark h3,
.theme-dark h4,
.theme-dark strong,
.theme-dark summary {
  color: var(--near-black);
}

.theme-dark .info-card,
.theme-dark .callout,
.theme-dark .faq-item {
  background: rgba(250, 249, 245, 0.74);
  border-color: rgba(77, 76, 72, 0.12);
}

.chapter-heading {
  display: grid;
  gap: 0.45rem;
}

.chapter-heading h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.chapter-copy {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.chapter-copy p {
  margin: 0;
  color: inherit;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.info-card,
.callout,
.glossary-card,
.faq-item {
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.44);
}

.info-card,
.glossary-card {
  padding: 1.25rem;
}

.info-card h3,
.glossary-card h3,
.callout h3 {
  font-size: 1.35rem;
}

.info-card p,
.glossary-card p,
.callout p {
  margin: 0.7rem 0 0;
}

.content-block {
  margin-top: 1.5rem;
}

.block-title {
  font-size: 1.35rem;
  margin-bottom: 0.9rem;
}

.bullet-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.8rem;
}

.step-list {
  display: grid;
  gap: 0.9rem;
}

.step-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.38);
}

.theme-dark .step-item {
  border-color: rgba(77, 76, 72, 0.12);
  background: rgba(250, 249, 245, 0.74);
}

.step-index {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--charcoal);
  font-weight: 700;
}

.step-copy h4 {
  font-size: 1.1rem;
}

.step-copy p {
  margin: 0.5rem 0 0;
}

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

.theme-dark .table-wrap,
.theme-dark .data-table th,
.theme-dark .data-table td {
  border-color: rgba(77, 76, 72, 0.12);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-cream);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: rgba(232, 230, 220, 0.6);
  font-size: 0.92rem;
}

.theme-dark .data-table th {
  background: rgba(231, 221, 206, 0.9);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.callout {
  margin-top: 1.5rem;
  padding: 1.25rem;
  box-shadow: 0 0 0 1px var(--ring);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.faq-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.faq-item {
  padding: 1rem 1.1rem;
}

summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
}

summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin: 0.85rem 0 0;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.site-footer-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 2rem;
  padding: 2rem;
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-xl);
  background: var(--ivory);
  box-shadow: var(--shadow-whisper);
}

.footer-copy {
  display: grid;
  gap: 1rem;
}

.footer-copy p {
  margin: 0;
  color: var(--olive-gray);
}

.footer-legal {
  grid-column: 1 / -1;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-cream);
  display: grid;
  gap: 0.45rem;
}

.footer-legal p {
  margin: 0;
  color: var(--stone-gray);
  font-size: 0.92rem;
}

.noscript-message {
  max-width: 720px;
  margin: 2rem auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-md);
  background: var(--ivory);
}

@media (max-width: 991px) {
  .hero-panel,
  .content-shell,
  .site-footer-card {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    position: static;
  }

  .toc-card {
    max-height: none;
  }
}

@media (max-width: 767px) {
  .topbar {
    align-items: start;
    flex-direction: column;
    gap: 1rem;
    padding: 0.9rem 1rem;
  }

  .brand-block p {
    max-width: none;
  }

  .language-switcher {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
  }

  .hero {
    padding: 2rem 1rem 1.5rem;
  }

  .hero-panel::before,
  .hero-panel::after {
    display: none;
  }

  .content-shell {
    gap: 1rem;
    padding: 0 1rem 2.75rem;
  }

  .hero-ad-shell {
    padding: 0 1rem 1.5rem;
  }

  .hero-copy,
  .chapter,
  .toc-card {
    padding: 1.1rem;
    border-radius: 24px;
  }

  .card-grid,
  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: clamp(2.2rem, 10vw, 2.9rem);
  }

  .hero-lede {
    font-size: 1rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .hero-summary {
    margin-top: 1.25rem;
    gap: 0.65rem;
    padding-left: 1rem;
  }

  .hero-stats,
  .stat-card {
    padding: 1rem;
  }

  .toc-links {
    gap: 0.5rem;
  }

  .toc-link {
    padding: 0.75rem 0.8rem;
  }

  .chapter {
    scroll-margin-top: 5.5rem;
  }

  .chapter-heading h2 {
    font-size: clamp(1.7rem, 8vw, 2.2rem);
  }

  .chapter-copy {
    gap: 0.85rem;
  }

  .step-item {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 0.8rem;
    padding: 0.9rem;
  }

  .step-index {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  .table-wrap {
    margin-left: -0.1rem;
    margin-right: -0.1rem;
  }

  .data-table {
    min-width: 520px;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 0.8rem;
  }

  .site-footer {
    padding-bottom: 3rem;
  }

  .site-footer-card {
    padding: 1.25rem;
  }
}

@media (max-width: 479px) {
  .hero {
    padding-top: 1.5rem;
  }

  .hero-copy,
  .chapter,
  .toc-card,
  .hero-ad-slot,
  .site-footer-card {
    padding: 1rem;
  }

  .brand-mark {
    font-size: 1.2rem;
  }

  .chapter-heading h2 {
    font-size: 1.55rem;
  }

  .hero-copy h1 {
    font-size: 2rem;
  }
}
