/* ============================================================
   WT Poomsae — shared design tokens and UI primitives
   Used by index.php and poomsae.php. Page-specific layout
   stays in the page itself.
   ============================================================ */

:root {
    --bg: #0a0e14;
    --bg-glow-1: #16233a;
    --bg-glow-2: #0d1420;
    --surface: rgba(255, 255, 255, .045);
    --surface-hi: rgba(255, 255, 255, .08);
    --line: rgba(255, 255, 255, .10);
    --text: #eef2f7;
    --muted: #8d9cb0;
    --danger: #f0483e;
    --accent: #e7ecf3;
    --accent-ink: #0a0e14;

    --r-md: 18px;
    --r-lg: 26px;

    --gap: clamp(12px, 2.2vh, 22px);
    --pad-x: clamp(14px, 4vw, 32px);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-ko: 'Noto Sans KR', var(--font);
}

/* Belt-driven accent colour */
[data-belt="yellow"] { --accent: #f5c518; --accent-ink: #2a2200; }
[data-belt="green"]  { --accent: #2ecc71; --accent-ink: #04240f; }
[data-belt="blue"]   { --accent: #3b8cff; --accent-ink: #001531; }
[data-belt="red"]    { --accent: #ff4d4d; --accent-ink: #2b0000; }
[data-belt="black"]  { --accent: #e7ecf3; --accent-ink: #0a0e14; }

html[lang="ko"] { --font: var(--font-ko); }

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

html, body {
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(120vmax 90vmax at 15% -10%, var(--bg-glow-1) 0%, transparent 55%),
        radial-gradient(100vmax 80vmax at 90% 110%, var(--bg-glow-2) 0%, transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Brand / top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: .45em;
    font-size: clamp(.95rem, 2.6vmin, 1.15rem);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
    text-decoration: none;
}

.brand__mark {
    font-weight: 800;
    color: var(--accent);
}

.brand__sub {
    font-size: .78em;
    font-weight: 500;
    color: var(--muted);
}

.iconbtn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .12s ease;
    touch-action: manipulation;
}

.iconbtn svg { width: 20px; height: 20px; display: block; }
.iconbtn:hover { background: var(--surface-hi); border-color: rgba(255, 255, 255, .22); }
.iconbtn:active { transform: scale(.94); }

/* ---------- Chip ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .55em;
    max-width: 100%;
    padding: .5em .95em;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: clamp(.75rem, 2.1vmin, .95rem);
    font-weight: 600;
    letter-spacing: .01em;
    color: #cdd7e4;
}

.chip__dot {
    width: .62em;
    height: .62em;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
    flex: 0 0 auto;
}

/* ---------- Buttons ---------- */
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-height: 58px;
    padding: 0 clamp(20px, 6vw, 42px);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: clamp(1rem, 2.9vmin, 1.2rem);
    font-weight: 700;
    letter-spacing: .01em;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .12s ease, filter .2s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}

.btn--block {
    width: 100%;
    max-width: 460px;
}

.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:active { transform: none; }

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 14px 34px -18px color-mix(in srgb, var(--accent) 85%, transparent);
}

.btn--primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn--primary:disabled { box-shadow: none; }

.btn--danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 14px 34px -18px rgba(240, 72, 62, .9);
}

.btn--ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--muted);
    min-height: 46px;
    font-weight: 600;
    font-size: clamp(.85rem, 2.2vmin, .95rem);
}

.btn--ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, .24); }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (hover: none) {
    .iconbtn:hover, .btn--ghost:hover { background: var(--surface); color: inherit; }
    .btn--primary:hover:not(:disabled) { filter: none; }
}
