:root {
  --color-bg: #f5f7f8;
  --color-surface: #ffffff;
  --color-text: #252b30;
  --color-text-secondary: #59636b;
  --color-text-muted: #667179;
  --color-accent: #526b7d;
  --color-accent-hover: #3e5566;
  --color-accent-light: #eef2f4;
  --color-navy: #3e536d;
  --color-border: #dfe5e9;
  --color-border-light: #edf1f3;
  --font-korean: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", system-ui, sans-serif;
  --font-serif: var(--font-korean);
  --font-sans: var(--font-korean);
  --max-reading: 760px;
  --max-wide: 1000px;
  --reading-scale: 1;
  --nav-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
}

body[data-text-size="small"] {
  --reading-scale: 0.92;
}

body[data-text-size="large"] {
  --reading-scale: 1.08;
}

a {
  color: inherit;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--color-navy);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 9px 13px;
  transform: translateY(-160%);
  background: var(--color-navy);
  color: white;
}

.skip-link:focus {
  transform: translateY(0);
}

.wide,
.reading {
  width: min(100% - 60px, var(--max-wide));
  margin-inline: auto;
}

.reading {
  max-width: var(--max-reading);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--nav-height);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 95%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  min-height: var(--nav-height);
  align-items: center;
  gap: 36px;
}

