/* Shared styles for every page on stewbs.com.
   Pages link this first, then add their own <style> block for anything page-specific. */

/* ---------- Font: Cabin (SIL Open Font License, see /fonts/OFL.txt) ---------- */
@font-face {
    font-family: "Cabin";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/fonts/cabin-latin-wght-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Cabin";
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url("/fonts/cabin-latin-wght-italic.woff2") format("woff2");
}

/* ---------- Colors ---------- */
/* theme.js sets data-theme on <html> before the page paints. */
:root {
    --font: "Cabin", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bg: #ffffff;
    --surface: #f5f5f7;
    --text: #1c1d21;
    --muted: #5c5f67;
    --line: #d9dbe0;
    --accent: #c62d28;
    --tint: color-mix(in srgb, var(--accent) 10%, transparent);
    color-scheme: light;
}
[data-theme="dark"] {
    --bg: #0e0f12;
    --surface: #181a1f;
    --text: #ececef;
    --muted: #a4a7af;
    --line: #2f3238;
    --tint: color-mix(in srgb, var(--accent) 20%, transparent);
    color-scheme: dark;
}

/* ---------- Base ---------- */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.6 var(--font);
}
a { color: var(--accent); }
h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 6vw, 2.8rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}
.kicker {
    margin: 0 0 4px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page {
    max-width: var(--page-width, 720px);
    margin: 0 auto;
    padding: 40px 24px 72px;
}
@media (max-width: 680px) {
    .page { padding: 24px 16px 56px; }
}

/* ---------- Top bar: home link on the left, controls on the right ---------- */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.topbar .home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
}
.topbar .home:hover { color: var(--text); }
.topbar .home .lucide { width: 18px; height: 18px; }
.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.topbar label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.topbar select, .topbar button {
    font: 600 0.95rem var(--font);
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
}
.topbar select:hover, .topbar button:hover { border-color: var(--muted); }

/* ---------- On/off switch in the top bar (dark mode, Uno's rule set) ---------- */
.topbar .switch {
    position: relative;
    width: 56px;
    height: 30px;
    padding: 0;
    border-radius: 999px;
    transition: background-color 0.2s, border-color 0.2s;
}
.topbar .switch[aria-checked="true"] {
    background: var(--accent);
    border-color: var(--accent);
}
.switch .thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
}
.switch[aria-checked="true"] .thumb { transform: translateX(26px); }
.switch .lucide { width: 14px; height: 14px; }
/* The theme switch's thumb shows the current mode */
[data-theme="dark"] .icon-sun, :root:not([data-theme="dark"]) .icon-moon { display: none; }
@media (prefers-reduced-motion: reduce) {
    .topbar .switch, .switch .thumb { transition: none; }
}

/* ---------- Icons: Lucide (lucide.dev), ISC license ---------- */
.lucide {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

@media print {
    .topbar { display: none; }
}
