/* ===== tokens ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --surface: #ffffff;
  --text: #16171a;
  --text-2: #5d6068;
  --text-3: #8b8e96;
  --line: #e7e7e3;
  --line-strong: #d3d3cd;
  --accent: #ff5b2e;
  --accent-ink: #ffffff;
  --accent-soft: #fff0ea;
  --ok: #138a4b;
  --ok-bg: #e7f6ed;
  --cond: #a15c00;
  --cond-bg: #fff4de;
  --no: #b3261e;
  --no-bg: #fdecea;
  --focus: #2a61ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  --style-size: 44px;
  --preview-size: 40px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --bg-soft: #18191c; --surface: #1b1c20; --text: #eeeef0; --text-2: #aeb0b7; --text-3: #7c7f88;
    --line: #2a2b30; --line-strong: #3a3c42; --accent: #ff7a52; --accent-ink: #1a0b05; --accent-soft: #3a2118;
    --ok: #5ed597; --ok-bg: #173226; --cond: #f4b64c; --cond-bg: #3a2c12; --no: #ff8a80; --no-bg: #3a1b19; --focus: #7c9cff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --bg-soft: #18191c; --surface: #1b1c20; --text: #eeeef0; --text-2: #aeb0b7; --text-3: #7c7f88;
  --line: #2a2b30; --line-strong: #3a3c42; --accent: #ff7a52; --accent-ink: #1a0b05; --accent-soft: #3a2118;
  --ok: #5ed597; --ok-bg: #173226; --cond: #f4b64c; --cond-bg: #3a2c12; --no: #ff8a80; --no-bg: #3a1b19; --focus: #7c9cff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ===== base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 28px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--text-2); }
[hidden] { display: none !important; }

/* ===== header / footer ===== */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; text-decoration: none; letter-spacing: -.02em; flex: none; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--bg-soft); }
.nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; row-gap: 4px; }
  .nav { order: 3; width: 100%; margin-left: -10px; }
  .theme-toggle { margin-left: auto; }
}
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer; color: var(--text-2); font-size: 20px; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: inline; }
}
.site-footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 40px 0 56px; color: var(--text-2); font-size: 13px; }
.footer-inner { display: grid; gap: 12px; }
.footer-inner strong { color: var(--text); font-size: 15px; }
.footer-inner p { margin: 4px 0 0; }
.footer-note { max-width: 720px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-nav a { text-decoration: none; font-weight: 600; }
.footer-nav a:hover { color: var(--text); }
.copyright { color: var(--text-3); }

/* ===== buttons / inputs ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); text-decoration: none; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn svg { font-size: 16px; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; list-style: none; user-select: none; }
.pill::-webkit-details-marker { display: none; }
.pill:hover { border-color: var(--text-2); }
.pill[aria-pressed="true"], .dropdown.active > .pill { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill .count:empty { display: none; }
.pill .count { font-size: 11px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; line-height: 18px; }
.text-btn { background: none; border: 0; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 6px 4px; }
.text-btn:hover { color: var(--text); }
.field { position: relative; display: flex; align-items: center; min-width: 0; }
.field input { width: 100%; height: 44px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; background: var(--surface); outline: none; }
.field input:focus { border-color: var(--text); }
.field.search svg { position: absolute; left: 14px; color: var(--text-3); font-size: 18px; pointer-events: none; }
.field.search input { padding-left: 40px; }
.clear-btn { position: absolute; right: 6px; width: 32px; height: 32px; border: 0; background: none; color: var(--text-3); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px; }
.clear-btn:hover { color: var(--text); background: var(--bg-soft); }
.range, .select-label, .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.range input { width: 130px; accent-color: var(--accent); }
.range output { min-width: 44px; font-variant-numeric: tabular-nums; color: var(--text); }
.select-label select { height: 34px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 28px 0 10px; background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* ===== hero ===== */
.hero { padding-top: 40px; padding-bottom: 20px; }
.hero h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); line-height: 1.25; letter-spacing: -.03em; font-weight: 800; }
.hero p { margin: 10px 0 0; color: var(--text-2); max-width: 640px; }

