:root {
  /* Pitch black */
  --black: #000000;

  /* Hairlines */
  --rule-faint: #161616;
  --rule: #1f1f1f;
  --rule-strong: #2b2b2b;

  /* White / greys */
  --white: #ffffff;
  --grey-100: #e4e4e4;
  --grey-200: #c4c4c4;
  --grey-300: #a2a2a2;
  --grey-400: #7d7d7d;
  --grey-500: #5e5e5e;

  /* Dark purple accents */
  --purple-tint: #100819;
  --purple-tint-2: #170c24;
  --purple: #3d1c5c;
  --purple-mid: #4c2374;
  --purple-lift: #632f96;
  --purple-hover: #7d43b8;

  --font-display: 'Cabinet Grotesk', sans-serif;
  --font-body: 'Satoshi', sans-serif;

  --text-sm: clamp(0.875rem, 0.8rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);

  --space-3: 0.75rem;

  --page: 1320px;
  --rail: 220px;
  --measure: 820px;
  --gutter: 80px;

  --transition-interactive: 160ms ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 104px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
}

a {
  color: var(--white);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--purple-lift);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-interactive);
}

a:hover {
  text-decoration-color: var(--purple-hover);
}

::selection {
  background: var(--purple);
  color: var(--white);
}

:focus-visible {
  outline: 2px solid var(--purple-lift);
  outline-offset: 3px;
  border-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Shared page grid ===== */
.rail-grid {
  display: grid;
  max-width: var(--page);
  margin: 0 auto;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  justify-content: space-between;
  gap: var(--gutter);
}

/* ===== Header ===== */
.header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--rule);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: stretch;
  gap: 24px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  padding: 17px 0;
}

.brand-logo {
  width: 26px;
  height: 26px;
}

.brand-name {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-divider {
  width: 1px;
  height: 14px;
  background: var(--rule-strong);
}

.brand-context {
  color: var(--grey-400);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tab-toggle {
  display: flex;
  margin-left: auto;
  gap: 26px;
}

.tab-btn {
  position: relative;
  padding: 0 1px;
  color: var(--grey-400);
  background: transparent;
  border: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition-interactive);
}

.tab-btn::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: '';
  background: transparent;
}

.tab-btn:hover {
  color: var(--grey-100);
}

.tab-btn.active {
  color: var(--white);
}

.tab-btn.active::after {
  background: var(--purple-mid);
}

/* ===== Masthead ===== */
.masthead {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(60px, 7vw, 92px) 32px clamp(48px, 5vw, 64px);
}

.masthead-eyebrow {
  margin-bottom: 22px;
  color: var(--grey-400);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.masthead h1 {
  max-width: 20ch;
  margin-bottom: 22px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.028em;
}

.masthead-lede {
  max-width: 56ch;
  color: var(--grey-200);
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  line-height: 1.6;
}

.masthead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 56px;
  margin-top: clamp(40px, 4vw, 56px);
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.masthead-meta > div {
  min-width: 0;
}

.masthead-meta dt {
  margin-bottom: 6px;
  color: var(--grey-500);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.masthead-meta dd {
  color: var(--grey-100);
  font-size: 0.9375rem;
}

/* ===== Summary ===== */
.summary {
  align-items: start;
  padding: clamp(40px, 4vw, 52px) 32px clamp(44px, 4.5vw, 60px);
  border-top: 2px solid var(--purple-mid);
  border-bottom: 1px solid var(--rule);
}

.summary-label {
  color: var(--grey-500);
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 56px;
}

.summary-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--rule-faint);
}

.summary-list > .summary-row:nth-child(-n + 2) {
  border-top: 0;
  padding-top: 0;
}

.summary-row dt {
  color: var(--white);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  line-height: 1.9;
}

