/* 1209 웹 마을 포트폴리오 공용 스타일. 겨울밤 팔레트(B안)와 같은 색을 쓴다. */
:root {
  --bg: #0d1430;
  --bg-deep: #090e22;
  --surface: #151e40;
  --surface-2: #1c2750;
  --line: #2a3768;
  --text: #ecEFF8;
  --muted: #a9b2cf;
  --accent: #ffa94d;
  --accent-soft: #ffcf86;
  --accent-ink: #2a1600;
  --snow: #dfe7ff;
  --pine: #2f7a63;
  --radius: 14px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 70% -120px, rgba(255, 169, 77, 0.10), transparent 70%),
    linear-gradient(180deg, var(--bg-deep), var(--bg) 380px);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; display: block; }

a { color: var(--accent-soft); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(9, 14, 34, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; min-height: 44px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 3px rgba(255, 169, 77, 0.55); flex: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 10px; border-radius: 8px; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--accent-soft); }
.back { font-size: 14px; }

/* 페이지 머리 */
.page-head { padding: 48px 0 24px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; margin: 0 0 8px; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { font-size: clamp(21px, 3vw, 27px); line-height: 1.35; margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 18px; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 17px; margin: 0; max-width: 46em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

section.block { padding: 28px 0; }
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  box-shadow: 0 0 24px rgba(255, 169, 77, 0.25);
}
.btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent-soft); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 13px; }

/* 입구 페이지 */
.hero { padding: 40px 0 8px; }
.hero-scene { margin-top: 28px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.hero-scene svg { width: 100%; height: auto; }
.scope { display: inline-block; margin: 0 0 14px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }

.entries { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.entry { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); transition: transform 0.15s ease, border-color 0.15s ease; }
.entry:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }
.entry .num { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; }
.entry p { margin: 0; color: var(--muted); }
.entry .go { margin-top: auto; color: var(--accent-soft); font-weight: 700; font-size: 15px; }
.entry.primary { border-color: rgba(255, 169, 77, 0.55); box-shadow: 0 0 0 1px rgba(255, 169, 77, 0.15), 0 10px 30px rgba(255, 169, 77, 0.08); }

.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; position: relative; }
.flow li { position: relative; padding: 40px 12px 0 0; }
.flow li::before { content: ""; position: absolute; top: 9px; left: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px 4px rgba(255, 169, 77, 0.45); }
.flow li::after { content: ""; position: absolute; top: 18px; left: 28px; right: 8px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--line)); }
.flow li:last-child::after { display: none; }
.flow .when { color: var(--accent-soft); font-size: 13px; font-weight: 700; }
.flow strong { display: block; font-size: 18px; margin: 2px 0 4px; }
.flow span.desc { color: var(--muted); font-size: 14px; }

.refs-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.refs-link p { margin: 0; color: var(--muted); }

/* 문서 페이지 */
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 76px; font-size: 14px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent-soft); }
.doc-body { min-width: 0; max-width: 760px; }
.doc-body section { padding: 8px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; scroll-margin-top: 72px; }
.doc-body section:last-child { border-bottom: 0; }
.doc-body p { margin: 0 0 12px; }
.doc-body ul { margin: 0 0 12px; padding-left: 1.2em; }
.doc-body li { margin: 4px 0; }
.doc-body li::marker { color: var(--accent); }
.doc-meta { color: var(--muted); }
.option { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.option.pick { border-left-color: var(--accent); }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0 16px; }
.table-scroll:focus-visible { outline: 2px solid var(--accent); }
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.6; }
.table-scroll table { min-width: 760px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 7em; }
th { background: var(--surface-2); color: var(--accent-soft); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--text); font-weight: 600; }
.scroll-hint { display: none; font-size: 12px; color: var(--muted); margin: 0 0 4px; }

/* 시안 페이지 */
.concepts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.concept { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.concept.pick { border-color: rgba(255, 169, 77, 0.7); box-shadow: 0 0 0 1px rgba(255, 169, 77, 0.2), 0 12px 36px rgba(255, 169, 77, 0.10); }
.concept-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.concept-head h2 { font-size: 20px; margin: 0; }
.tag { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.hot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.scene { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 8 / 5; }
.scene svg { width: 100%; height: 100%; }
.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.swatch { height: 34px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.12); }
.swatch-label { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; font-variant-numeric: tabular-nums; }
.objects { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.obj { border-radius: 8px; border: 1px solid var(--line); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 6px; }
.obj svg { width: 100%; height: 100%; }
.concept dl { margin: 0; display: grid; gap: 6px; font-size: 14px; }
.concept dt { color: var(--accent-soft); font-weight: 700; }
.concept dd { margin: 0 0 4px; color: var(--muted); }
.label { font-size: 12px; color: var(--muted); margin: 0 0 6px; font-weight: 700; letter-spacing: 0.04em; }

.why { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.why ol { margin: 0 0 16px; padding-left: 1.3em; }
.why li { margin: 6px 0; }
.why li::marker { color: var(--accent); font-weight: 700; }

/* 레퍼런스 페이지 */
.ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ref { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.ref-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ref-top h2 { font-size: 18px; margin: 0; }
.dim { flex: none; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 6px; letter-spacing: 0.04em; }
.dim.d2 { background: rgba(255, 169, 77, 0.16); color: var(--accent-soft); border: 1px solid rgba(255, 169, 77, 0.45); }
.dim.d3 { background: rgba(140, 170, 255, 0.14); color: #c3d2ff; border: 1px solid rgba(140, 170, 255, 0.45); }
.ref-link { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ref-link a { display: inline-flex; align-items: center; min-height: 44px; }
.unverified { font-size: 12px; color: #ffd9a8; background: rgba(255, 169, 77, 0.10); border: 1px dashed rgba(255, 169, 77, 0.5); border-radius: 6px; padding: 1px 8px; }
.ref p { margin: 0; font-size: 14px; }
.ref .k { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 2px; }
.ref .take .k { color: var(--accent-soft); }
.ref .avoid .k { color: #9fb0e8; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.count { display: inline-flex; align-items: center; gap: 6px; }
.closing { border-left: 3px solid var(--accent); }
.closing p { margin: 0; }

/* 반응형 */
@media (max-width: 960px) {
  .concepts { grid-template-columns: minmax(0, 1fr); }
  .concept { max-width: 640px; }
  .doc { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 4px; border-left: 0; }
  .toc a { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; display: flex; align-items: center; }
  .why { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .entries { grid-template-columns: minmax(0, 1fr); }
  .ref-grid { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow li { padding: 0 0 22px 40px; }
  .flow li::before { top: 4px; }
  .flow li::after { top: 30px; bottom: 0; left: 9px; right: auto; width: 2px; height: auto; background: linear-gradient(180deg, var(--accent), var(--line)); }
  .scroll-hint { display: block; }
  .page-head { padding: 32px 0 16px; }
  .hero-scene svg { height: 160px; }
}

@media (max-width: 420px) {
  .wrap { padding: 0 16px; }
  .nav a { padding: 10px 7px; font-size: 13px; }
  .brand-text { font-size: 15px; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
