:root {
  --bg-canvas: #3b0d1a;
  --bg-surface: #541c2b;
  --bg-surface-hover: #692437;
  --text-primary: #fff8ed;
  --text-muted: #d6c5b3;
  --accent-primary: #e8d5a8;
  --accent-secondary: #c9a769;
  --border-subtle: rgba(232, 213, 168, 0.28);
  --ease-kinetic: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-elevation: 0 14px 34px -6px rgba(18, 3, 7, 0.55);
  --glow-accent: 0 0 24px -6px rgba(232, 213, 168, 0.35);
  --radius-card: 20px;
}

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

html, body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.68;
  font-size: 16px;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-font-smoothing: antialiased;
}

.page-frame {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  margin: 28px 40px;
  min-height: calc(100vh - 56px);
  position: relative;
  background: radial-gradient(circle at 85% 10%, rgba(105, 36, 55, 0.35), transparent 55%), var(--bg-canvas);
}

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.1rem, 4.5vw, 3.6rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 0.85rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.6rem; color: var(--accent-primary); }

p { margin-bottom: 1.15rem; color: var(--text-primary); }
.prose p, .prose li { max-width: 70ch; }
.text-muted { color: var(--text-muted); font-size: 0.93rem; }

a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.85; }

/* Header Capsule (Static/Relative in normal flow, Left-aligned brand) */
.site-header {
  position: relative;
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 0 20px;
  z-index: 30;
}

.header-capsule {
  background: var(--bg-surface);
  border-radius: 999px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-elevation);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-canvas);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  transition: background-color 0.25s var(--ease-kinetic), color 0.25s var(--ease-kinetic);
}

.main-nav a:hover, .main-nav a[aria-current="page"] {
  background: var(--accent-primary);
  color: var(--bg-canvas);
  opacity: 1;
}

.menu-dots-btn {
  display: none;
  background: var(--bg-surface-hover);
  color: var(--accent-primary);
  border: none;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-dropdown {
  display: none;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  margin-top: 10px;
  padding: 16px;
  box-shadow: var(--shadow-elevation);
}

.mobile-dropdown.open {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-dropdown a {
  text-decoration: none;
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.mobile-dropdown a:hover {
  background: var(--bg-surface-hover);
}

/* Hero Section */
.hero-full {
  position: relative;
  min-height: 76vh;
  margin: 24px 24px 48px;
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  box-shadow: var(--shadow-elevation);
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(59, 13, 26, 0.72) 0%, rgba(59, 13, 26, 0.92) 65%, #3b0d1a 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 780px;
}

.eyebrow {
  display: inline-block;
  background: rgba(232, 213, 168, 0.14);
  color: var(--accent-primary);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-primary);
  color: #3b0d1a;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-elevation);
  transition: transform 0.3s var(--ease-kinetic), box-shadow 0.3s var(--ease-kinetic);
}

.btn-pill:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: var(--shadow-elevation), var(--glow-accent);
  color: #3b0d1a;
  opacity: 1;
}

.btn-secondary {
  background: var(--bg-surface-hover);
  color: var(--accent-primary);
}
.btn-secondary:hover {
  color: var(--accent-primary);
}

/* Main Container & Connected Workflow Spine */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.workflow-stream {
  position: relative;
  padding-left: 44px;
}

.workflow-stream::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 15px;
  width: 1px;
  background: var(--accent-primary);
  opacity: 0.45;
}

.workflow-section {
  position: relative;
  margin-bottom: 64px;
}

.step-badge {
  position: absolute;
  left: -44px;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-canvas);
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-accent);
}

/* Cards & Grids */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 26px;
  box-shadow: var(--shadow-elevation);
  transition: transform 0.35s var(--ease-kinetic), background-color 0.35s var(--ease-kinetic), box-shadow 0.35s var(--ease-kinetic);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:hover {
  transform: translateY(-5px) scale(1.01);
  background: var(--bg-surface-hover);
  box-shadow: var(--shadow-elevation), var(--glow-accent);
}

.card-img-wrap {
  width: 100%;
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 18px;
  background: #2c0913;
}

.aspect-16-9 { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-card);
}

.meta-tag {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent-primary);
  background: rgba(59, 13, 26, 0.55);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
  font-weight: 700;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-elevation);
  margin: 24px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  text-align: left;
}

th, td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(232, 213, 168, 0.14);
  font-size: 0.93rem;
}

th {
  color: var(--accent-primary);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Details / Terminology Disclosures */
details.disclosure {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 18px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-elevation);
}

details.disclosure summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--accent-primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

details.disclosure summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent-primary);
}

details.disclosure[open] summary::after {
  content: "−";
}

details.disclosure .disclosure-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(232, 213, 168, 0.15);
}

/* Page Banner for Topic Pages */
.page-hero {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 40px 32px;
  margin: 28px 0 40px;
  box-shadow: var(--shadow-elevation);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
}

/* Interactive Tool & Forms */
.interactive-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-elevation);
  margin: 28px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-primary);
}

input, select, textarea {
  background: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 15px;
  font-family: inherit;
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-primary);
  border-color: transparent;
}

.output-box {
  background: #280811;
  border-radius: 16px;
  padding: 18px;
  font-family: monospace;
  white-space: pre-wrap;
  color: var(--accent-primary);
  margin: 16px 0;
  font-size: 0.88rem;
}

/* Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s var(--ease-kinetic), transform 0.65s var(--ease-kinetic);
}
.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  margin: 40px 24px 24px;
  padding: 36px 28px;
  box-shadow: var(--shadow-elevation);
}

.footer-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-bottom {
  max-width: 1120px;
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(232, 213, 168, 0.15);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 860px) {
  .page-hero { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .page-frame { margin: 12px; }
  .main-nav { display: none; }
  .menu-dots-btn { display: inline-flex; }
  .hero-full { margin: 16px 12px 32px; min-height: 62vh; }
  .workflow-stream { padding-left: 34px; }
  .step-badge { left: -34px; width: 26px; height: 26px; font-size: 0.75rem; }
  .workflow-stream::before { left: 12px; }
}

@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