.brand {
  flex: 1 1 auto;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.primary-nav,
.text-size {
  display: flex;
  align-items: center;
}

.primary-nav {
  gap: 24px;
}

.primary-nav a {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.text-size {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 3px;
}

.text-size span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.text-size button {
  min-width: 34px;
  height: 31px;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
}

.text-size button:first-of-type {
  border-left: 0;
}

.text-size button[aria-pressed="true"] {
  background: var(--color-navy);
  color: white;
}

.hero {
  padding-block: 88px 92px;
  border-bottom: 1px solid var(--color-border);
}

.eyebrow,
.breadcrumb,
.meta,
.part-kicker,
.result-meta {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

.hero h1,
.page-head h1,
.post-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.035em;
  word-break: keep-all;
}

.hero h1 {
  max-width: 860px;
  margin-top: 18px;
  font-size: clamp(42px, 7vw, 68px);
  line-height: 1.16;
}

.hero-subtitle {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--color-text-secondary);
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.75;
  word-break: keep-all;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 30px 0 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.section {
  padding-block: 72px 88px;
}

.section + .section {
  border-top: 1px solid var(--color-border);
}

.section-heading {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 30px;
  margin-bottom: 36px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.45;
}

.section-heading p {
  max-width: 560px;
  margin: 3px 0 0;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.8;
}

.part-block + .part-block {
  margin-top: 64px;
}

.part-title {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 20px;
  align-items: baseline;
  margin-bottom: 12px;
}

.part-title h2,
.part-title h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.5;
}

.part-title a {
  font-size: 13px;
  font-weight: 600;
}

.chapter-list,
.post-list,
.search-results {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.chapter-row,
.post-row,
.result-row {
  border-bottom: 1px solid var(--color-border);
}

.chapter-row a,
.post-row a,
.result-row a {
  display: grid;
  align-items: baseline;
  color: inherit;
  text-decoration: none;
}

.chapter-row a {
  grid-template-columns: 70px 1fr auto;
  gap: 20px;
  padding-block: 19px;
}

.chapter-row a:hover,
.post-row a:hover,
.result-row a:hover {
  background: var(--color-accent-light);
}

.number {
  color: var(--color-accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.chapter-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.65;
  word-break: keep-all;
}

.count {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.page-head {
  padding-block: 68px 52px;
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb {
  margin: 0 0 18px;
  text-transform: none;
}

.breadcrumb a {
  color: var(--color-text-secondary);
}

.page-head h1 {
  max-width: 820px;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.3;
}

.page-intro {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1.85;
}

.post-row a {
  grid-template-columns: 72px 1fr 92px;
  gap: 20px;
  padding-block: 18px;
}

.post-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.65;
  word-break: keep-all;
}

.post-date {
  color: var(--color-text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.post-page {
  background: var(--color-surface);
}

.post-page .site-header,
.post-page .site-footer {
  background: color-mix(in srgb, var(--color-bg) 95%, transparent);
}

.post-article {
  padding-block: 72px 88px;
}

.post-header {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
  margin-top: 17px;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 22px 0 0;
  text-transform: none;
}

.post-body {
  margin-top: 42px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: calc(18px * var(--reading-scale));
  line-height: 1.95;
  white-space: pre-wrap;
  text-wrap: pretty;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 64px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.post-nav a {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px 0;
  text-decoration: none;
}

.post-nav a + a {
  padding-left: 30px;
  border-left: 1px solid var(--color-border);
}

.post-nav .next {
  align-items: flex-end;
  text-align: right;
}

.nav-label {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.nav-title {
  max-width: 290px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: break-word;
  text-wrap: balance;
  word-break: keep-all;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.search-panel input,
.search-panel select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  padding: 10px 12px;
  font-size: 15px;
}

.search-status {
  min-height: 24px;
  margin: 28px 0 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.result-row a {
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding-block: 18px;
}

.result-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
}

.result-meta {
  margin: 5px 0 0;
  text-transform: none;
}

.empty-state {
  padding-block: 36px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 15px;
}

.site-footer {
  padding-block: 38px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.footer-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 30px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.7;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 780px) {
  :root {
    --nav-height: 56px;
  }

  .wide,
  .reading {
    width: min(100% - 40px, var(--max-wide));
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0 18px;
    padding-block: 10px;
  }

  .brand {
    flex-basis: calc(100% - 120px);
  }

  .primary-nav {
    order: 3;
    width: 100%;
    gap: 20px;
    padding-top: 10px;
  }

  .hero {
    padding-block: 64px 68px;
  }

  .section {
    padding-block: 58px 68px;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .page-head {
    padding-block: 54px 42px;
  }

  .post-article {
    padding-block: 56px 70px;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 40px;
    line-height: 1.22;
  }

  .hero-subtitle {
    font-size: 18px;
  }

  .part-title,
  .chapter-row a {
    grid-template-columns: 48px 1fr;
    gap: 12px;
  }

  .part-title > :last-child,
  .chapter-row .count {
    grid-column: 2;
  }

  .post-row a {
    grid-template-columns: 48px 1fr;
    gap: 12px;
  }

  .post-date {
    grid-column: 2;
    text-align: left;
  }

  .post-body {
    font-size: calc(17px * var(--reading-scale));
    line-height: 1.9;
    overflow-wrap: break-word;
    word-break: keep-all;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav a + a {
    padding-left: 0;
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }

  .search-panel {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .result-row a {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .result-row .count {
    justify-self: start;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .post-nav {
    display: none;
  }

  body,
  .post-page {
    background: white;
  }

  .post-article {
    padding: 0;
  }
}

/* Documentation layout */
.docs-body {
  min-height: 100vh;
  background: var(--color-surface);
}

.docs-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: grid;
  min-height: 60px;
  grid-template-columns: 260px minmax(260px, 520px) 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 96%, transparent);
  backdrop-filter: blur(12px);
}

.docs-brand {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search,
.search-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: left;
}

.global-search {
  width: 100%;
  height: 38px;
  padding: 0 10px 0 13px;
  font-size: 13px;
}

kbd {
  min-width: 34px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.docs-header .text-size {
  grid-column: 4;
}

.docs-header--standalone {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.docs-header--standalone .text-size {
  grid-column: 3;
}

.header-language-nav,
.ebook-language-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.header-language-nav a,
.ebook-language-switch a,
.header-language-nav span,
.ebook-language-switch span {
  padding: 5px 8px;
  text-decoration: none;
}

.header-language-nav a:hover,
.ebook-language-switch a:hover {
  color: var(--color-navy);
}

.header-language-nav [aria-current="page"],
.ebook-language-switch [aria-current="page"] {
  background: var(--color-accent-light);
  color: var(--color-navy);
  font-weight: 700;
}

.sidebar-toggle {
  display: none;
  border: 1px solid var(--color-border);
  background: transparent;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.docs-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px minmax(0, 1fr) 190px;
  padding-top: 60px;
}

.docs-shell--standalone {
  grid-template-columns: minmax(0, 1fr) 190px;
}

.docs-sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  scrollbar-width: thin;
}

.sidebar-inner {
  padding: 26px 18px 48px;
}

.sidebar-home {
  display: block;
  margin-bottom: 28px;
  padding: 8px 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-home.active,
.sidebar-section a.active {
  background: var(--color-accent-light);
  color: var(--color-navy);
}

.sidebar-section + .sidebar-section {
  margin-top: 30px;
}

.sidebar-section h2 {
  margin: 0 10px 9px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  word-break: keep-all;
}

.sidebar-section h2 span {
  display: block;
  margin-bottom: 3px;
  color: var(--color-accent);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sidebar-section ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-section a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 7px 10px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.55;
  text-decoration: none;
}

.sidebar-section a:hover {
  background: var(--color-border-light);
  color: var(--color-text);
}

.sidebar-section a span {
  color: var(--color-text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.sidebar-license {
  margin: 38px 10px 0;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.65;
}

.docs-main {
  min-width: 0;
}

.docs-landing,
.docs-document {
  width: min(100% - 80px, 820px);
  margin: 0 auto;
  padding: 70px 0 96px;
}

.doc-kicker {
  margin: 0 0 13px;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.docs-landing h1,
.docs-document h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(36px, 5vw, 50px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.25;
  word-break: keep-all;
}

.docs-lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--color-text-secondary);
  font-size: calc(18px * var(--reading-scale));
  letter-spacing: -0.012em;
  line-height: 1.8;
  text-wrap: pretty;
  word-break: keep-all;
}

.keep-together {
  white-space: nowrap;
}

.search-callout {
  width: 100%;
  margin-top: 40px;
  padding: 17px 18px;
}

.search-callout:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.search-callout span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-callout strong {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
}

.search-callout small {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.featured-chapters,
.quick-start,
.doc-list-section {
  margin-top: 66px;
}

.doc-section-head {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--color-border);
}

.doc-section-head p,
.doc-section-head h2 {
  margin: 0;
}

.doc-section-head p {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.doc-section-head h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
}

.featured-chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.featured-chapter {
  display: flex;
  min-width: 0;
  min-height: 228px;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
}

.featured-chapter--primary {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.featured-chapter:hover,
.featured-chapter:focus-visible {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.featured-chapter-label {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.featured-chapter strong {
  display: block;
  margin-top: 24px;
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.4;
  word-break: keep-all;
}

.featured-chapter p {
  margin: 12px 0 0;
  color: var(--color-text-secondary);
  font-size: calc(14px * var(--reading-scale));
  line-height: 1.75;
  text-wrap: pretty;
  word-break: keep-all;
}

.featured-chapter-cta {
  margin-top: auto;
  padding-top: 24px;
  color: var(--color-navy);
  font-size: 12px;
  font-weight: 600;
}

.doc-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.doc-card {
  min-width: 0;
  min-height: 160px;
  padding: 20px;
  border: 1px solid var(--color-border);
  color: inherit;
  text-decoration: none;
}

.doc-card:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.doc-card-label {
  display: block;
  margin-bottom: 13px;
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.doc-card strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
}

.doc-card p {
  overflow: hidden;
  margin: 9px 0 0;
  color: var(--color-text-secondary);
  font-size: calc(12px * var(--reading-scale));
  line-height: 1.65;
  text-overflow: ellipsis;
  text-wrap: pretty;
  white-space: nowrap;
  word-break: keep-all;
}

.doc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.doc-list li {
  border-bottom: 1px solid var(--color-border);
}

.doc-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 18px 10px;
  color: inherit;
  text-decoration: none;
}

.doc-list a:hover {
  background: var(--color-accent-light);
}

.doc-list a > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.doc-list strong {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-list small {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: calc(12px * var(--reading-scale));
  line-height: 1.5;
  text-overflow: ellipsis;
  text-wrap: pretty;
  white-space: nowrap;
}

.doc-list time {
  color: var(--color-text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.docs-toc {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  padding: 46px 24px;
  border-left: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  font-size: 11px;
}

.docs-toc > p {
  margin: 0 0 14px;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.docs-toc > a {
  display: block;
  margin: 9px 0;
  padding-left: 10px;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
  line-height: 1.5;
  overflow-wrap: break-word;
  text-decoration: none;
  word-break: keep-all;
}

.docs-toc > a.active,
.docs-toc > a:hover {
  border-left-color: var(--color-accent);
  color: var(--color-navy);
}

.toc-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 32px;
  padding-top: 15px;
  border-top: 1px solid var(--color-border-light);
}

.docs-document .post-body {
  margin-top: 42px;
  letter-spacing: -0.012em;
  line-height: 1.9;
}

.docs-document .author-body {
  white-space: normal;
}

.author-body section + section {
  margin-top: 48px;
}

.author-body h2 {
  margin: 0 0 24px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.45;
  word-break: keep-all;
}

.author-body p {
  margin: 0;
}

.author-body p + p {
  margin-top: 20px;
}

.ebook-download-panel {
  margin-top: 46px;
  padding: 24px;
  border: 1px solid var(--color-accent);
  background: var(--color-accent-light);
}

.ebook-language-switch {
  width: max-content;
  margin: 0 0 22px;
}

.ebook-document--en h1 {
  letter-spacing: -0.035em;
  word-break: normal;
}

.ebook-lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--color-text-secondary);
  font-family: var(--font-serif);
  font-size: calc(20px * var(--reading-scale));
  line-height: 1.6;
  text-wrap: balance;
}

.ebook-edition-note {
  margin: 7px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.ebook-byline {
  margin: 15px 0 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.ebook-download-panel .doc-section-head {
  margin-bottom: 20px;
}

.ebook-resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.ebook-resource-list--single {
  grid-template-columns: minmax(0, 1fr);
}

.ebook-resource {
  min-width: 0;
}

.ebook-resource-title {
  margin: 0 0 8px;
  color: var(--color-navy);
  font-size: 15px;
  font-weight: 700;
}

.ebook-meta {
  margin: 0 0 14px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.ebook-download-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 16px;
  background: var(--color-navy);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ebook-download-button:hover,
.ebook-download-button:focus-visible {
  background: var(--color-accent-hover);
  color: white;
}

.ebook-download-count {
  margin: 14px 0 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.ebook-download-count strong {
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
}

.ebook-body {
  white-space: normal;
}

.ebook-body section + section {
  margin-top: 48px;
}

.ebook-body h2 {
  margin: 0 0 24px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.45;
  word-break: keep-all;
}

.ebook-body p {
  margin: 0;
}

.ebook-body p + p {
  margin-top: 20px;
}

.ebook-feedback {
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.ebook-feedback-form {
  position: relative;
  margin-top: 26px;
}

.ebook-feedback-form > label {
  display: block;
  margin-bottom: 9px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.ebook-feedback-form textarea {
  display: block;
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 15px 16px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  font-size: calc(15px * var(--reading-scale));
  line-height: 1.7;
}

.ebook-feedback-form textarea::placeholder {
  color: var(--color-text-muted);
}

.ebook-feedback-form textarea:focus {
  border-color: var(--color-accent);
}

.ebook-feedback-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ebook-feedback-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.ebook-feedback-actions button {
  min-width: 112px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: var(--color-navy);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ebook-feedback-actions button:hover,
.ebook-feedback-actions button:focus-visible {
  background: var(--color-accent-hover);
}

.ebook-feedback-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ebook-feedback-status {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.ebook-feedback-status[data-state="success"] {
  color: var(--color-navy);
  font-weight: 700;
}

.ebook-feedback-status[data-state="error"] {
  color: #8b352f;
}

.ebook-body .ebook-feedback-note {
  margin-top: 11px;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.post-engagement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.post-action-status {
  margin: 0;
}

.post-engagement-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.post-action:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  color: var(--color-navy);
}

.post-action:disabled {
  cursor: default;
}

.post-action[hidden] {
  display: none;
}

.post-action-status {
  min-height: 18px;
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.post-action-status:empty {
  display: none;
}

.license-note {
  margin-top: 66px;
  padding: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.license-note h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.license-note p {
  margin: 8px 0 0;
  color: var(--color-text-secondary);
  font-size: calc(11px * var(--reading-scale));
  line-height: 1.75;
  overflow-wrap: break-word;
  word-break: keep-all;
}

.search-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(720px, calc(100vh - 40px));
  padding: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 18px 48px rgba(37, 43, 48, 0.16);
}

.search-dialog::backdrop {
  background: rgba(37, 43, 48, 0.35);
}

.dialog-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--color-border);
}

.dialog-search input {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px;
  font-size: 16px;
  outline: 0;
}

.dialog-close {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 6px 9px;
  cursor: pointer;
  font-size: 11px;
}

.dialog-results {
  max-height: 560px;
  overflow-y: auto;
  padding: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.dialog-status {
  margin: 0;
  padding: 10px 16px 4px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.dialog-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  color: inherit;
  text-decoration: none;
}

.dialog-result:hover,
.dialog-result:focus-visible {
  background: var(--color-accent-light);
}

.dialog-result strong {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.55;
}

.dialog-result small {
  color: var(--color-text-muted);
  font-size: 10px;
}

@media (max-width: 1180px) {
  .docs-header {
    grid-template-columns: 240px minmax(240px, 480px) 1fr auto;
  }

  .docs-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .docs-shell--standalone {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 779px) {
  .docs-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 58px;
    padding: 0 14px;
  }

  .sidebar-toggle {
    display: block;
  }

  .docs-brand {
    font-size: 14px;
  }

  .global-search {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 10px;
  }

  .docs-header .text-size {
    grid-column: 3;
  }

  .docs-header--standalone {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .docs-header--standalone .text-size {
    display: none;
  }

  .docs-shell {
    grid-template-columns: 1fr;
    padding-top: 106px;
  }

  .docs-shell--standalone {
    padding-top: 58px;
  }

  .docs-sidebar {
    position: fixed;
    inset: 106px auto 0 0;
    z-index: 25;
    width: min(310px, 86vw);
    height: auto;
    transform: translateX(-101%);
    transition: transform 180ms ease;
    box-shadow: 12px 0 28px rgba(37, 43, 48, 0.12);
  }

  body.sidebar-open .docs-sidebar {
    transform: translateX(0);
  }

  .docs-landing,
  .docs-document {
    width: min(100% - 40px, 820px);
    padding: 48px 0 72px;
  }

  .doc-card-grid {
    grid-template-columns: 1fr;
  }

  .featured-chapter-grid {
    grid-template-columns: 1fr;
  }

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

  .ebook-feedback-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .featured-chapter {
    min-height: 0;
  }

  .doc-card {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .docs-landing h1,
  .docs-document h1 {
    font-size: 33px;
    text-wrap: balance;
  }

  .docs-lead {
    font-size: calc(16px * var(--reading-scale));
  }

  .featured-chapter {
    padding: 20px;
  }

  .featured-chapter strong {
    font-size: 21px;
  }

  .post-engagement {
    grid-template-columns: 1fr;
  }

  .post-engagement-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .post-action {
    justify-content: space-between;
  }

  .doc-card p {
    display: none;
  }

  .doc-section-head {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .doc-list a {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .doc-list strong,
  .doc-list small {
    overflow-wrap: break-word;
    white-space: normal;
    word-break: keep-all;
  }
}

@media print {
  .docs-header,
  .docs-sidebar,
  .docs-toc,
  .post-engagement {
    display: none;
  }

  .docs-shell {
    display: block;
    padding: 0;
  }
}
