/* ════════════════════════════════════════════════════════════════════
   SlideLab · styles.css — 갤러리 크롬 (앱 본체)
   단일 진실원천: projects/slide-lab/DESIGN.md (frontmatter `themes:`).
   슬라이드 시스템 자체는 slide-framework.css (여기서 @import).
   ─ 3-way 테마: Light/Dark/System (언어 뒤 /_theme/* 런타임이 <html data-theme> 세팅)
   ─ 듀얼 팔레트: :root[data-theme="light|dark"]  (base :root = no-JS 다크 폴백)
   ════════════════════════════════════════════════════════════════════ */
@import url("slide-framework.css");

/* ── no-JS 폴백 (다크 기본 — devtool 무드) ─────────────────────────── */
:root {
  --bg: #0b0f17; --surface: #121826; --surface-2: #1a2233;
  --ink: #e8edf5; --muted: #9aa6b8; --faint: #647080; --line: rgba(255,255,255,.09);
  --accent: #2dd4bf; --accent-deep: #14b8a6; --accent-ink: #06241f;

  --font-display: "Sora", "Pretendard", system-ui, sans-serif;
  --font-body: "Inter", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --fs-display: 44px; --fs-h1: 30px; --fs-h2: 22px; --fs-body: 16px; --fs-small: 13px; --fs-mono: 12.5px;
  --sp-xs: 6px; --sp-sm: 10px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 40px;
  --r-sm: 8px; --r-base: 12px; --r-lg: 18px; --r-pill: 999px;
  --t-base: 180ms; --t-slow: 320ms; --ease: cubic-bezier(.2,.8,.2,1);

  --grad-bg-glow: radial-gradient(900px 520px at 88% -12%, rgba(45,212,191,.12) 0%, transparent 55%), radial-gradient(700px 460px at -6% 112%, rgba(99,102,241,.08) 0%, transparent 50%);
  --grad-accent: linear-gradient(150deg, var(--accent), var(--accent-deep));
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 10px 28px -14px rgba(15,23,42,.30);
  --shadow-lg: 0 24px 60px -20px rgba(15,23,42,.45);
  --shadow-focus: 0 0 0 3px rgba(45,212,191,.30);
}

/* ── LIGHT ─────────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #eef1f6;
  --ink: #0f1722; --muted: #5a6573; --faint: #8a94a6; --line: rgba(15,23,42,.10);
  --accent: #0d9489; --accent-deep: #0b766e; --accent-ink: #ffffff;
  --grad-bg-glow: radial-gradient(900px 520px at 88% -12%, rgba(13,148,137,.10) 0%, transparent 55%);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 10px 28px -14px rgba(15,23,42,.22);
  --shadow-lg: 0 24px 60px -20px rgba(15,23,42,.30);
  --shadow-focus: 0 0 0 3px rgba(13,148,137,.28);
}

/* ── DARK ──────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --surface-2: #1a2233;
  --ink: #e8edf5; --muted: #9aa6b8; --faint: #647080; --line: rgba(255,255,255,.09);
  --accent: #2dd4bf; --accent-deep: #14b8a6; --accent-ink: #06241f;
}

/* ── 공유 스위처 브릿지 (양 [data-theme]에서 가독) ─────────────────── */
:root[data-theme="light"] {
  --i18n-switch-bg: rgba(15,23,42,.04); --i18n-switch-border: var(--line); --i18n-switch-fg: var(--ink);
  --i18n-switch-active-bg: rgba(13,148,137,.14); --i18n-switch-active-fg: var(--accent);
  --i18n-switch-menu-bg: var(--surface); --i18n-switch-menu-border: var(--line);
  --theme-switch-bg: var(--surface); --theme-switch-border: var(--line); --theme-switch-fg: var(--muted);
  --theme-switch-active-bg: var(--accent); --theme-switch-active-fg: var(--accent-ink); --theme-switch-radius: 10px;
}
:root[data-theme="dark"] {
  --i18n-switch-bg: rgba(255,255,255,.06); --i18n-switch-border: var(--line); --i18n-switch-fg: var(--ink);
  --i18n-switch-active-bg: rgba(45,212,191,.18); --i18n-switch-active-fg: var(--accent);
  --i18n-switch-menu-bg: var(--surface); --i18n-switch-menu-border: var(--line);
  --theme-switch-bg: var(--surface); --theme-switch-border: var(--line); --theme-switch-fg: var(--muted);
  --theme-switch-active-bg: var(--accent); --theme-switch-active-fg: var(--accent-ink); --theme-switch-radius: 10px;
}

