/* ==========================================================
   engine.css
   KADO Engine — Reset, 헤딩 위계, 컨테이너, eyebrow, 모션, 데모 컨트롤. 페이지 공통 레이아웃 규칙.
   Last sync: 2026-05-02 · Source: KADO-Showcase.html
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--fg-base);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
input { font-family: inherit; }

/* Headings — DS §3.5 TYPE 프리셋 1:1 정합
   h1: 32 / 700 / 1.2  / -0.015em
   h2: 26 / 700 / 1.25 / -0.012em
   h3: 22 / 600 / 1.3  / -0.008em
   h4: 18 / 600 / 1.35 / -0.005em */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--fw-bd); }
h1 { font-size: var(--fs-h1); line-height: 1.2;  letter-spacing: -0.015em; font-weight: var(--fw-bk); }
h2 { font-size: var(--fs-h2); line-height: 1.25; letter-spacing: -0.012em; font-weight: var(--fw-bk); }
h3 { font-size: var(--fs-h3); line-height: 1.3;  letter-spacing: -0.008em; }
h4 { font-size: var(--fs-h4); line-height: 1.35; letter-spacing: -0.005em; }
p { margin: 0; }

/* 숫자 정렬 — Pretendard도 tnum 지원하므로 mono 폰트 패밀리 불필요 */
.tabular, .mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* Eyebrow = DS §3.5 group-head 1:1 정합
   10px / 400 / uppercase / 0.04em / --fg-muted (단일 진실원) */
.eyebrow {
  font-size: var(--fs-caption-xs);   /* 10 */
  font-weight: var(--fw-rg);         /* 400 */
  text-transform: uppercase;
  letter-spacing: 0.04em;            /* spec tracking-uppercase-md */
  color: var(--fg-muted);
  line-height: 1;
}

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-4); }

/* v0.7: 인풋 포커스링 — 폼 컨트롤은 박스 자체에 부드러운 ring 표시
   (mouse/keyboard 모두 동작 — :focus 사용. :where()는 specificity 0이라 컴포넌트 규칙이 덮어쓰지 않음) */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"])):focus,
:where(textarea):focus,
:where(select):focus {
  outline: none;
  box-shadow: var(--focus-ring-input);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Layout */
.container { max-width: var(--content-max); margin-inline: auto; padding-inline: var(--edge-margin); }
.section { padding-block: var(--stack-lg); }
.section--xl { padding-block: var(--stack-xl); }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; gap: var(--stack-md); flex-wrap: wrap; }
.section-head__title { display: flex; flex-direction: column; gap: var(--stack-xs); }
.section-head__title .eyebrow { margin-bottom: var(--stack-xs); }
.section-head__sub { font-size: var(--fs-caption); color: var(--fg-muted); margin-top: 2px; }
.link-more {
  font-size: var(--fs-caption); font-weight: var(--fw-bd);
  color: var(--fg-faint); border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2px; transition: var(--t-fast) ease-out;
}
.link-more:hover { color: var(--fg-base); border-color: var(--fg-base); }

/* Stagger fade-in */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { opacity: 0; animation: fadeUp 320ms var(--ease-emp) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(8) { animation-delay: 350ms; }

/* Material Symbols base */
.mi {
  font-family: 'Material Symbols Outlined';
  font-weight: 400; font-style: normal;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  line-height: 1; vertical-align: middle;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'liga';
  display: inline-block; user-select: none;
}
.mi--filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.mi--lg { font-size: var(--icon-lg); }

/* Demo controls (이전과 동일) */
.demo-nav {
  position: fixed; bottom: var(--stack-md); left: 50%; transform: translateX(-50%);
  z-index: 100;
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--gray-950); border-radius: var(--r-pill); box-shadow: var(--shadow-4);
}
.demo-nav button {
  color: var(--gray-300); font-size: var(--fs-caption); font-weight: var(--fw-bd);
  padding: 6px 14px; border-radius: var(--r-pill); transition: var(--t-fast) ease-out;
}
.demo-nav button[aria-current="true"] { background: var(--mystic-300); color: var(--mystic-950); }
.demo-nav button:not([aria-current="true"]):hover { background: var(--white-a200); color: var(--gray-0); }
.theme-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 101;
  width: 36px; height: 36px; border-radius: var(--r-pill);
  background: var(--bg-card); border: 1px solid var(--border-base);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-1); color: var(--fg-base);
}

@media (max-width: 767px) {
  body { padding-bottom: 64px; }
}
