/* 프로젝트 포스트 공통 스타일 — 홈페이지(index.html)와 같은 토큰 */
:root {
  color-scheme: dark;
  --canvas: #121317; --canvas2: #0b0c0f; --panel: #1a1c22; --panel2: #22252c; --well: #000000;
  --ink: #f8f9fc; --ink2: #c9cfd8; --muted: #8f98a6; --hair: rgba(255,255,255,.12); --hair2: rgba(255,255,255,.07);
  --action: #8ab4ff; --action-ink: #c6d8ff; --action-soft: rgba(138,180,255,.14);
  --glow1: #1b3fd1; --glow2: #6d3bd8; --glow3: #0b8a8f; --good: #7ad28f; --warn: #ffb86b;
  --sans: "DM Sans", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --serif: "DM Serif Display", "Times New Roman", serif;
  --mono: "DM Mono", ui-monospace, Consolas, monospace;
  --radius: 16px; --rail: 1120px; --measure: 720px;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) {
  color-scheme: light;
  --canvas: #f9f9fb; --canvas2: #eef0f4; --panel: #ffffff; --panel2: #f1f3f7; --well: #121317;
  --ink: #121317; --ink2: #3b4250; --muted: #6b7482; --hair: rgba(18,19,23,.12); --hair2: rgba(18,19,23,.07);
  --action: #0000ee; --action-ink: #0000ee; --action-soft: rgba(0,0,238,.08);
  --glow1: #2a5bff; --glow2: #8a5cff; --glow3: #13a3a9; --good: #1a7f3a; --warn: #b86a00;
} }
:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #f9f9fb; --canvas2: #eef0f4; --panel: #ffffff; --panel2: #f1f3f7; --well: #121317;
  --ink: #121317; --ink2: #3b4250; --muted: #6b7482; --hair: rgba(18,19,23,.12); --hair2: rgba(18,19,23,.07);
  --action: #0000ee; --action-ink: #0000ee; --action-soft: rgba(0,0,238,.08);
  --glow1: #2a5bff; --glow2: #8a5cff; --glow3: #13a3a9; --good: #1a7f3a; --warn: #b86a00;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; font-optical-sizing: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
.rail { max-width: var(--rail); margin: 0 auto; padding-inline: clamp(20px, 4vw, 40px); }
.label { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-size: 15px; font-weight: 500; border: 1px solid var(--hair); color: var(--ink); background: transparent; transition: background .2s, border-color .2s; }
.btn:hover { background: var(--action-soft); border-color: var(--action); }
.btn.primary { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.btn.primary:hover { background: var(--action-ink); border-color: var(--action-ink); color: #0b0c0f; }

/* nav (홈과 동일) */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--canvas) 78%, transparent); border-bottom: 1px solid var(--hair2); }
.nav .rail { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { font-weight: 500; font-size: 17px; display: inline-flex; align-items: center; gap: 10px; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: conic-gradient(from 200deg, var(--glow1), var(--glow2), var(--glow3), var(--glow1)); display: inline-block; }
.crumbs { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--hair); background: transparent; color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--action-soft); }

