:root {
  --primary: #1b2e24;
  --secondary: #5c6b62;
  --tertiary: #b87333;
  --neutral: #f4f1ea;
  --surface: #fffdf8;
  --paper-deep: #e8e0d2;
  --rule: #c9c0b0;
  --success: #2f6f4e;
  --error: #a33b32;
  --ink-body: #2f3d35;
  --focus: #2a5f8f;
  --shadow: 0 1px 0 rgba(27, 46, 36, 0.04), 0 8px 24px rgba(27, 46, 36, 0.06);
  --radius-sm: 2px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  font-family: "IBM Plex Sans KR", Pretendard, "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(184, 115, 51, 0.08), transparent),
    var(--neutral);
  color: var(--primary);
  line-height: 1.65;
  min-height: 100vh;
}

/* WCAG 2.2 — skip link (visible on focus) */
.skip-link {
  position: absolute;
  left: 12px;
  top: 0;
  z-index: 100;
  padding: 10px 14px;
  background: var(--primary);
  color: var(--surface);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transform: translateY(-120%);
  transition: transform 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(12px);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--primary); }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Top bar */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--tertiary); }
.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  font-size: 0.92rem;
}
.top-nav a {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
}
.top-nav a:hover { color: var(--primary); }
.top-nav a[aria-current="page"] {
  color: var(--primary);
  border-bottom: 2px solid var(--tertiary);
  padding-bottom: 1px;
}
.case-pill {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--secondary);
}

/* Layout */
.hero, .desk {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.hero { max-width: 880px; padding-top: 56px; }

h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0.2em 0 0.55em;
  font-weight: 700;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0 0 8px;
  font-weight: 700;
}
h3 {
  font-size: 0.95rem;
  margin: 0 0 10px;
  font-weight: 700;
}

.lede {
  color: var(--ink-body);
  max-width: 40rem;
  font-size: 1.05rem;
  margin: 0 0 1.25rem;
}
.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tertiary);
  font-weight: 600;
  margin: 0 0 8px;
}
.label-caps {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--secondary);
  font-weight: 500;
}
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.88rem; }
.meta { color: var(--secondary); font-size: 0.9rem; }
.fine {
  color: var(--secondary);
  font-size: 0.85rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

/* Notice banner */
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  margin: 0 0 28px;
  font-size: 0.9rem;
  color: var(--ink-body);
}
.banner strong {
  color: var(--primary);
  font-weight: 700;
}
.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tertiary);
  margin-top: 7px;
  flex-shrink: 0;
}

/* Surfaces */
.paper {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.sample {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0 32px;
}
.sample-item {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 96px;
}
.sample-item strong {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.sample-item code {
  display: block;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: var(--ink-body);
}

/* Buttons — min ~44px touch target on interactive controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-download {
  margin-top: 8px;
  font-size: 0.88rem;
}
.btn.primary {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}
.btn.primary:hover {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--primary);
}
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
}
.btn.secondary:hover {
  border-color: var(--tertiary);
  color: var(--tertiary);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* Scenario cards */
.scenario-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.scenario {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.scenario:hover {
  border-color: color-mix(in srgb, var(--tertiary) 55%, var(--rule));
  transform: translateY(-1px);
}
.scenario .desc {
  color: var(--ink-body);
  font-size: 0.92rem;
  margin: 0 0 8px;
  flex: 1;
}
.scenario .btn { align-self: flex-start; margin-top: 4px; }
.scenario-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--secondary);
}

/* Chips */
.chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
}
.chip.ok { background: #e3f0e8; color: var(--success); }
.chip.bad { background: #f7e4e2; color: var(--error); }
.chip.warn { background: #f5ebdd; color: #8a5a20; }
.chip.neutral { background: var(--paper-deep); color: var(--secondary); }

/* Proof strip */
.proof-strip {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}
.proof-step {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.proof-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 18px;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule);
}
.proof-body { padding: 16px 18px 18px; }
.step-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--tertiary);
  font-weight: 700;
}

/* Summary metrics */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.metric {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--neutral);
}
.metric .k {
  font-size: 0.72rem;
  color: var(--secondary);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.metric .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Tables */
.ledger {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  background: var(--surface);
  font-size: 0.9rem;
}
.ledger th, .ledger td {
  border: 1px solid var(--rule);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.ledger th {
  background: var(--paper-deep);
  font-weight: 600;
  width: 28%;
  color: var(--ink-body);
}
.ledger.summary th { width: 40%; }
.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", monospace;
}
.basis-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}
.basis-wrap .ledger { margin: 0; border: 0; }
.basis-wrap .ledger th:first-child,
.basis-wrap .ledger td:first-child { width: 22%; }
.basis-wrap .ledger th:nth-child(2),
.basis-wrap .ledger td:nth-child(2) { width: 28%; }

/* Filings */
.filing-grid {
  display: grid;
  gap: 12px;
}
.filing {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--neutral);
  padding: 14px 16px;
}
.filing .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.filing-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 10px 0;
  font-size: 0.85rem;
}
.filing-meta dt {
  color: var(--secondary);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}
.filing-meta dd {
  margin: 2px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  word-break: break-all;
}
details.raw-json {
  margin-top: 8px;
  border-top: 1px dashed var(--rule);
  padding-top: 8px;
}
details.raw-json summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--secondary);
  font-weight: 600;
  list-style: none;
}
details.raw-json summary::-webkit-details-marker { display: none; }
details.raw-json summary::before {
  content: "▸ ";
  color: var(--tertiary);
}
details.raw-json[open] summary::before { content: "▾ "; }
.file-body {
  max-height: 180px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Reasons */
.reasons {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.reasons li {
  padding: 8px 12px;
  background: #f7e4e2;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.reasons code {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: var(--error);
}

/* Interface doc */
.doc-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.doc-page h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: 0.2em;
}
.doc-page h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}
.doc-page h3 {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.55rem;
  color: var(--ink-body);
}
.doc-page p {
  margin: 0.55rem 0;
  color: var(--ink-body);
  line-height: 1.7;
}
.doc-page ul {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--ink-body);
}
.doc-page li { margin: 0.25rem 0; }
.doc-page code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86em;
  background: var(--paper-deep);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.doc-page pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}
.doc-page pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}
.doc-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 480px;
}
.doc-table th,
.doc-table td {
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.doc-table th:last-child,
.doc-table td:last-child { border-right: 0; }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table th {
  background: var(--paper-deep);
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}
.doc-table td { color: var(--ink-body); }
.doc-table td:first-child,
.doc-table th:first-child {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85rem;
}

/* Footer */
.site-footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--secondary);
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  .sample { grid-template-columns: 1fr; }
  .scenario-list { grid-template-columns: 1fr; }
  .top {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }
  .hero, .desk { padding: 28px 16px 64px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
