@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/newsreader-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 900;
  font-display: block;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 900;
  font-display: block;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f6f4ee;
  --card: #fcfbf8;
  --well: #ede8dd;
  --text: #0f172a;
  --muted: #3d3932;
  --subtle: #6b6457;
  --border: #d8d1c3;
  --hairline: #e5dfd2;
  --brand: #5856f5;
  --brand-ink: #4f46e5;
  --accent-icon: #5856f5;
  --logo-grad: linear-gradient(135deg, #2b9af3 0%, #5c5ef0 52%, #8c38ea 100%);
  --logo-grad-hover-80: linear-gradient(135deg, rgba(43, 154, 243, 0.8) 0%, rgba(92, 94, 240, 0.8) 52%, rgba(140, 56, 234, 0.8) 100%);
}

.dark {
  --bg: #020817;
  --card: #07132b;
  --well: #0b1938;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --subtle: #94a3b8;
  --border: #18305e;
  --hairline: #152a54;
  --brand: #7aa2f7;
  --brand-ink: #93c5fd;
  --accent-icon: #7aa2f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--brand-ink);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

em,
i {
  font-style: normal;
  font-weight: 600;
}

.dc-icon-accent {
  stroke: var(--accent-icon);
}

/* Sticky Architectural Masthead (1:1 with Layout.tsx & BrandLogo.tsx) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(252, 251, 248, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.dark .site-header {
  background-color: rgba(7, 19, 43, 0.95);
}

.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: 'Newsreader', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.025em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.85;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand span {
  position: relative;
  top: 3px;
  line-height: 1;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

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

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 3px;
  border: 1px solid transparent;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.main-nav a:hover {
  background-image: var(--logo-grad-hover-80);
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(92, 94, 240, 0.45);
  box-shadow: 0 2px 8px rgba(92, 94, 240, 0.14);
  text-decoration: none;
}

.main-nav a:hover .dc-icon-accent {
  stroke: currentColor;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background-color: var(--well);
  padding: 2px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.theme-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-opt:hover {
  background-image: var(--logo-grad-hover-80);
  color: #ffffff;
}

.theme-opt:hover .dc-icon-accent {
  stroke: currentColor;
}

.theme-opt[aria-pressed='true'] {
  background-color: #fcfbf8;
  background-image: none;
  color: #1d4ed8;
  border-color: rgba(216, 209, 195, 0.85);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.dark .theme-opt[aria-pressed='true'] {
  background-color: #152c58;
  color: #fcd34d;
  border-color: rgba(37, 99, 235, 0.5);
}

.theme-opt[aria-pressed='true'] .dc-icon-accent {
  stroke: currentColor;
}

/* Main Editorial Content Column (Matches MethodologyPage.tsx) */
main.legal-page {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  flex: 1;
}

.legal-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 3px;
  background-color: var(--card);
  border: 1px solid var(--border);
  box-shadow: 2px 2px 0px rgba(79, 92, 229, 0.22);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dark .back-link {
  box-shadow: 2px 2px 0px rgba(96, 165, 250, 0.28);
}

.back-link:hover {
  transform: translate(-1px, -1px);
  background-image: var(--logo-grad-hover-80);
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(92, 94, 240, 0.5);
  box-shadow: 0 2px 8px rgba(92, 94, 240, 0.16);
  text-decoration: none;
}

.back-link:hover .dc-icon-accent {
  stroke: currentColor;
}

.doc-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.doc-tabs a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background-color: var(--card);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.doc-tabs a:hover:not([aria-current='page']) {
  background-image: var(--logo-grad-hover-80);
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(92, 94, 240, 0.5);
  text-decoration: none;
}

.doc-tabs a[aria-current='page'] {
  background-color: var(--well);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 -2px 0 #2563eb;
}

/* Editorial Hero Card */
.legal-hero {
  position: relative;
  overflow: hidden;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 36px 32px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.legal-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--logo-grad);
}

.ledger-stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 2px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid #5856f5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 16px;
}

.dark .ledger-stamp {
  background-color: var(--well);
  border-left-color: #7aa2f7;
}

.legal-hero h1 {
  margin: 0 0 12px;
  font-family: 'Newsreader', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-lead {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--muted);
  max-width: 72ch;
}

/* Modular Clause Cards */
.legal-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legal-section {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 26px 32px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brand);
  background-color: var(--well);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 3px 7px;
  flex-shrink: 0;
}

.legal-section h2 {
  margin: 0;
  font-family: 'Newsreader', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
}

.legal-section p,
.legal-section li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.legal-section p {
  margin: 0 0 12px;
}

.legal-section p:last-child,
.legal-section ul:last-child {
  margin-bottom: 0;
}

.legal-section ul {
  padding-left: 20px;
  margin: 8px 0 12px;
}

.legal-section li {
  margin-bottom: 8px;
}

.legal-section li:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--text);
  font-weight: 600;
}

code {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  background-color: var(--well);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1px 6px;
  color: var(--text);
}

/* Full-Bleed Footer (1:1 with Layout.tsx) */
.site-footer {
  background-color: var(--card);
  border-top: 1px solid var(--border);
  padding: 32px 16px;
  margin-top: auto;
  text-align: center;
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.footer-links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  font-size: 13.5px;
  color: var(--subtle);
}

.footer-links a {
  color: var(--muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--brand);
}

.footer-links a[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
}

.footer-powered {
  margin: 12px 0 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--subtle);
}

.footer-powered a {
  color: var(--brand-ink);
  font-weight: 700;
}

@media (max-width: 639px) {
  .site-header-inner {
    padding: 10px 14px;
    min-height: 58px;
  }

  .brand {
    font-size: 18px;
    gap: 6px;
  }

  .brand img {
    width: 28px;
    height: 28px;
  }

  .brand span {
    top: 1.5px;
  }

  main.legal-page {
    padding: 20px 14px 48px;
  }

  .legal-hero {
    padding: 26px 20px 24px;
  }

  .legal-hero h1 {
    font-size: 29px;
  }

  .legal-section {
    padding: 22px 18px;
  }
}