/* 포스트 머리 */
.post-head { padding-block: clamp(40px, 6vw, 72px) 28px; display: grid; gap: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.meta .cat { color: var(--action-ink); font-weight: 500; }
.title { font-size: clamp(34px, 5vw, 58px); line-height: 1.08; max-width: 22ch; }
.standfirst { font-size: clamp(18px, 2vw, 22px); line-height: 1.5; color: var(--ink2); font-weight: 300; max-width: 60ch; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hero-media { margin-top: 22px; border-radius: var(--radius); overflow: hidden; background: var(--canvas2); border: 1px solid var(--hair2); }
.hero-media svg { display: block; width: 100%; height: auto; }
figcaption, .cap { font-size: 13.5px; color: var(--muted); font-style: italic; margin-top: 10px; line-height: 1.5; }
figure { margin: 0; }

/* 본문 */
.body { max-width: var(--measure); margin: 0 auto; padding-block: 36px 0; display: grid; gap: 22px; }
.body h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.2; margin-top: 30px; }
.body h3 { font-size: 21px; line-height: 1.3; margin-top: 10px; font-weight: 500; }
.body p { color: var(--ink2); font-weight: 300; }
.body p b, .body li b { color: var(--ink); font-weight: 500; }
.body ul, .body ol { margin: 0; padding-left: 1.2em; color: var(--ink2); font-weight: 300; display: grid; gap: 8px; }
.body code { font-family: var(--mono); font-size: .88em; background: var(--panel2); padding: 1px 6px; border-radius: 5px; color: var(--ink); }
.body table { border-collapse: collapse; width: 100%; font-size: 15px; }
.body th, .body td { text-align: left; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--hair2); vertical-align: top; }
.body th { font-weight: 500; color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.body td { color: var(--ink2); font-weight: 300; }
.body td:first-child { color: var(--ink); font-weight: 500; }
.tbl { overflow-x: auto; }
.key { background: var(--panel); border: 1px solid var(--hair2); border-radius: var(--radius); padding: 20px 22px; display: grid; gap: 10px; }
.key .label { color: var(--action-ink); }
.key ul { gap: 6px; }

/* 넓게 펼치는 블록 (데모·그림) */
.wide { max-width: var(--rail); margin: 30px auto 0; padding-inline: clamp(20px, 4vw, 40px); }
.demo-frame { border-radius: var(--radius); overflow: hidden; }
.demo-frame iframe { display: block; width: 100%; height: 620px; border: 0; background: transparent; }
.demo-frame + .cap a { color: var(--action-ink); font-style: normal; }
.diagram { background: var(--panel); border: 1px solid var(--hair2); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 560px; }

/* 기술 섹션: 머리의 Built with 칩 + How it's built (파이프라인, 스택, 수식, 운영 vs 데모) */
.built { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.built .label { margin-right: 4px; }
.built span:not(.label) { font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--hair); color: var(--ink2); background: var(--panel); white-space: nowrap; }
.tech { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 18px; }
.tech > * { min-width: 0; }
@media (max-width: 560px) { .tcard td:first-child { white-space: normal; } .tcard table { font-size: 13px; } .formula { font-size: 12px; } }
.tech-head { display: grid; gap: 8px; max-width: var(--measure); }
.tech-head .label { color: var(--action-ink); }
.tech-head h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.2; }
.tech-head p { color: var(--ink2); font-weight: 300; }
.arch { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.st { position: relative; background: var(--panel); border: 1px solid var(--hair2); border-radius: 14px; padding: 14px 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.st .label { color: var(--action-ink); }
.st h4 { font-size: 16px; font-weight: 500; line-height: 1.3; }
.st p { font-size: 13.5px; color: var(--ink2); font-weight: 300; line-height: 1.5; }
.st .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.st .chips span { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--panel2); color: var(--ink); }
@media (min-width: 900px) { .st:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 14px; color: var(--muted); font-size: 14px; } }
.tech-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 860px) { .tech-grid { grid-template-columns: 1fr; } }
.tcard { background: var(--panel); border: 1px solid var(--hair2); border-radius: 14px; padding: 16px 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.tcard > .label { color: var(--action-ink); }
.tcard table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tcard th, .tcard td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hair2); vertical-align: top; line-height: 1.45; }
.tcard tr:last-child td { border-bottom: 0; }
.tcard th { font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; font-family: var(--mono); }
.tcard td { color: var(--ink2); font-weight: 300; }
.tcard td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }
.tcard td code, .tcard li code { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.tcard .tbl { overflow-x: auto; }
.formula { margin: 0; background: var(--canvas2); border: 1px solid var(--hair2); border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--ink); overflow-x: auto; white-space: pre; }
.tcard ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: 14px; color: var(--ink2); font-weight: 300; line-height: 1.5; }
.tcard ul b { color: var(--ink); font-weight: 500; }