/* ── 베이스 ────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--grad-bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--sp-lg); }

/* ── 헤더 ──────────────────────────────────────────────────────────── */
.site {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-inner { display: flex; align-items: center; gap: var(--sp-md); height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--grad-accent); display: grid; place-items: center; color: var(--accent-ink); font-size: 15px; box-shadow: var(--shadow-sm); }
.brand small { font-family: var(--font-mono); font-weight: 500; font-size: 11px; color: var(--muted); margin-left: 2px; }
.site-spacer { flex: 1; }
.site .nav-links { display: flex; gap: var(--sp-md); }
.site .nav-links a { font-size: 14px; font-weight: 500; color: var(--muted); }
.site .nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ── 히어로 ────────────────────────────────────────────────────────── */
.hero { padding: var(--sp-xl) 0 var(--sp-lg); }
.hero .eyebrow { font-family: var(--font-mono); font-size: var(--fs-mono); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: var(--fs-display); line-height: 1.08; margin: 10px 0 12px; max-width: 18ch; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 60ch; }
.hero .stats { display: flex; flex-wrap: wrap; gap: var(--sp-lg); margin-top: var(--sp-lg); }
.hero .stat { display: flex; flex-direction: column; }
.hero .stat b { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--ink); }
.hero .stat span { font-family: var(--font-mono); font-size: var(--fs-mono); color: var(--muted); }

/* ── 컨트롤 (필터) ─────────────────────────────────────────────────── */
.controls { display: flex; flex-direction: column; gap: var(--sp-md); padding: var(--sp-lg) 0 var(--sp-md); position: sticky; top: 60px; z-index: 40; backdrop-filter: blur(8px); background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid var(--line); }
.control-row { display: flex; align-items: center; gap: var(--sp-sm); flex-wrap: wrap; }
.control-label { font-family: var(--font-mono); font-size: var(--fs-mono); font-weight: 600; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; margin-right: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: var(--fs-small); font-weight: 500; transition: all var(--t-base) var(--ease); white-space: nowrap; }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .7; }
.chip .count { font-family: var(--font-mono); font-size: 11px; opacity: .7; }
.search { flex: 1; min-width: 180px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: var(--fs-small); }
.search:focus { outline: none; box-shadow: var(--shadow-focus); border-color: var(--accent); }