/* ===== toolbar ===== */
.toolbar-wrap { position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 14px; padding-bottom: 12px; }
.tool-row { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tool-row:first-child { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 860px) { .tool-row:first-child { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } }
.presets, .cats { display: flex; flex-wrap: wrap; gap: 6px; }
.filters .cats { margin-right: 6px; }
@media (max-width: 640px) {
  .controls { gap: 8px 12px; }
  .presets, .cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .presets::-webkit-scrollbar, .cats::-webkit-scrollbar { display: none; }
  .range input { width: 110px; }
  .toolbar-wrap { position: static; }
}
.dropdown { position: relative; }
.dropdown-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 4px; }
.dropdown-help { margin: 0 0 6px; font-size: 12px; color: var(--text-3); }
.dropdown-panel .check { align-items: flex-start; padding: 6px; border-radius: 8px; white-space: normal; cursor: pointer; }
.dropdown-panel .check:hover { background: var(--bg-soft); }
.dropdown-panel .check input { margin-top: 3px; }
.dropdown-panel strong { display: block; color: var(--text); }
.dropdown-panel small { display: block; font-weight: 400; color: var(--text-3); }
.fav-filter svg { font-size: 15px; }
.fav-filter[aria-pressed="true"] svg { fill: currentColor; }

/* ===== list ===== */
.list-section { padding-top: 16px; }
.result-count { margin: 0 0 8px; font-size: 13px; color: var(--text-2); }
.result-count span { color: var(--text); font-weight: 700; }
.font-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.font-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--line); content-visibility: auto; contain-intrinsic-size: auto 120px; }
.font-row:hover { background: linear-gradient(90deg, var(--bg-soft), transparent 70%); }
.row-meta { display: grid; gap: 2px; min-width: 0; }
.row-name { font-weight: 800; font-size: 16px; text-decoration: none; letter-spacing: -.01em; }
.row-name:hover { color: var(--accent); }
.row-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-info { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--text-2); font-weight: 600; font-size: 11px; border: 1px solid var(--line); }
.row-preview { display: block; min-width: 0; overflow: hidden; border-radius: 6px; }
.preview-img { display: block; height: calc(var(--preview-size) * 1.4); width: auto; max-width: none; }
.row-actions { display: grid; justify-items: end; gap: 10px; }
.row-buttons { display: flex; gap: 6px; align-items: center; }
.fav-btn svg { font-size: 19px; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
@media (max-width: 900px) {
  .font-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .row-preview { grid-column: 1 / -1; grid-row: 2; }
  .row-actions { grid-row: 1; grid-column: 2; }
}
@media (max-width: 560px) {
  .font-row { padding: 16px 0; }
  .row-actions .btn-ghost { display: none; }
  .preview-img { height: calc(var(--preview-size) * 1.1); }
}
.empty { text-align: center; padding: 80px 0; color: var(--text-2); }

/* ===== 글자 이미지 (검은 글자 · 투명 배경) ===== */
.text-img { user-select: none; -webkit-user-drag: none; }
.img-missing { display: inline-block; color: var(--text-3); font-size: 14px; }
:root[data-theme="dark"] .text-img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .text-img { filter: invert(1); } }