.summary-row dd {
  color: var(--grey-300);
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ===== Document ===== */
.doc-wrapper {
  align-items: start;
  padding: clamp(64px, 7vw, 96px) 32px;
}

.toc {
  position: sticky;
  top: 104px;
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
}

.toc-label {
  padding-bottom: 14px;
  margin-bottom: 8px;
  color: var(--grey-500);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toc-list {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.toc-item a {
  display: block;
  padding: 9px 0;
  color: var(--grey-400);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: color var(--transition-interactive);
}

.toc-item a:hover {
  color: var(--white);
}

.toc-item a.active {
  padding-left: 12px;
  color: var(--white);
  border-left: 2px solid var(--purple-mid);
}

.toc-mobile-toggle {
  display: none;
}

.doc-panel {
  display: none;
}

.doc-panel.active {
  display: block;
}

.doc-content {
  max-width: var(--measure);
}

.doc-intro {
  padding: 4px 0 4px 26px;
  margin-bottom: 60px;
  border-left: 2px solid var(--purple);
}

.doc-intro p {
  color: var(--grey-100);
}

.doc-intro p:last-child {
  margin-bottom: 0;
}

.doc-section {
  padding-top: 12px;
  margin-bottom: 60px;
  border-top: 1px solid var(--rule);
}

.doc-section h2 {
  margin: 20px 0 22px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.16;
}

.doc-section h3 {
  margin-top: 34px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.0625rem;
}

.doc-section p,
.doc-section li {
  color: var(--grey-200);
}

.doc-section p {
  max-width: 72ch;
  margin-bottom: 14px;
  line-height: 1.75;
}

.doc-section ul,
.doc-section ol {
  margin: 14px 0 22px;
  padding-left: 24px;
}

.doc-section li {
  max-width: 72ch;
  margin-bottom: 9px;
  line-height: 1.7;
}

.doc-section strong {
  color: var(--white);
}

.doc-section ul li::marker {
  color: var(--purple-lift);
}

.callout {
  padding: 18px 22px;
  color: var(--grey-100);
  background: var(--purple-tint);
  border-left: 2px solid var(--purple-mid);
}

.callout strong {
  color: var(--white);
}

.doc-table {
  width: 100%;
  margin: 22px 0;
  border-collapse: collapse;
  border: 1px solid var(--rule-strong);
  font-size: var(--text-sm);
}

.doc-table th,
.doc-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.doc-table th {
  color: var(--white);
  background: var(--purple-tint-2);
  font-family: var(--font-display);
  font-weight: 700;
}

.doc-table td {
  color: var(--grey-200);
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

/* ===== Footer ===== */
.footer {
  padding: 48px 32px 56px;
  border-top: 1px solid var(--rule);
}

.footer-inner {
  align-items: start;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.footer-logo {
  width: 24px;
  height: 24px;
}

.footer-brand span {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.footer p {
  color: var(--grey-400);
  font-size: 0.875rem;
}

.footer p + p {
  margin-top: 6px;
}

.footer p.footer-legal {
  color: var(--grey-500);
}

.scroll-progress {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--purple-mid);
  transition: width 100ms linear;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .rail-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .summary-list {
    grid-template-columns: 1fr;
  }

  .summary-list > .summary-row:nth-child(2) {
    border-top: 1px solid var(--rule-faint);
    padding-top: 15px;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .toc-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    color: var(--white);
    background: transparent;
    border: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
  }

  .toc-mobile-toggle .chevron {
    transition: transform var(--transition-interactive);
  }

  .toc-mobile-toggle.open .chevron {
    transform: rotate(180deg);
  }

  .toc-content {
    display: none;
    padding: 10px 0 18px;
  }

  .toc-content.open {
    display: block;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 84px;
  }

  .header-inner {
    padding: 0 20px;
    gap: 0;
    flex-wrap: wrap;
  }

  .brand {
    padding: 14px 0 12px;
  }

  .brand-name {
    font-size: 0.75rem;
  }

  .brand-divider,
  .brand-context {
    display: none;
  }

  .tab-toggle {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 22px;
    border-top: 1px solid var(--rule-faint);
  }

  .tab-btn {
    padding: 12px 0;
    font-size: 0.6875rem;
  }

  .masthead {
    padding: 52px 20px 40px;
  }

  .masthead h1 {
    font-size: clamp(2.25rem, 11vw, 3rem);
  }

  .masthead-meta {
    gap: 18px 32px;
  }

  .summary,
  .doc-wrapper {
    padding-left: 20px;
    padding-right: 20px;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .summary-row dt {
    line-height: 1.6;
  }

  .doc-intro {
    padding-left: 18px;
  }

  .doc-section {
    margin-bottom: 48px;
  }

  .footer {
    padding: 36px 20px 44px;
  }

  .footer-brand {
    margin-bottom: 16px;
  }
}
