:root {
  --article-max: 42rem;
  --article-muted: var(--muted, #64748b);
  --article-border: var(--line, #e5e9f0);
  --article-border-strong: var(--line-strong, #cbd5e1);
  --article-accent: var(--accent, #2563eb);
  --article-risk: #b91c1c;
  --article-limit: #92400e;
  --ink: #0f172a;
  --ink-2: #334155;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --line: #e5e9f0;
  --line-strong: #cbd5e1;
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --fs-h1: clamp(2.125rem, 1.35rem + 2.4vw, 3rem);
  --fs-h2: clamp(1.35rem, 1.05rem + 1vw, 1.75rem);
  --fs-h3: 1.0625rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-mono: 0.8125rem;
  --radius: 10px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.72;
  color: var(--ink);
  background: var(--bg);
  word-break: keep-all;
}

.article-wrap a {
  color: var(--article-accent);
  text-decoration: none;
  border-bottom: 1px solid var(--article-border-strong);
}

.article-wrap a:hover {
  color: var(--accent-ink, #1e40af);
  border-color: var(--accent-ink, #1e40af);
}

.article-topbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--article-border);
  padding: 0.75rem 1rem;
  position: static;
  top: 0;
  z-index: 10;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.article-topbar__inner {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.article-topbar a {
  color: var(--ink);
  border-bottom: 0;
  font-size: var(--fs-small);
  font-weight: 600;
}

.article-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.article-actions button,
.article-actions a.btn-print {
  font: 600 var(--fs-small) / 1 var(--font);
  min-height: 2.4rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--article-border-strong);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}

.article-actions button:hover,
.article-actions a.btn-print:hover {
  border-color: var(--ink);
}

.article-wrap {
  max-width: var(--article-max);
  margin: 0 auto;
  padding: clamp(3rem, 2rem + 4vw, 5rem) 1.25rem 5rem;
  background: var(--bg);
}

.article-series,
.article-part,
.article-reading-time,
.article-medium-meta {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--article-muted);
}

.article-series,
.article-part {
  margin: 0 0 0.35rem;
}

.article-part {
  color: var(--accent-ink, #1e40af);
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 0.75rem 0 0.75rem;
  color: var(--ink);
  text-wrap: balance;
}

.article-subtitle {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 1.5rem;
  font-weight: 500;
}

.article-meta {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  color: var(--article-muted);
  margin: 0 0 2.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--article-border);
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 2.75rem 0 0.9rem;
  color: var(--ink);
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.35;
  margin: 1.75rem 0 0.65rem;
  color: var(--ink);
}

.article-wrap p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.4rem;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  border: 1px solid var(--article-border);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

.article-callout {
  border: 1px solid var(--article-border);
  border-left: 2px solid var(--article-accent);
  background: var(--bg);
  padding: 1rem 1.15rem;
  margin: 1.4rem 0;
  border-radius: var(--radius);
}

.article-callout--limit {
  border-left-color: var(--article-limit);
}

.article-callout--risk {
  border-left-color: var(--article-risk);
}

.article-callout--pilot {
  border-left-color: var(--ink-2);
}

.article-callout--v2 {
  border-left-color: var(--accent-ink, #1e40af);
}

.article-callout h3,
.article-callout--v2 h3 {
  margin-top: 0;
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.article-callout--limit h3 {
  color: var(--article-limit);
}

.article-callout--risk h3 {
  color: var(--article-risk);
}

.article-callout--pilot h3 {
  color: var(--ink-2);
}

.article-code {
  font-family: var(--mono);
  font-size: 0.88rem;
  background: var(--bg-alt);
  border: 1px solid var(--article-border);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}

.article-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--article-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.article-nav a {
  color: var(--ink);
  font-weight: 600;
}

body.lang-is-ko .lang-en {
  display: none !important;
}

body.lang-is-en .lang-ko {
  display: none !important;
}

.article-lang-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--article-border-strong);
  border-radius: 999px;
}

.article-lang-toggle button {
  font: 700 0.75rem / 1 var(--mono);
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--article-muted);
  cursor: pointer;
}

.article-lang-toggle button.is-active {
  background: var(--ink);
  color: #fff;
}

.article-reading-time {
  margin: 0 0 1.25rem;
}

.article-toc {
  border-block: 1px solid var(--article-border);
  padding: 1rem 0;
  margin: 1.75rem 0;
}

.article-toc strong {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-toc ol {
  margin: 0.75rem 0 0;
}

table.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
  margin: 1rem 0;
}

table.article-table th,
table.article-table td {
  border: 1px solid var(--article-border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

table.article-table th {
  background: var(--bg-alt);
  font-weight: 700;
}

.article-figure {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--article-border);
}

.article-figure figcaption {
  font-size: var(--fs-small);
  color: var(--article-muted);
  margin-top: 0.75rem;
  text-align: center;
}

.article-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.article-flow__node {
  padding: 0.42rem 0.65rem;
  background: #fff;
  border: 1px solid var(--article-border);
  border-radius: 7px;
  font-weight: 600;
}

.article-flow__node--core,
.article-flow__node--v2 {
  border-color: var(--article-accent);
  color: var(--accent-ink, #1e40af);
}

.article-flow__arrow {
  color: var(--article-muted);
  font-weight: 700;
}

.article-flow--stack {
  flex-direction: column;
  align-items: stretch;
  max-width: 22rem;
  margin: 0 auto;
}

.article-flow--stack .article-flow__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .article-topbar__inner {
    align-items: stretch;
  }

  .article-actions {
    width: 100%;
  }

  .article-actions button,
  .article-actions a.btn-print {
    min-height: 2.75rem;
  }
}

@media print {
  .article-topbar,
  .article-actions,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .article-wrap {
    max-width: 100%;
    padding: 0;
  }
}
/* ============================================================
   Inlined site chrome (styles.css) sets `.lang-en { display:none }`
   by default and `display:inline` when EN is active. Article body EN
   content is block-level, so restore block flow for it under EN.
   Inline <span class="lang-en"> inside copy is intentionally left inline.
   ============================================================ */
body.lang-is-en .article-wrap h1.lang-en,
body.lang-is-en .article-wrap h2.lang-en,
body.lang-is-en .article-wrap h3.lang-en,
body.lang-is-en .article-wrap p.lang-en,
body.lang-is-en .article-wrap ul.lang-en,
body.lang-is-en .article-wrap ol.lang-en,
body.lang-is-en .article-wrap nav.lang-en,
body.lang-is-en .article-wrap figcaption.lang-en,
html.lang-is-en .article-wrap h1.lang-en,
html.lang-is-en .article-wrap h2.lang-en,
html.lang-is-en .article-wrap h3.lang-en,
html.lang-is-en .article-wrap p.lang-en,
html.lang-is-en .article-wrap ul.lang-en,
html.lang-is-en .article-wrap ol.lang-en,
html.lang-is-en .article-wrap nav.lang-en,
html.lang-is-en .article-wrap figcaption.lang-en {
  display: block;
}
/* ============================================================
   Mobile safety: KO copy uses word-break:keep-all, so long inline
   tokens (URLs, code, mixed EN terms) can force horizontal overflow
   on narrow screens. Allow these to break only when they would overflow.
   ============================================================ */
.article-wrap p,
.article-wrap li,
.article-wrap h1,
.article-wrap h2,
.article-wrap h3,
.article-wrap figcaption,
.article-wrap .article-flow__node {
  overflow-wrap: anywhere;
}

.article-wrap code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

table.article-table {
  table-layout: fixed;
}

table.article-table th,
table.article-table td {
  overflow-wrap: anywhere;
}

/* Language toggle: article.js now syncs BOTH html.lang-is-en and body
   (mirroring script.js), so the FOUC html show/hide rules and the body
   state stay consistent in both directions — no CSS override needed. */