/* ── 매트릭스 그리드 ───────────────────────────────────────────────── */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-md); margin: var(--sp-xl) 0 var(--sp-md); }
.section-head h2 { font-size: var(--fs-h1); }
.section-head .hint { font-family: var(--font-mono); font-size: var(--fs-mono); color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-lg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card-preview { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-preview .slide-frame { width: 100%; height: 100%; }
.card-meta { padding: var(--sp-md); display: flex; flex-direction: column; gap: 8px; }
.card-meta .top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta .tname { font-family: var(--font-display); font-weight: 650; font-size: 15px; color: var(--ink); }
.card-meta .desc { font-size: var(--fs-small); color: var(--muted); line-height: 1.45; min-height: 2.6em; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }
.tag { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--muted); letter-spacing: .02em; }
.tag.t-type { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.empty { grid-column: 1 / -1; text-align: center; padding: var(--sp-xl); color: var(--muted); font-family: var(--font-mono); }

/* ── 버튼 ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: var(--fs-small); font-weight: 600; transition: all var(--t-base) var(--ease); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--grad-accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn.ghost { background: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ── 덱 섹션 ───────────────────────────────────────────────────────── */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-lg); }
.deck-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-lg); display: flex; flex-direction: column; gap: 10px; transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease); }
.deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.deck-card .d-preset { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.deck-card h3 { font-size: 19px; }
.deck-card p { font-size: var(--fs-small); color: var(--muted); line-height: 1.5; flex: 1; }
.deck-card .d-meta { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

/* ── 덱 뷰어 (오버레이) ────────────────────────────────────────────── */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(2,6,12,.86); backdrop-filter: blur(8px); display: none; flex-direction: column; }
.viewer.open { display: flex; }
.viewer-bar { display: flex; align-items: center; gap: var(--sp-md); padding: 12px var(--sp-lg); color: #e8edf5; }
.viewer-bar .v-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; flex: 1; }
.viewer-bar .v-count { font-family: var(--font-mono); font-size: 13px; color: #9aa6b8; }
.viewer-stage { flex: 1; display: grid; place-items: center; padding: var(--sp-lg); position: relative; overflow: hidden; }
.viewer-stage .slide-frame { box-shadow: 0 30px 80px -24px rgba(0,0,0,.6); background: #fff; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: #fff; font-size: 20px; display: grid; place-items: center; transition: all var(--t-base) var(--ease); }
.viewer-nav:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }
.viewer-nav:disabled { opacity: .25; cursor: default; }
.viewer-close { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: var(--r-sm); height: 34px; padding: 0 14px; font-size: 13px; font-weight: 600; }
.viewer-close:hover { background: rgba(255,255,255,.12); }
/* Touch: chips/search/buttons/viewer-close are 32–36px (under the 44px minimum). */
@media (pointer: coarse) {
  .chip, .search, .btn, .btn.sm, .viewer-close { height: 44px; }
}

/* ── 가이드 섹션 ───────────────────────────────────────────────────── */
.guide { padding: var(--sp-xl) 0; }
.guide-grid { display: grid; grid-template-columns: 240px 1fr; gap: var(--sp-xl); align-items: start; }
.guide-toc { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 4px; }
.guide-toc a { font-size: var(--fs-small); color: var(--muted); padding: 6px 10px; border-radius: var(--r-sm); border-left: 2px solid transparent; }
.guide-toc a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.guide-toc a.active { color: var(--accent); border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.guide-body { font-size: 15.5px; line-height: 1.65; color: var(--ink); max-width: 760px; }
.guide-body h3 { font-size: 22px; margin: var(--sp-xl) 0 var(--sp-sm); scroll-margin-top: 130px; }
.guide-body h3:first-child { margin-top: 0; }
.guide-body h4 { font-size: 17px; margin: var(--sp-lg) 0 var(--sp-xs); color: var(--ink); }
.guide-body p { margin: 0 0 var(--sp-md); color: var(--muted); }
.guide-body ul, .guide-body ol { margin: 0 0 var(--sp-md); padding-left: 20px; color: var(--muted); }
.guide-body li { margin: 4px 0; }
.guide-body strong { color: var(--ink); }
.guide-body code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; color: var(--accent); }
.guide-body pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-base); padding: var(--sp-md); overflow-x: auto; margin: 0 0 var(--sp-md); }
.guide-body pre code { background: none; padding: 0; color: var(--ink); font-size: 12.5px; line-height: 1.55; }
.guide-body table { width: 100%; border-collapse: collapse; margin: 0 0 var(--sp-md); font-size: 13.5px; }
.guide-body th, .guide-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-body th { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.guide-body td { color: var(--muted); }
.guide-body td:first-child { color: var(--ink); font-weight: 600; }
.callout { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); padding: var(--sp-md) var(--sp-lg); border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 0 0 var(--sp-md); }
.callout.bad { border-color: #ef4444; background: color-mix(in srgb, #ef4444 8%, transparent); }
.callout.good { border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, transparent); }
.callout .label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.callout.bad .label { color: #ef4444; }
.callout.good .label { color: #22c55e; }
.callout p { margin: 0; color: var(--ink); }

/* ── 토스트 ────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill); font-size: var(--fs-small); font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all var(--t-base) var(--ease); z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 푸터 ──────────────────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--line); padding: var(--sp-xl) 0; margin-top: var(--sp-xl); color: var(--muted); font-size: var(--fs-small); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: var(--sp-md); justify-content: space-between; align-items: center; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }

/* ── 반응형 ────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .hero h1 { font-size: 34px; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-toc { position: static; flex-direction: row; flex-wrap: wrap; top: auto; }
  .guide-toc a { border-left: none; }
  .controls { top: 56px; }
  .site .nav-links { display: none; }
  .viewer-nav.prev { left: 8px; }
  .viewer-nav.next { right: 8px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 var(--sp-md); }
  .hero { padding-top: var(--sp-lg); }
  .grid { grid-template-columns: 1fr; }
}

/* 접근성: 모션 감소 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