/* ── 기술 블로그 형식 (AWS 블로그식): 목차, 번호 아키텍처 다이어그램, 단계 설명, 코드 블록 ── */
.toc { background: var(--panel); border: 1px solid var(--hair2); border-radius: 14px; padding: 14px 18px; display: grid; gap: 8px; }
.toc .label { color: var(--action-ink); }
.toc ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; font-size: 15px; color: var(--ink2); font-weight: 400; }
.toc a:hover { color: var(--action-ink); }
.archfig { background: var(--panel); border: 1px solid var(--hair2); border-radius: var(--radius); padding: 22px 22px 18px; display: grid; gap: 14px; }
.archfig > .label { color: var(--action-ink); }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 16px; padding: 6px 4px 0; }
.node { position: relative; background: var(--panel2); border: 1px solid var(--hair); border-radius: 12px; padding: 16px 12px 12px; display: grid; gap: 5px; align-content: start; min-width: 0; }
.node .n { position: absolute; top: -11px; left: -9px; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); color: #0b0c0f; font: 600 12px/24px var(--mono); text-align: center; }
.node .g { font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.node h4 { font-size: 15px; font-weight: 500; line-height: 1.3; }
.node .tk { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.node .tk span { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--canvas2); color: var(--ink); border: 1px solid var(--hair2); }
@media (min-width: 900px) { .node:not(:last-child)::after { content: ""; position: absolute; right: -14px; top: 50%; width: 12px; height: 2px; background: var(--muted); } .node:not(:last-child)::before { content: ""; position: absolute; right: -15px; top: calc(50% - 4px); border: 5px solid transparent; border-left-color: var(--muted); border-right: 0; } }
.archfig figcaption { margin-top: 0; }
ol.steps { counter-reset: step; list-style: none; padding-left: 0; display: grid; gap: 12px; }
ol.steps li { counter-increment: step; position: relative; padding-left: 38px; }
ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); color: #0b0c0f; font: 600 12px/24px var(--mono); text-align: center; }
.stack { overflow-x: auto; }
.stack td:nth-child(2) { font-family: var(--mono); font-size: 13.5px; color: var(--ink); }
.code { border: 1px solid var(--hair2); border-radius: 12px; overflow: hidden; background: #0d0e12; }
.code .bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: #16181d; border-bottom: 1px solid rgba(255,255,255,.07); font-family: var(--mono); font-size: 12px; color: #8f98a6; }
.code .bar button { font: inherit; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: transparent; color: #c9cfd8; cursor: pointer; }
.code .bar button:hover { border-color: #8ab4ff; color: #f8f9fc; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.65; color: #e6e9ef; tab-size: 4; }
.code pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.code-cap { font-size: 13px; color: var(--muted); margin-top: -12px; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal { color: #8ab4ff; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #7ad28f; }
.hljs-number, .hljs-symbol { color: #ffb86b; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #7d8594; font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-title.class_ { color: #f5d38a; }
.hljs-params, .hljs-variable, .hljs-attr, .hljs-property { color: #e6e9ef; }
.hljs-decorator, .hljs-meta .hljs-keyword { color: #c8a5ff; }
.math { margin: 0; background: var(--panel); border: 1px solid var(--hair2); border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--ink); overflow-x: auto; white-space: pre; }
.callout { border-left: 3px solid var(--warn); background: var(--panel); border-radius: 0 10px 10px 0; padding: 12px 16px; color: var(--ink2); font-weight: 300; }
.callout b { color: var(--ink); font-weight: 500; }
@media (max-width: 560px) { .code pre, .math { font-size: 12px; } .stack td:nth-child(2) { font-size: 12.5px; } }

/* 결과 지표 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); margin-top: 6px; }
.stat { padding: 18px 16px 18px 0; border-right: 1px solid var(--hair2); display: grid; gap: 4px; }
.stat:last-child { border-right: 0; }
.stat + .stat { padding-left: 16px; }
.stat b { font-size: 30px; font-weight: 400; line-height: 1.1; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }

/* 작성자·관련 */
.author { max-width: var(--measure); margin: 40px auto 0; padding-top: 22px; border-top: 1px solid var(--hair); display: grid; gap: 6px; font-size: 14.5px; color: var(--muted); }
.author b { color: var(--ink); font-weight: 500; }
.related { padding-block: 56px 72px; }
.related h2 { font-size: 24px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--hair2); border-radius: var(--radius); padding: 20px; display: grid; gap: 8px; align-content: start; }
.card:hover { border-color: var(--action); }
.card .label { color: var(--action-ink); }
.card h3 { font-size: 19px; font-weight: 500; }
.card p { font-size: 14.5px; color: var(--ink2); font-weight: 300; }
.card .d { font-size: 13px; color: var(--muted); }
footer { background: var(--well); color: #b2bbc5; font-size: 13px; }
footer .rail { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding-block: 22px 34px; }
footer a:hover { color: #fff; }
@media (max-width: 640px) { .demo-frame iframe { height: 1500px; } }
