:root {
  color-scheme: light;
  --burgundy: #551d2d;
  --burgundy-dark: #401420;
  --cream: #f8f1e9;
  --paper: #fffdf9;
  --blush: #ead4cc;
  --rose: #c89486;
  --ink: #261f20;
  --muted: #6f6263;
  --line: #cdbdb7;
  --focus: #d99a23;
  --max: 1120px;
  --serif: Cambria, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--cream); color: var(--ink); font: 400 1rem/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--burgundy); text-underline-offset: .2em; }
a:hover { color: var(--burgundy-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(calc(100% - 3rem), var(--max)); margin-inline: auto; }
.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: fixed; left: 1rem; top: 1rem; z-index: 100; padding: .7rem 1rem; background: var(--paper); color: var(--ink); font-weight: 700; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(255,255,255,.2); background: var(--burgundy); color: #fff9f3; }
.header-inner { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: flex; flex-direction: column; color: #fff9f3; text-decoration: none; line-height: 1.15; }
.brand:hover { color: #fff; }
.brand-name { font-family: var(--serif); font-size: 1.08rem; font-weight: 700; letter-spacing: .02em; }
.brand-note { margin-top: .25rem; color: #dcbcc0; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; }
.site-nav { display: flex; gap: 1.8rem; align-items: center; }
.site-nav a { padding: .35rem 0; border-bottom: 1px solid transparent; color: #f8e9e5; text-decoration: none; font-size: .88rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: #f8e9e5; color: #fff; }
.nav-toggle { display: none; width: 42px; height: 42px; padding: 10px; border: 1px solid rgba(255,255,255,.45); background: transparent; }
.nav-toggle span:not(.sr-only) { display: block; height: 1px; margin: 5px 0; background: #fff; }

.site-main { min-height: calc(100vh - 170px); }
.hero { background: var(--burgundy); color: #fff9f3; }
.hero-inner { padding-block: clamp(5.5rem, 11vw, 9rem); }
.eyebrow { margin: 0 0 1rem; color: var(--burgundy); font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.hero .eyebrow { color: #dcbcc0; }
.hero h1 { max-width: 890px; margin: 0; font-family: var(--serif); font-size: clamp(3.7rem, 9vw, 7.5rem); font-weight: 400; line-height: .92; letter-spacing: -.055em; }
.hero h1 em { color: #e8c6bd; font-weight: 400; }
.hero-bio { max-width: 660px; margin: 2rem 0 0; color: #ead9d5; font-size: clamp(1rem, 1.8vw, 1.2rem); }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem 1.6rem; margin-top: 2.2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.05rem; border: 1px solid var(--burgundy); background: var(--burgundy); color: #fff; text-decoration: none; font-weight: 650; }
.button:hover { background: var(--burgundy-dark); color: #fff; }
.button-light { border-color: #f8e9e5; background: #f8e9e5; color: var(--burgundy); }
.button-light:hover { border-color: #fff; background: #fff; color: var(--burgundy); }
.text-link { color: #fff4ef; font-size: .9rem; text-decoration: none; }
.text-link:hover { color: #fff; text-decoration: underline; }

.intro-band { border-bottom: 1px solid var(--line); background: var(--blush); }
.intro-grid { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(2rem, 8vw, 7rem); padding-block: 3.4rem; }
.intro-label { margin: .35rem 0 0; color: var(--burgundy); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.intro-grid h2 { margin: 0; font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 400; line-height: 1.1; letter-spacing: -.03em; }
.intro-grid p:last-child { max-width: 700px; margin: 1rem 0 0; color: #5e4d50; }

.section { padding-block: clamp(4.5rem, 9vw, 7rem); }
.section-heading { margin-bottom: 2.5rem; }
.editorial-heading { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(2rem, 8vw, 7rem); align-items: end; }
.editorial-heading .eyebrow { margin: 0 0 .45rem; }
.section h2, .latest-section h2, .listing h2 { margin: 0; font-family: var(--serif); font-size: clamp(2.6rem, 5vw, 4.6rem); font-weight: 400; line-height: 1; letter-spacing: -.045em; }

.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.category-card { display: flex; flex-direction: column; min-height: 260px; padding: 1.7rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-decoration: none; transition: background .2s ease; }
.category-card:hover { background: var(--paper); color: var(--ink); }
.category-index { color: var(--rose); font-size: .72rem; font-weight: 700; letter-spacing: .12em; }
.category-card h3 { margin: 2rem 0 .7rem; font-family: var(--serif); font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 400; line-height: 1.1; }
.category-card p { max-width: 48ch; margin: 0; color: var(--muted); }
.category-card strong { margin-top: auto; padding-top: 1.5rem; color: var(--burgundy); font-size: .85rem; }
.category-card:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 220px; }

.latest-section { padding-block: clamp(4.5rem, 9vw, 7rem); background: var(--paper); }
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.post-card { min-height: 230px; padding: 1.5rem; border: 1px solid var(--line); background: var(--paper); }
.post-card:hover { border-color: var(--burgundy); }
.post-card-topline, .post-card-footer { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .76rem; }
.post-card h3 { margin: 1.3rem 0 .6rem; font-family: var(--serif); font-size: 1.6rem; font-weight: 400; line-height: 1.2; }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { color: var(--burgundy); }
.post-card p { margin: 0 0 1.3rem; color: var(--muted); }
.difficulty { color: var(--burgundy); font-weight: 700; }
.empty-state { padding: clamp(2.2rem, 5vw, 4rem); border: 1px solid var(--line); background: var(--cream); text-align: center; }
.empty-state h2, .empty-state h3 { margin: 0; font-family: var(--serif); font-size: 1.8rem; font-weight: 400; }
.empty-state p { max-width: 580px; margin: .6rem auto 0; color: var(--muted); }
.empty-code { color: var(--rose) !important; font-size: .75rem; font-weight: 700; }

.page-hero { padding-block: clamp(4.5rem, 9vw, 7rem) 3.5rem; }
.page-hero h1, .article-header h1, .not-found h1 { max-width: 18ch; margin: 0; font-family: var(--serif); font-size: clamp(3rem, 7vw, 6rem); font-weight: 400; line-height: .98; letter-spacing: -.05em; }
.page-hero > p:last-child { max-width: 720px; margin: 1.4rem 0 0; color: var(--muted); font-size: 1.08rem; }
.listing { padding-bottom: 6rem; }
.listing .post-grid { margin-top: 1rem; }
.learning-groups { display: grid; gap: clamp(3rem, 7vw, 5rem); }
.learning-group + .learning-group { padding-top: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--line); }
.learning-group-header { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.learning-group-header h2 { margin-top: .65rem; }
.learning-group-count { flex: 0 0 auto; margin: 0 0 .35rem; color: var(--muted); font-size: .9rem; }

.achievement-overview { margin-bottom: clamp(4rem, 8vw, 6rem); padding: clamp(1.5rem, 4vw, 2.4rem); border: 1px solid var(--line); background: var(--paper); }
.achievement-heading-row { display: flex; justify-content: space-between; gap: 2rem; align-items: end; }
.achievement-heading-row h2, .achievement-section-heading h2 { margin: 0; font-family: var(--serif); font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 400; line-height: 1; letter-spacing: -.04em; }
.achievement-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 2rem; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.achievement-stats > div { min-width: 0; padding: 1.2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.achievement-stats strong, .achievement-stats span { display: block; }
.achievement-stats strong { color: var(--burgundy); font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 400; line-height: 1; }
.achievement-stats span { margin-top: .55rem; color: var(--muted); font-size: .78rem; }
.achievement-updated { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; }
.achievement-section-heading { max-width: 760px; margin-bottom: 2.2rem; }
.achievement-section-heading > p:last-child { margin: 1rem 0 0; color: var(--muted); }
.achievement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.achievement-card { overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.achievement-image { display: flex; aspect-ratio: 16/10; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--line); background: #f0e9e2; }
.achievement-image img { width: 100%; height: 100%; padding: .75rem; object-fit: contain; transition: transform .2s ease; }
.achievement-image:hover img { transform: scale(1.015); }
.achievement-body { padding: 1.5rem; }
.achievement-body h3 { margin: .3rem 0; font-family: var(--serif); font-size: 1.55rem; font-weight: 400; line-height: 1.2; }
.achievement-body > p:not(.achievement-date):not(.achievement-result) { color: var(--muted); }
.achievement-date { margin: 0; color: var(--muted); font-size: .76rem; }
.achievement-result { color: var(--burgundy); font-weight: 700; }
.achievement-links { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; margin-top: 1.2rem; font-size: .86rem; font-weight: 650; }
.achievement-results { padding-bottom: 6rem; }
.achievement-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper); }
.achievement-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.achievement-table th, .achievement-table td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.achievement-table th { background: var(--blush); color: var(--burgundy); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.achievement-table tbody tr:last-child td { border-bottom: 0; }
.achievement-table td:first-child { white-space: nowrap; color: var(--muted); }
.achievement-table td:nth-child(3), .achievement-table td:nth-child(4) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.achievement-table a { color: var(--ink); font-weight: 650; text-decoration: none; }
.achievement-table a:hover { color: var(--burgundy); text-decoration: underline; }

.article { padding-block: 4rem 6rem; }
.back-link { display: inline-block; margin-bottom: 3rem; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--burgundy); }
.article-header { max-width: 900px; padding-bottom: 3rem; border-bottom: 1px solid var(--line); }
.article-summary { max-width: 780px; margin: 1.3rem 0 0; color: var(--muted); font-size: 1.25rem; line-height: 1.65; }
.article-meta { display: flex; flex-wrap: wrap; gap: .6rem 1.3rem; margin-top: 1.4rem; color: var(--muted); font-size: .9rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.1rem 0 0; list-style: none; }
.tag-list li { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--burgundy); font-size: .74rem; }
.article-layout { display: grid; grid-template-columns: 190px minmax(0, 850px); gap: clamp(2rem, 4vw, 4rem); align-items: start; padding-top: 3rem; }
.toc-panel { position: sticky; top: 108px; padding-left: 1rem; border-left: 2px solid var(--rose); }
.toc-panel[hidden] { display: none; }
.toc-panel[hidden] + .prose { grid-column: 1 / -1; width: min(100%, 850px); }
.toc-title { margin: 0 0 .7rem; color: var(--ink); font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.toc-panel ol { padding: 0; margin: 0; list-style: none; }
.toc-panel li { margin: .4rem 0; }
.toc-panel .toc-subitem { padding-left: .8rem; }
.toc-panel a { color: var(--muted); text-decoration: none; font-size: .82rem; line-height: 1.4; }
.toc-panel a:hover { color: var(--burgundy); }
.prose { min-width: 0; color: #3f3537; font-size: 1.075rem; line-height: 1.82; }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 110px; color: var(--ink); font-family: var(--serif); font-weight: 400; line-height: 1.2; }
.prose h2 { margin: 3.2rem 0 1.15rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); font-size: clamp(1.85rem, 3vw, 2.35rem); }
.prose h3 { margin: 2rem 0 .8rem; font-size: 1.45rem; }
.prose p, .prose ul, .prose ol { margin-block: 1.15rem; }
.prose li + li { margin-top: .55rem; }
.prose a { overflow-wrap: anywhere; }
.prose blockquote { margin: 1.6rem 0; padding: 1rem 1.25rem; border-left: 4px solid var(--burgundy); background: var(--paper); color: var(--ink); font-size: 1.05rem; }
.prose blockquote p { margin: 0; }
.prose img { width: auto !important; min-width: min(100%, 34rem); max-width: 100% !important; height: auto !important; margin: 1.8rem auto 2.2rem; padding: .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: 0 12px 30px rgba(85, 29, 45, .09); }
.prose .flow-figure { max-width: 42rem; margin: 2rem auto 2.8rem; text-align: center; }
.prose .flow-figure img { width: 100% !important; min-width: 0; margin: 0; }
.prose .flow-figure figcaption { margin-top: .7rem; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.prose .figure-caption { display: block; width: 100%; margin: -.8rem auto 2.2rem; color: var(--muted); font-size: .88rem; line-height: 1.5; text-align: center; }
.prose .code-figure { width: 100%; margin: 2rem 0 2.6rem; }
.prose .code-figure a { display: block; cursor: zoom-in; }
.prose .code-figure img { width: 100% !important; min-width: 0; margin: 0; padding: 0; border-color: #362a2c; border-radius: 6px; background: #241d1f; }
.prose table { display: block; max-width: 100%; overflow-x: auto; margin: 1.5rem 0; border-collapse: collapse; }
.prose th, .prose td { padding: .8rem 1rem; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--blush); }
.prose code { padding: .12em .34em; background: #eee2dc; color: #7f1d32; font: .9em var(--mono); }
.code-block { position: relative; margin: 1.5rem 0; }
.prose pre { overflow-x: auto; margin: 0; padding: 1.2rem; border: 1px solid #362a2c; background: #241d1f; }
.prose pre code { padding: 0; background: none; color: #f8eee9; }
.copy-code { position: absolute; top: .6rem; right: .6rem; padding: .34rem .55rem; border: 1px solid #766467; background: #362a2c; color: #eadbd6; font-size: .7rem; cursor: pointer; }
.copy-code:hover { color: #fff; border-color: #d9bbb4; }
.highlight .c, .highlight .c1 { color: #a89699; }
.highlight .k, .highlight .kd, .highlight .kn { color: #ff9caf; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #e8c98b; }
.highlight .n, .highlight .na { color: #f8eee9; }
.highlight .nf, .highlight .nb { color: #c8b5ff; }
.highlight .mi, .highlight .mf { color: #9ed1db; }

.not-found { padding-block: 9rem; text-align: center; }
.not-found h1 { max-width: none; }
.not-found > p:not(.error-number) { color: var(--muted); }
.error-number { margin: 0; color: var(--rose); font: 400 clamp(5rem, 16vw, 10rem)/.9 var(--serif); }
.site-footer { border-top: 1px solid rgba(255,255,255,.18); background: var(--burgundy); color: #e6d0cd; font-size: .82rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.8rem; }
.footer-inner p { margin: 0; }

@media (max-width: 820px) {
  .editorial-heading, .intro-grid { grid-template-columns: 1fr; gap: 1rem; }
  .article-layout { grid-template-columns: 1fr; }
  .toc-panel { position: static; order: -1; padding: 1rem 1.2rem; border: 1px solid var(--line); background: var(--paper); }
  .achievement-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 1.5rem), var(--max)); }
  .header-inner { min-height: 72px; }
  .brand-note { display: none; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: calc(100% + 1px); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: .5rem .75rem .8rem; border-bottom: 1px solid rgba(255,255,255,.2); background: var(--burgundy); }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .7rem .35rem; border-bottom: 0; }
  .hero-inner { padding-block: 5rem; }
  .hero h1 { font-size: clamp(3.3rem, 18vw, 5rem); }
  .category-grid, .post-grid, .achievement-grid { grid-template-columns: 1fr; }
  .learning-group-header { align-items: start; flex-direction: column; gap: .5rem; }
  .learning-group-count { margin: 0; }
  .category-card:last-child:nth-child(odd) { grid-column: auto; }
  .achievement-heading-row { align-items: start; flex-direction: column; }
  .category-card { min-height: 230px; }
  .footer-inner { flex-direction: column; }
}

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