/* Shared design tokens and page chrome for the tool pages.
   Same palette as the twibbon generator: neutral surfaces, one indigo accent. */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dfe3e8;
    --border-strong: #c5ccd5;
    --text: #15191e;
    --text-muted: #5b6573;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-contrast: #ffffff;
    --accent-soft: #eef2ff;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #067647;
    --success-soft: #e6f5ee;
    --warn: #93560a;
    --warn-soft: #fdf3e1;
    --checker-a: #ffffff;
    --checker-b: #e6e9ee;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #111418;
        --surface: #1a1f26;
        --surface-2: #232a33;
        --border: #313a46;
        --border-strong: #46515f;
        --text: #eef1f5;
        --text-muted: #9aa5b4;
        --accent: #818cf8;
        --accent-hover: #a5b4fc;
        --accent-contrast: #0f1028;
        --accent-soft: #1e2040;
        --danger: #f97066;
        --danger-soft: #3a1f1d;
        --success: #47cd89;
        --success-soft: #16301f;
        --warn: #f5b84a;
        --warn-soft: #382a10;
        --checker-a: #2a313b;
        --checker-b: #20262e;
        --shadow: none;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #111418;
    --surface: #1a1f26;
    --surface-2: #232a33;
    --border: #313a46;
    --border-strong: #46515f;
    --text: #eef1f5;
    --text-muted: #9aa5b4;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-contrast: #0f1028;
    --accent-soft: #1e2040;
    --danger: #f97066;
    --danger-soft: #3a1f1d;
    --success: #47cd89;
    --success-soft: #16301f;
    --warn: #f5b84a;
    --warn-soft: #382a10;
    --checker-a: #2a313b;
    --checker-b: #20262e;
    --shadow: none;
    color-scheme: dark;
}

*,
*::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);
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--accent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Page chrome: breadcrumb on the left, theme toggle on the right. */
.site-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 0;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.crumbs a {
    color: var(--text-muted);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--text);
    text-decoration: underline;
}

.crumbs [aria-current] {
    color: var(--text);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--border-strong);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle[data-mode="dark"] .icon-sun {
    display: block;
}

.theme-toggle[data-mode="dark"] .icon-moon {
    display: none;
}

.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 64px;
}

@media (max-width: 640px) {
    .site-bar {
        padding: 16px 16px 0;
    }

    .page-wrap {
        padding: 0 16px 48px;
    }
}

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

/* Legacy tool pages: form controls follow the theme unless a page styles them itself. */
input,
textarea,
select {
    background: var(--surface);
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* Some pages style every <button>; keep the toggle round and fixed-size. */
.site-bar .theme-toggle {
    flex: none;
    width: 40px;
    height: 40px;
    min-width: 0;
    padding: 0;
    margin: 0;
}
