.full-width {
  width: 100%;
  margin-inline: auto;
  padding-block: var(--space-12);
}
.prose {
  max-width: var(--column-prose);
  margin-inline: auto;
  padding-block: var(--space-12);
}

.prose-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--column-prose)) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

.prose-wrap > .prose {
  grid-column: 2;
  margin-inline: 0;
}

.prose-toc {
  grid-column: 1;
  justify-self: end;
  position: sticky;
  top: calc(var(--header-height) + var(--space-10));
  max-width: 15rem;
  max-height: calc(100vh - var(--header-height) - var(--space-16));
  overflow-y: auto;
  font-family: var(--font-mono);

  & .prose-toc-label {
    font-size: var(--type-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--fg-quiet);
    margin-bottom: var(--space-3);
  }

  & ol {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  & a {
    display: block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--type-xs);
    line-height: var(--leading-snug);
    color: var(--fg-quiet);
    text-decoration: none;
    transition: color 0.15s;
  }

  & a:hover { color: var(--fg-soft); }

  & a.active { color: var(--fg); }
}

@keyframes prose-toc-reveal {
  from { opacity: 0; transform: translateY(50vh); }
  to   { opacity: 1; transform: translateY(0); }
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .prose-toc {
      animation: prose-toc-reveal ease-out both;
      animation-timeline: scroll(root block);
      animation-range: 50vh 100vh;
    }
  }
}

.prose-section {
  view-timeline-axis: block;
  view-timeline-inset: var(--header-height) 0;
}
@keyframes prose-toc-current {
  from, to { color: var(--fg); }
}
@supports (animation-timeline: view()) {
  .prose-toc a {
    animation-name: prose-toc-current;
    animation-timing-function: linear;
    animation-fill-mode: none;
    animation-range: exit 0% exit 100%;

  }
}

.prose :is(h2, h3) { scroll-margin-top: calc(var(--header-height) + var(--space-6)); }

@media (max-width: 1160px) {
  .prose-wrap { display: block; }
  .prose-wrap > .prose { margin-inline: auto; }
  .prose-toc { display: none; }
}

.prose h1 {
  font-size: var(--type-h1);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-8);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.prose h2 {
  font-size: var(--type-h2);
  line-height: var(--leading-snug);
  margin-top: var(--space-16);
  margin-bottom: var(--space-6);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-2);
}

.prose h3 {
  font-size: var(--type-h3);
  line-height: var(--leading-snug);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  font-weight: 700;
}

.prose p {
  margin-bottom: var(--space-6);
  color: var(--fg-soft);
}

.prose strong { color: var(--fg); font-weight: 700; }

.prose ul, .prose ol {
  margin-bottom: var(--space-8);
  padding-left: var(--space-6);
}

.prose li {
  margin-bottom: var(--space-3);
  color: var(--fg-soft);
}

.prose blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-4) var(--space-8);
  border-left: 4px solid var(--fg);
  background: var(--fg-wash);
  font-style: italic;
  color: var(--fg);
}

.prose table {
  width: 100%;
  margin-block: var(--space-8);
  border-collapse: collapse;
  font-size: var(--type-sm);

  & th,
  & td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-subtle);
  }

  & th {
    font-family: var(--font-mono);
    font-size: var(--type-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg);
    border-bottom: 1px solid var(--fg);
  }

  & td { color: var(--fg-soft); }

  & code { white-space: nowrap; }

  & tr:last-child td { border-bottom: none; }
}

.quiz-cta {
  margin-block: var(--space-10) 0;

  & a {
    display: inline-flex;
    align-items: center;
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-mono);
    font-size: var(--type-sm);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--bg);
    background: var(--fg);
    border: 1px solid var(--fg);
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;

    &:hover {
      color: var(--fg);
      background: var(--bg);
    }
  }
}

.breadcrumb {
  margin-bottom: var(--space-8);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  opacity: 0.4;
}

.breadcrumb a,
.prose .breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--fg); }
.breadcrumb [aria-current] { color: var(--fg); font-weight: 500; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
  background: color-mix(in oklch, var(--fg-wash), var(--fg) 4%);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.prose pre {
  margin-block: var(--space-8);
  padding: var(--space-6);
  background: var(--fg);
  color: var(--bg);
  border: 1px solid color-mix(in oklch, var(--fg), var(--bg) 16%);
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  line-height: var(--leading-prose);

  & code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
    font-size: inherit;
    font-weight: 400;
  }
}

