/* hangul.dev — documentation clean slate */

:root {
    --bg: #ffffff;
    --sidebar: #f4f2ee;
    --text: #18181b;
    --text-muted: #52525b;
    --code-bg: #f4f4f5;
    --code-border: #e4e4e7;
    --link: #2563eb;
    --kw: #7c3aed;
    --str: #16a34a;
    --num: #d97706;
    --hover: #dbeafe;
    --row-alt: #fafafa;
    --term-bg: #18181b;
    --term-fg: #f4f4f5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

code, pre, .mono {
    font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-feature-settings: "calt" 1, "liga" 1;
}

.ko {
    font-family: 'Noto Sans KR', 'Inter', sans-serif;
}

/* ===== Layout shell ===== */
.docs-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar);
    padding: 24px 16px;
    border-right: 1px solid var(--code-border);
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--code-border);
    margin-bottom: 18px;
}

.brand-mark {
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.brand-name {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.nav-tree {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 8px 6px;
}

.nav-tree ul {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.nav-tree li a {
    display: block;
    padding: 5px 10px 5px 11px;
    font-size: 0.875rem;
    color: var(--text);
    border-left: 3px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-tree li a:hover {
    background: rgba(0,0,0,0.04);
    text-decoration: none;
}

.nav-tree li a.active {
    border-left-color: var(--link);
    font-weight: 600;
    background: rgba(37,99,235,0.06);
}

.sidebar-foot {
    padding: 16px 8px 4px;
    margin-top: 16px;
    border-top: 1px solid var(--code-border);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.dot { color: var(--code-border); }

/* ===== Main ===== */
.main {
    max-width: 800px;
    padding: 40px 40px 80px;
    margin: 0;
    width: 100%;
}

.section, .hero {
    padding: 24px 0 8px;
    scroll-margin-top: 24px;
}

.hero {
    padding-top: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--code-border);
    margin-bottom: 16px;
}

.breadcrumb {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 14px;
}
.bc-sep { color: var(--code-border); }
.bc-curr { color: var(--text); }

.page-title {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
}

h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    padding-bottom: 6px;
}

.lead {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 22px;
    max-width: 68ch;
}

p {
    font-size: 0.95rem;
    line-height: 1.75;
    margin-bottom: 14px;
    max-width: 70ch;
}

p code, td code, li code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.85em;
    color: var(--text);
}

/* ===== Terminal hero ===== */
.terminal {
    background: var(--term-bg);
    color: var(--term-fg);
    border-radius: 8px;
    padding: 18px 20px;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.65;
    margin: 18px 0 20px;
}

.terminal code { background: transparent; border: 0; padding: 0; color: inherit; font-size: inherit; }
.t-prompt { color: #71717a; }
.t-cmd    { color: #a78bfa; }
.t-arg    { color: #f4f4f5; }
.t-str    { color: #16a34a; }
.t-flag   { color: #d97706; }
.t-out    { color: #71717a; }
.t-jamo   { color: #dbeafe; font-family: 'Noto Sans KR', sans-serif; font-weight: 700; }
.t-op     { color: #a1a1aa; }
.t-comment{ color: #52525b; }

/* ===== Badges ===== */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.badge {
    display: inline-flex;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--code-border);
    font-family: 'Fira Code', monospace;
    font-size: 0.72rem;
    line-height: 1;
}
.badge-k {
    background: var(--code-bg);
    color: var(--text-muted);
    padding: 5px 8px;
    border-right: 1px solid var(--code-border);
}
.badge-v {
    background: #ffffff;
    color: var(--text);
    padding: 5px 8px;
}
.badge-v.ok { color: var(--str); }

/* ===== Code blocks ===== */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.65;
    margin: 12px 0 18px;
}

.code-block code { background: transparent; border: 0; padding: 0; }
.c-keyword { color: var(--kw); font-weight: 500; }
.c-string  { color: var(--str); }
.c-number  { color: var(--num); }
.c-comment { color: #71717a; font-style: italic; }
.c-fn      { color: var(--link); }
.c-op      { color: var(--text); }

/* ===== Tables ===== */
.api-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--code-border);
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.875rem;
    margin: 14px 0 18px;
}

.api-table thead {
    background: var(--sidebar);
}

.api-table th {
    text-align: left;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--code-border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.api-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--code-border);
    vertical-align: top;
    line-height: 1.55;
}

.api-table tbody tr:nth-child(even) { background: var(--row-alt); }
.api-table tbody tr:last-child td { border-bottom: 0; }

/* ===== Unicode Explorer ===== */
.explorer {
    border: 1px solid var(--code-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0 22px;
}

.explorer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    padding: 12px 16px;
    background: var(--sidebar);
    border-bottom: 1px solid var(--code-border);
}

.ctrl {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ctrl-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ctrl select {
    background: #fff;
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 5px 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--text);
    cursor: pointer;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex: 1;
    justify-content: flex-end;
}
.legend-item { display: inline-flex; gap: 5px; align-items: center; }
.sw {
    width: 10px; height: 10px; border-radius: 2px; display: inline-block;
    border: 1px solid var(--code-border);
}
.sw-1 { background: #fee2e2; }
.sw-2 { background: #ffedd5; }
.sw-3 { background: #fef3c7; }
.sw-4 { background: #dcfce7; }
.sw-5 { background: #cffafe; }
.sw-6 { background: #dbeafe; }
.sw-7 { background: #ede9fe; }
.sw-8 { background: #fae8ff; }

.grid-wrap {
    background: #fff;
    padding: 10px;
    overflow-x: auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(28, minmax(26px, 1fr));
    gap: 1px;
    background: var(--code-border);
    border: 1px solid var(--code-border);
    min-width: 760px;
}

.cell {
    background: #fff;
    text-align: center;
    padding: 6px 2px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.12s ease;
    user-select: none;
}
.cell:hover { background: var(--hover) !important; transform: scale(1.06); position: relative; z-index: 1; }
.cell.selected { background: var(--hover) !important; outline: 2px solid var(--link); outline-offset: -2px; z-index: 2; position: relative; }
.cell.empty { color: var(--code-border); cursor: default; }
.cell.empty:hover { background: #fff !important; transform: none; }

.inspector {
    border-top: 1px solid var(--code-border);
    background: var(--code-bg);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.insp-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
}
.insp-key {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.insp-val { color: var(--text); }
.insp-big { font-family: 'Noto Sans KR', sans-serif; font-size: 1.6rem; font-weight: 700; line-height: 1; }

/* ===== Playground ===== */
.playground {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--code-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0 22px;
    min-height: 320px;
}

.pg-pane { display: flex; flex-direction: column; }

.pg-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #0f0f12;
    color: #e4e4e7;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    border-bottom: 1px solid #27272a;
}
.pg-bar-light {
    background: var(--sidebar);
    color: var(--text-muted);
    border-bottom: 1px solid var(--code-border);
    justify-content: space-between;
}
.pg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pg-dot-r { background: #ef4444; }
.pg-dot-y { background: #f59e0b; }
.pg-dot-g { background: #10b981; }
.pg-title { margin-left: 8px; opacity: 0.85; }
.pg-status { font-size: 0.7rem; color: var(--str); }

.pg-input textarea {
    flex: 1;
    border: 0;
    outline: 0;
    resize: none;
    background: var(--term-bg);
    color: #f4f4f5;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 16px;
    width: 100%;
    min-height: 280px;
}

.pg-output { background: #fff; border-left: 1px solid var(--code-border); }
.pg-json {
    flex: 1;
    padding: 16px;
    background: #fff;
    color: var(--text);
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    overflow: auto;
    white-space: pre;
    margin: 0;
}
.pg-json .j-key { color: var(--kw); }
.pg-json .j-str { color: var(--str); }
.pg-json .j-num { color: var(--num); }
.pg-json .j-punct { color: var(--text-muted); }
.pg-json .j-bool { color: var(--link); }

/* ===== Footer ===== */
.docs-foot {
    margin-top: 60px;
    padding-top: 28px;
    border-top: 1px solid var(--code-border);
    color: var(--text-muted);
    font-size: 0.85rem;
}
.foot-cols {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 22px;
}
.foot-title {
    font-weight: 700;
    color: var(--text);
    font-size: 0.85rem;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.foot-text { font-size: 0.85rem; line-height: 1.6; }
.docs-foot ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.docs-foot ul a { color: var(--text-muted); font-size: 0.85rem; }
.docs-foot ul a:hover { color: var(--link); }
.foot-meta {
    display: flex;
    gap: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    padding-top: 14px;
    border-top: 1px solid var(--code-border);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .docs-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--code-border);
    }
    .main { padding: 24px 20px 60px; }
    .playground { grid-template-columns: 1fr; }
    .pg-output { border-left: 0; border-top: 1px solid var(--code-border); }
    .foot-cols { grid-template-columns: 1fr; gap: 20px; }
}
