:root {
  --ink: #171b1d;
  --muted: #5d686d;
  --paper: #f4f2eb;
  --panel: #fffefa;
  --line: #aeb8bc;
  --line-dark: #667278;
  --accent: #ef4b2c;
  --accent-dark: #a82d19;
  --teal: #146b70;
  --code: #20282c;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, "Noto Sans KR", sans-serif;
  line-height: 1.75;
}

a {
  color: inherit;
}

code,
pre,
.source-path {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(220px, 340px) auto;
  align-items: center;
  min-height: 54px;
  padding: 0 24px;
  color: #fff;
  background: #273136;
  border-bottom: 3px solid var(--accent);
}

.topbar a {
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.topbar-title {
  overflow: hidden;
  padding: 0 18px;
  color: #d8e0e3;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-source {
  color: #fff;
}

.translated-document .topbar {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.topbar-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.topbar-search span {
  color: #d8e0e3;
  font-size: 11px;
  font-weight: 800;
}

.topbar-search input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #fff;
  border-radius: 0;
  font: inherit;
  font-size: 12px;
}

.documents-hero {
  color: #fff;
  background: #354149;
  border-bottom: 1px solid var(--line-dark);
}

.documents-hero-inner {
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto;
  padding: 68px 0 58px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #ffb29f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.documents-hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: 72px;
  line-height: 1.05;
}

.documents-hero p:not(.eyebrow) {
  max-width: 780px;
  margin: 24px 0 0;
  color: #e2e7e9;
  font-size: 17px;
}

.document-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(calc(100% - 48px), var(--max-width));
  margin: -1px auto 0;
  background: var(--panel);
  border: 1px solid var(--line-dark);
}

.document-meta--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.document-meta > div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.document-meta > div:last-child {
  border-right: 0;
}

.document-meta span,
.document-meta strong {
  display: block;
}

.document-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.document-meta strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.documents-main,
.doc-layout {
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto;
}

.documents-main {
  padding: 48px 0 80px;
}

.category-summary {
  margin-bottom: 42px;
}

.category-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-dark);
  border-left: 1px solid var(--line-dark);
}

.category-summary-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  font-size: 13px;
}

.category-summary-item strong {
  color: var(--accent-dark);
}

[data-zephyr-document][hidden] {
  display: none;
}

.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.catalog-heading h2,
.catalog-section h2,
.doc-section h2 {
  margin: 0;
  line-height: 1.2;
}

.catalog-heading p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.catalog-section {
  padding: 38px 0;
}

.catalog-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.catalog-section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.catalog-section-entries {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.document-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  gap: 30px;
  padding: 24px;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line-dark);
  border-left: 5px solid var(--accent);
}

.document-entry:hover {
  background: #fff;
  border-color: var(--accent-dark);
}

.document-entry h3 {
  margin: 4px 0 6px;
  font-size: 22px;
}

.document-entry p {
  margin: 0;
  color: var(--muted);
}

.source-path {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.document-status {
  align-self: start;
  padding: 5px 8px;
  color: #fff;
  background: var(--teal);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.source-note {
  padding: 22px;
  background: #e8eeee;
  border-left: 5px solid var(--teal);
}

.source-note p {
  margin: 0;
}

.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 44px;
  padding: 48px 0 88px;
}

.doc-toc {
  position: sticky;
  top: 82px;
  align-self: start;
  border-top: 2px solid var(--ink);
}

.doc-toc strong,
.doc-toc a {
  display: block;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

.doc-toc strong {
  font-size: 13px;
}

.doc-toc a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--accent-dark);
}

.doc-content {
  min-width: 0;
}

.doc-section {
  padding: 0 0 52px;
  scroll-margin-top: 80px;
}

.doc-section + .doc-section {
  padding-top: 48px;
  border-top: 2px solid var(--ink);
}

.doc-section > h2 {
  margin-bottom: 18px;
  font-size: 30px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.summary-item {
  min-height: 150px;
  padding: 18px;
  background: var(--panel);
  border-top: 4px solid var(--accent);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.summary-item strong {
  display: block;
  margin-bottom: 8px;
}

.summary-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.doc-figure {
  margin: 24px 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.doc-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
  object-fit: contain;
}

.doc-figure figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.service-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 28px 0;
  border: 1px solid var(--line-dark);
}

.service-map div {
  min-width: 0;
  padding: 15px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.service-map div:last-child {
  border-right: 0;
}

.service-map strong,
.service-map span {
  display: block;
}

.service-map strong {
  font-size: 13px;
}

.service-map span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.practical-note {
  margin: 24px 0;
  padding: 18px 20px;
  background: #fff4ef;
  border-left: 5px solid var(--accent);
}

.practical-note strong {
  display: block;
  margin-bottom: 5px;
}

.source-details {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line-dark);
}

.source-details > summary {
  padding: 16px 18px;
  cursor: pointer;
  color: #fff;
  background: #354149;
  font-weight: 900;
}

.source-integrity {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  color: #243037;
  background: #e8eeee;
  border-bottom: 1px solid var(--line-dark);
}

.source-integrity span {
  color: #53646c;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.source-integrity code {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.source-pre {
  max-width: 100%;
  max-height: 72vh;
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #152126;
  background: #fbfaf5;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.source-body,
.translation-body {
  min-width: 0;
  padding: 26px;
}

.doc-content {
  min-width: 0;
}

.translation-body pre {
  max-width: 100%;
  margin: 16px 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: #fff;
  background: var(--code);
  font-size: 13px;
  line-height: 1.55;
}

.long-code-path,
.long-code-path code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.translation-body p code,
.translation-body li code,
.translation-body dt code,
.translation-body dd code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-body h3,
.translation-body h3 {
  margin: 34px 0 10px;
  font-size: 22px;
}

.source-body h3:first-child,
.translation-body h3:first-child {
  margin-top: 0;
}

.source-body ul,
.translation-body ul {
  padding-left: 22px;
}

.table-wrap {
  max-width: 100%;
  margin: 20px 0;
  overflow-x: auto;
}

.doc-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--panel);
}

.doc-table th,
.doc-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
}

.doc-table th {
  background: #dfe6e6;
  text-align: left;
}

.footnotes {
  padding: 16px 18px;
  background: #eef1f1;
  border-left: 4px solid var(--teal);
}

.footnotes p {
  margin: 0 0 10px;
}

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

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.source-links a {
  padding: 7px 10px;
  color: var(--accent-dark);
  background: var(--panel);
  border: 1px solid var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  color: #dce3e5;
  background: #273136;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto;
  padding: 24px 0;
  font-size: 12px;
}

.footer-inner a {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 900px) {
  .document-meta,
  .summary-grid,
  .service-map {
    grid-template-columns: 1fr 1fr;
  }

  .category-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-meta > div,
  .service-map div {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

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

  .doc-toc {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .translated-document .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
  }

  .translated-document .topbar-source {
    justify-self: end;
  }

  .topbar-title {
    display: none;
  }

  .topbar-search {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 7px 0 9px;
  }

  .documents-hero-inner,
  .documents-main,
  .doc-layout,
  .document-meta,
  .footer-inner {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .documents-hero-inner {
    padding: 46px 0 40px;
  }

  .documents-hero h1 {
    font-size: 39px;
  }

  .document-meta,
  .summary-grid,
  .service-map,
  .document-entry,
  .category-summary-grid {
    grid-template-columns: 1fr;
  }

  .catalog-heading,
  .catalog-section-heading,
  .footer-inner {
    align-items: start;
    flex-direction: column;
  }

  .document-status {
    justify-self: start;
  }

  .source-body,
  .translation-body {
    padding: 18px;
  }
}