/* ===== detail ===== */
.detail { padding-top: 24px; }
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--text-3); }
.crumbs a { text-decoration: none; color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; padding: 16px 0 24px; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .detail-head { grid-template-columns: 1fr; } }
.detail-head h1 { margin: 0; line-height: 1; }
.title-img { display: block; height: clamp(56px, 9vw, 100px); width: auto; max-width: 100%; object-fit: contain; object-position: left; }
.detail-en { margin: 4px 0 16px; color: var(--text-2); font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.facts div { display: grid; }
.facts dt { font-size: 12px; color: var(--text-3); }
.facts dd { margin: 0; font-weight: 700; font-size: 14px; }
.facts a { text-decoration: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 16px 0 0; }
.tags a { display: inline-block; font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); }
.tags a:hover { color: var(--text); border-color: var(--line-strong); }
.detail-cta { display: grid; gap: 8px; min-width: 260px; }
.detail-sub-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-sub-actions .btn { gap: 6px; }
.cta-note { margin: 0; font-size: 12px; color: var(--text-3); text-align: center; }
.detail-body.has-ad { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.detail-main { min-width: 0; }
.detail-ad { padding-top: 24px; }
.ad-sticky { position: sticky; top: 24px; display: grid; gap: 6px; }
.ad-label { font-size: 11px; color: var(--text-3); }
@media (max-width: 1099px) { .detail-body.has-ad { display: block; } .detail-ad { display: none; } }
.detail-desc { font-size: 17px; max-width: 760px; margin: 24px 0 8px; }
.panel { margin-top: 40px; }
.panel h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.panel-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.panel-tools .field { width: min(360px, 100%); }
.weights-list, .sizes-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.weights-list li, .sizes-list li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.w-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.w-label small { display: block; font-weight: 500; color: var(--text-3); }
.w-sample { min-width: 0; overflow: hidden; }
.style-img { display: block; height: calc(var(--style-size) * 1.4); width: auto; max-width: none; }
@media (max-width: 560px) {
  .weights-list li, .sizes-list li { grid-template-columns: 1fr; gap: 4px; }
}
.glyphs { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.glyph-img { display: block; width: 100%; height: auto; }
.license-summary { max-width: 760px; margin: 0 0 16px; color: var(--text-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.license-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.license-table th, .license-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.license-table tbody tr:last-child > * { border-bottom: 0; }
.license-table thead th { background: var(--bg-soft); font-size: 12px; color: var(--text-2); font-weight: 700; }
.license-table tbody th { white-space: nowrap; }
.license-table td:last-child { white-space: nowrap; }
.mark { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.m-ok { background: var(--ok-bg); color: var(--ok); }
.m-conditional { background: var(--cond-bg); color: var(--cond); }
.m-no { background: var(--no-bg); color: var(--no); }
.license-note { color: var(--text-2); }
.disclaimer { font-size: 13px; color: var(--text-3); }
/* 활용 예시 */
.case-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.case-item { display: grid; gap: 8px; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); }
.case-item img { width: 100%; height: 260px; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-soft); transition: transform .2s, box-shadow .2s; }
.case-item:hover img { transform: translateY(-3px); box-shadow: var(--shadow); }
.real-cases { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.real-cases a { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; height: 100%; }
.real-cases a:hover { border-color: var(--text); }
.real-cases img { width: 100%; height: 180px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.real-cases span { font-size: 12px; color: var(--text-3); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.lightbox img { display: block; max-width: 100%; max-height: 84vh; width: auto; height: auto; border-radius: 10px; margin: 0 auto; }
.lb-label { color: #fff; text-align: center; margin: 10px 0 0; font-weight: 600; }
.lb-close { position: absolute; top: -48px; right: 0; color: #fff; font-size: 30px; }
.lb-close:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.code { position: relative; margin-top: 8px; }
.code pre { margin: 0; padding: 14px 52px 14px 16px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; font-size: 13px; }
.code code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }
.code .icon-btn { position: absolute; top: 6px; right: 6px; font-size: 17px; }
.similar { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.similar a { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; height: 100%; }
.similar a:hover { border-color: var(--text); }
.sim-img { display: block; height: 40px; width: auto; max-width: 100%; object-fit: contain; object-position: left; }
.sim-maker { font-size: 12px; color: var(--text-3); }

/* ===== prose pages ===== */
.prose { max-width: 820px; padding-top: 40px; }
.prose h1 { font-size: clamp(28px, 4vw, 36px); letter-spacing: -.03em; margin: 0 0 12px; }
.prose h2 { font-size: 20px; margin: 40px 0 10px; }
.prose .lead { font-size: 17px; color: var(--text-2); }
.prose li { margin: 6px 0; }
.prose .table-wrap { margin-top: 20px; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; font-size: 16px; }
.faq p { margin: 0 0 16px; color: var(--text-2); }
.notfound { text-align: center; padding: 100px 16px; }

/* ===== toast ===== */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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