:root {
  --bg-50: 0.98 0.004 75;
  --bg-100: 0.96 0.006 75;
  --bg-200: 0.93 0.008 75;
  --bg-300: 0.89 0.01 75;
  --bg-400: 0.82 0.011 75;
  --fg-400: 0.66 0.01 70;
  --fg-500: 0.55 0.012 68;
  --fg-600: 0.45 0.013 66;
  --fg-700: 0.36 0.014 64;
  --fg-800: 0.29 0.014 62;
  --fg-900: 0.23 0.013 60;
  --fg-950: 0.18 0.012 58;
  --pr-500: 0.33 0.014 50;
  --pr-600: 0.285 0.013 50;
  --pr-100: 0.915 0.008 58;
  --pr-200: 0.855 0.011 56;
  --pr-700: 0.24 0.012 50;
  --pr-800: 0.2 0.011 50;
  --ac-50: 0.965 0.01 268;
  --ac-100: 0.925 0.02 268;
  --ac-200: 0.87 0.032 268;
  --ac-400: 0.62 0.058 268;
  --ac-500: 0.47 0.062 268;
  --ac-600: 0.41 0.058 268;
  --ac-700: 0.35 0.05 268;
  --ac-900: 0.235 0.034 268;
  --se-100: 0.935 0.018 140;
  --se-200: 0.89 0.026 140;
  --se-900: 0.315 0.022 142;
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --nav-h: 68px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: oklch(var(--bg-50));
  color: oklch(var(--fg-900));
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: oklch(var(--fg-950));
  margin: 0;
}

a {
  color: oklch(var(--ac-700));
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: oklch(var(--ac-900));
}

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

:focus-visible {
  outline: 2px solid oklch(var(--ac-400));
  outline-offset: 3px;
  border-radius: 4px;
}

[id] {
  scroll-margin-top: calc(var(--nav-h) + 22px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: #fff;
  color: oklch(var(--fg-950));
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 10px;
}

/* ---------- navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  background: rgba(12, 17, 25, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px -22px rgba(0, 0, 0, 0.9);
}

@supports not ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .site-header {
    background: rgba(12, 17, 25, 0.98);
  }
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav-a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.nav-a:hover,
.nav-a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-a[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-dd {
  position: relative;
}

.dd-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 520px;
  max-width: calc(100vw - 32px);
  background: rgba(12, 17, 25, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.85);
}

.dd-panel[hidden] {
  display: none;
}

.dd-title {
  margin: 2px 8px 8px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.dd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.dd-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
}

.dd-link i {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
}

.dd-link:hover,
.dd-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #11161f;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.nav-cta:hover {
  background: rgba(255, 255, 255, 0.86);
  color: #11161f;
}

/* ---------- layout ---------- */
.page-main {
  padding-top: var(--nav-h);
  padding-bottom: 72px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 22px 0 0;
  font-size: 12px;
  color: oklch(var(--fg-500));
}

.crumbs a {
  color: oklch(var(--fg-600));
  text-decoration: none;
}

.crumbs a:hover {
  color: oklch(var(--ac-700));
  text-decoration: underline;
}

.crumbs span[aria-current] {
  color: oklch(var(--fg-500));
}

.article-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: oklch(var(--ac-100));
  color: oklch(var(--ac-900));
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1.art-title {
  font-size: clamp(27px, 4.2vw, 38px);
  line-height: 1.16;
}

.lede {
  margin: 14px 0 0;
  font-size: 16.5px;
  line-height: 1.7;
  color: oklch(var(--fg-700));
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 16px 0 0;
  padding-bottom: 18px;
  border-bottom: 1px solid oklch(var(--bg-200));
  font-size: 11.5px;
  color: oklch(var(--fg-500));
}

.cover {
  margin: 20px 0 0;
}

.cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: oklch(var(--bg-200));
}

.cover figcaption {
  margin-top: 8px;
  font-size: 11px;
  color: oklch(var(--fg-500));
}

.toc {
  margin: 26px 0 0;
  padding: 16px 18px;
  border: 1px solid oklch(var(--bg-200));
  border-radius: 8px;
  background: oklch(var(--bg-100));
}

.toc p {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(var(--fg-500));
}

.toc ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
}

.toc a {
  color: oklch(var(--fg-800));
  text-decoration: none;
}

.toc a:hover {
  color: oklch(var(--ac-700));
  text-decoration: underline;
}

/* ---------- prose ---------- */
.prose {
  margin-top: 8px;
}

.prose h2 {
  font-size: clamp(19px, 2.6vw, 23px);
  line-height: 1.32;
  margin: 34px 0 10px;
}

.prose h3 {
  font-size: 15.5px;
  margin: 22px 0 6px;
}

.prose p {
  margin: 0 0 14px;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 7px;
}

.prose li::marker {
  color: oklch(var(--ac-500));
}

.prose strong {
  color: oklch(var(--fg-950));
  font-weight: 600;
}

.prose a {
  color: oklch(var(--ac-700));
  font-weight: 500;
}

.callout {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 3px solid oklch(var(--ac-400));
  border-radius: 0 8px 8px 0;
  background: oklch(var(--ac-50));
  font-size: 13.5px;
  line-height: 1.7;
  color: oklch(var(--fg-800));
}

.callout p {
  margin: 0;
}

.callout strong {
  color: oklch(var(--ac-900));
}