.alto-highlight {
  margin-block: var(--space-10);
  padding: var(--space-6);
  background: oklch(2% 0 0);
  color: oklch(95% 0 0);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}

.alto-highlight .comment { color: oklch(58% 0 0); font-style: italic; }
.alto-highlight .keyword { color: oklch(100% 0 0); font-weight: 700; }
.alto-highlight .string { color: oklch(80% 0 0); }
.alto-highlight .function-name { color: oklch(92% 0 0); font-weight: 600; }
.alto-highlight .punctuation { color: oklch(68% 0 0); }

.content-body > h2:not([class]) {
  font-size: var(--type-xl);
  font-weight: 700;
  margin: var(--space-10) 0 var(--space-4);
}

.content-body > h3:not([class]) {
  font-size: var(--type-lg);
  font-weight: 700;
  margin: var(--space-8) 0 var(--space-3);
}

.content-body > p:not([class]) {
  margin-bottom: var(--space-6);
  max-width: var(--column-prose);
  color: var(--fg-soft);
}

.content-body > ul:not([class]),
.content-body > ol:not([class]) {
  margin: 0 0 var(--space-6);
  padding-left: var(--space-6);
  max-width: var(--column-prose);
}

.content-body > :is(ul, ol):not([class]) > li {
  margin-bottom: var(--space-2);
  color: var(--fg-soft);
}

.content-body a:not([class]) {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hub-group .grid-links:has(> a:only-child) {
  grid-template-columns: minmax(0, 440px);
}

.topic-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topic-switcher-label { color: var(--fg-quiet); margin-right: var(--space-2); }

.topic-switcher a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.topic-switcher a:not(:last-child)::after {
  content: "·";
  margin-left: var(--space-3);
  color: var(--border);
}

.topic-switcher a:hover { color: var(--fg); }
.topic-switcher a.is-active { color: var(--fg); font-weight: 700; }

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-block: var(--space-8) var(--space-4);
}

.home-actions a {
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--fg);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.home-actions .btn { background: var(--fg); color: var(--bg); }
.home-actions .btn:hover { background: var(--bg); color: var(--fg); }
.home-actions .btn-ghost { background: var(--bg); color: var(--fg); border-color: var(--border); }
.home-actions .btn-ghost:hover { border-color: var(--fg); }

.grid-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-8);
  margin-block: var(--space-12);
}

.link-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-card:hover {
  border-color: var(--fg);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px color-mix(in oklch, var(--fg), transparent 90%);
}

.link-card h3 {
  font-size: var(--type-h3);
  margin: 0 0 var(--space-3);
  font-weight: 700;
}

.link-card p {
  font-size: var(--type-sm);
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  flex: 1;
}

.card-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-quiet);
}

.section-plan {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-3);
  margin-block: var(--space-10) var(--space-12);
  list-style: none;
  padding: 0;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.plan-card:hover { border-color: var(--fg); transform: translateY(-3px); }

.plan-card .plan-name {
  font-weight: 700;
  font-size: var(--type-sm);
  letter-spacing: -0.01em;
}

.plan-card .plan-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

@media (max-width: 900px) { .section-plan { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .section-plan { grid-template-columns: repeat(2, 1fr); } }

.home-section {
  padding-block: var(--space-12);
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: var(--space-20);
}

.home-section:first-of-type { border-top: none; padding-top: var(--space-6); }

.home-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.home-section-head h2 {
  font-size: var(--type-h2);
  letter-spacing: -0.02em;
  margin: 0;
}

.home-section-link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

.home-section-link:hover { border-color: var(--fg); }

.home-section-lede {
  flex-basis: 100%;
  max-width: var(--column-prose);
  margin: 0;
  color: var(--muted);
  font-size: var(--type-base);
  line-height: var(--leading-base);
}

.home-section .grid-links { margin-block: var(--space-6) 0; }

.cards {
  display: grid;
  gap: var(--space-6);
  margin-block: var(--space-6) 0;
  list-style: none;
  padding: 0;
}

.cards-v  { grid-template-columns: repeat(4, 1fr); }
.cards-sq { grid-template-columns: repeat(3, 1fr); }
.cards-h  { grid-template-columns: repeat(2, 1fr); }

.xcard {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.xcard:hover {
  border-color: var(--fg);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px color-mix(in oklch, var(--fg), transparent 90%);
}

.cards-v .xcard, .cards-sq .xcard { flex-direction: column; }
.cards-h .xcard { flex-direction: row; }

.xcard-ic {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--fg-wash);
  color: var(--fg);
}

.cards-v  .xcard-ic { height: 84px; }
.cards-sq .xcard-ic { height: 118px; }
.cards-h  .xcard-ic { width: 96px; order: 1; }

.xcard-ic svg {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
}

.cards-games .xcard-ic,
.cards-demos .xcard-ic {
  width: 30%;
  background: var(--fg);
  color: var(--bg);
  border-radius: 64px 0 0 64px;
}

.cards-games .xcard-ic::before,
.cards-demos .xcard-ic::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklch, var(--bg), transparent 76%);
  top: -46px;
  right: -40px;
}