.table-wrap {
  margin: 18px 0 8px;
  overflow-x: auto;
  border: 1px solid oklch(var(--bg-200));
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 12.5px;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 10px 12px 8px;
  font-size: 11px;
  color: oklch(var(--fg-500));
  border-bottom: 1px solid oklch(var(--bg-200));
}

th {
  text-align: left;
  padding: 9px 12px;
  background: oklch(var(--bg-100));
  color: oklch(var(--fg-600));
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid oklch(var(--bg-200));
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid oklch(var(--bg-200) / 0.7);
  color: oklch(var(--fg-800));
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-note {
  font-size: 11.5px;
  color: oklch(var(--fg-500));
  margin: 6px 0 18px;
}

.check-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 7px;
}

.check-list li {
  position: relative;
  padding-left: 26px;
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0;
}

.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: oklch(var(--se-100));
  color: oklch(var(--se-900));
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 14px 10px 42px;
  margin: 0;
  border: 1px solid oklch(var(--bg-200));
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  line-height: 1.65;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 11px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: oklch(var(--pr-500));
  color: oklch(var(--bg-50));
  font-size: 10.5px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-family: var(--font-body);
}

/* ---------- article footer blocks ---------- */
.related {
  margin: 34px 0 0;
  padding: 18px;
  border: 1px solid oklch(var(--bg-200));
  border-radius: 8px;
  background: oklch(var(--bg-100));
}

.related h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(var(--fg-500));
  font-family: var(--font-body);
  font-weight: 500;
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.related a {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid oklch(var(--bg-200));
  color: oklch(var(--fg-800));
  font-size: 13px;
  text-decoration: none;
}

.related a:hover {
  border-color: oklch(var(--ac-200));
  color: oklch(var(--ac-700));
}

.related a i {
  color: oklch(var(--ac-500));
  font-size: 14px;
  margin-top: 2px;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0;
  padding: 9px 14px;
  border-radius: 6px;
  background: oklch(var(--pr-500));
  color: oklch(var(--bg-50));
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
}

.backlink:hover {
  background: oklch(var(--pr-600));
  color: #fff;
}

.source-note {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid oklch(var(--bg-200));
  font-size: 11.5px;
  line-height: 1.7;
  color: oklch(var(--fg-500));
}

/* ---------- footer ---------- */
.site-footer {
  background: #0c1119;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12.5px;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 32px;
  display: grid;
  gap: 28px;
  grid-template-columns: 1.4fr 1fr 1fr;
}

.site-footer h2 {
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.site-footer p {
  margin: 0;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.55);
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.site-footer ul.cols {
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.66);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-brand {
  color: #fff;
  font-family: var(--font-heading);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-bottom: 12px;
}

.footer-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.footer-cta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  text-decoration: none;
}

.footer-cta a.primary {
  background: #fff;
  color: #11161f;
}

.footer-cta a.ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.86);
}

.footer-bottom {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.4);
}

/* ---------- bottom bar + sheet ---------- */
.bottom-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 70;
  display: flex;
  justify-content: space-around;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(12, 17, 25, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bottom-bar a,
.bottom-bar button {
  flex: 1;
  min-height: 50px;
  max-width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: rgba(255, 255, 255, 0.74);
  font-family: inherit;
  font-size: 10.5px;
  text-decoration: none;
  cursor: pointer;
}

.bottom-bar i {
  font-size: 19px;
  line-height: 1;
}

.bottom-bar a:hover,
.bottom-bar button:hover,
.bottom-bar a:focus-visible,
.bottom-bar button:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: rgba(12, 17, 25, 0.6);
  cursor: default;
}

.sheet-panel {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: #0c1119;
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-up 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes sheet-up {
  from {
    transform: translateY(14%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sheet-head h2 {
  color: #fff;
  font-size: 16px;
  margin: 4px 0 0;
}

.grabber {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  margin-bottom: 6px;
}

.sheet-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: none;
  color: rgba(255, 255, 255, 0.88);
  font-size: 19px;
  cursor: pointer;
}

.sheet-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 18px;
}

.sheet-hint {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
}

.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sheet-grid a,
.sheet-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  text-decoration: none;
}

.sheet-grid a i {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
}

.sheet-list {
  display: grid;
  gap: 2px;
}

.sheet-list a {
  border-color: transparent;
  align-items: flex-start;
  line-height: 1.5;
}

.sheet-list span.num {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.4);
  padding-top: 2px;
}

.sheet-grid a:hover,
.sheet-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

body.sheet-open {
  overflow: hidden;
}

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .page-main {
    padding-bottom: 92px;
  }
  .site-footer {
    padding-bottom: 76px;
  }
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .nav-links .nav-optional {
    display: none;
  }
  .dd-panel {
    left: auto;
    right: 0;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    padding: 0 16px;
    gap: 8px;
  }
  .brand {
    font-size: 16px;
  }
  .brand-mark {
    width: 25px;
    height: 25px;
    font-size: 12.5px;
  }
  .nav-a {
    padding: 8px 7px;
    font-size: 12px;
  }
  .nav-cta {
    padding: 7px 10px;
    font-size: 11.5px;
  }
  .wrap,
  .article-shell {
    padding: 0 16px;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    padding: 32px 16px 24px;
  }
  .footer-bottom {
    padding: 12px 16px 18px;
  }
  .lede {
    font-size: 15.5px;
  }
  .prose h2 {
    margin-top: 28px;
  }
  .sheet-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .nav-cta span {
    display: none;
  }
}

@media (min-width: 1024px) {
  .bottom-bar {
    display: none;
  }
}

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