.cards-games .xcard-ic::after,
.cards-demos .xcard-ic::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: color-mix(in oklch, var(--bg), transparent 88%);
  bottom: -30px;
  left: -6px;
}

.xcard-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6);
}

.cards-h .xcard-body { flex: 1; justify-content: center; }

.xcard-title {
  font-weight: 700;
  font-size: var(--type-h3);
  letter-spacing: -0.01em;
}

.xcard-desc {
  font-size: var(--type-sm);
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 900px) {
  .cards-v, .cards-sq { grid-template-columns: repeat(2, 1fr); }
  .cards-h { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .cards-v, .cards-sq { grid-template-columns: 1fr; }
}

.callout {
  --callout-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill-rule='evenodd' d='M16 0a16 16 0 1 0 0 32 16 16 0 0 0 0-32zM16 6.4a2.2 2.2 0 1 1 0 4.4 2.2 2.2 0 0 1 0-4.4zM13.8 13.6h4.4v12.2h-4.4z'/%3E%3C/svg%3E");

  position: relative;
  padding: var(--space-6);
  padding-inline-start: calc(var(--space-6) + var(--space-8) + var(--space-4));
  margin-block: var(--space-10);
  background: var(--fg-wash);
  border-radius: 10px;

  &::before {
    content: "";
    position: absolute;
    inset-inline-start: var(--space-6);
    inset-block: 0;
    margin-block: auto;
    inline-size: var(--space-8);
    block-size: var(--space-8);
    background: var(--fg);
    -webkit-mask: var(--callout-mark) center / contain no-repeat;
    mask: var(--callout-mark) center / contain no-repeat;
  }

  & > :first-child { margin-block-start: 0; }
  & > :last-child { margin-block-end: 0; }
}

.callout-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
  color: var(--fg);
}

.hero-title {
  font-size: clamp(2.375rem, 14.5cqi, 5.75rem);
  font-weight: 800;
  line-height: 0.84;
  letter-spacing: -0.03em;
  margin: 0;
  max-width: calc(var(--space-unit) * 150);
}

.hero-deck {
  font-size: clamp(1.125rem, 2vw, 1.4rem);
  line-height: 1.5;
  color: var(--fg-soft);
  max-width: 50ch;
  margin: 0;
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  margin-top: var(--space-20);
  padding-top: var(--space-10);
  border-top: 1px solid var(--border-subtle);
}

.nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
  .article-nav { grid-template-columns: 1fr; }
  .grid-links { grid-template-columns: 1fr; }
}

.schematic {
  margin-block: var(--space-12);
  padding: var(--space-8);
  background: var(--fg-wash);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

.schematic img {
  max-width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.1);
  opacity: 0.9;
}

.schematic:hover img {
  filter: none;
  opacity: 1;
  transition: all 0.4s ease;
}

.schematic svg {
  width: 100%;
  height: auto;
  max-width: 720px;
  color: var(--fg);
  font-family: var(--font-mono);
}

.schematic svg text {
  fill: currentColor;
}

.hero-visual svg {
  width: 100%;
  height: auto;
  max-width: none;
}

.hero-visual .st0 { fill: none; stroke: var(--fg); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hero-visual .st1 { fill: var(--fg); }

.hub-intro {
  max-width: var(--column-prose);

  & p {
    margin-bottom: var(--space-6);
  }
}

.hub-group {
  margin-block: var(--space-12);

  & .hub-group-title {
    margin-bottom: var(--space-6);
  }

  & .grid-links {
    margin-block: 0;
  }
}
