/* =========================================================
   Base: page, type scale, buttons, pills, breadcrumbs, theme toggle
   Loaded after legacy.css, so these rules win where both apply.
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    margin: 0 !important; /* no admin-bar bump: the header is fixed */
    padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

html,
body {
    background: var(--c-bg);
}

/* The header is not restyled yet: keep the text metrics it was designed with */
.announcement,
.header {
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: normal;
    font-feature-settings: "blwf" 1, "cv03" 1, "cv04" 1, "cv09" 1, "cv11" 1;
}

body {
    margin: 0;
    padding: 130px 0 0; /* fixed announcement bar + header */
    font-family: var(--font-sans);
    font-optical-sizing: auto;
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
    letter-spacing: -0.01em;
    color: var(--c-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: normal;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header buttons keep the Display cut the old static InterDisplay file had */
.header .button {
    font-variation-settings: "opsz" 32;
}

a {
    color: var(--c-brand);
}

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

/* ---------- Type scale ---------- */

.t-h1,
.t-h2 {
    margin: 0;
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    font-variation-settings: "opsz" 32;
    font-feature-settings: "cv11" 1, "cv12" 1, "cv13" 1;
    color: var(--c-text);
    text-wrap: balance;
}

.t-h1 {
    font-size: var(--fs-h1);
    letter-spacing: -0.03em;
}

.t-h2 {
    font-size: var(--fs-h2);
    letter-spacing: -0.02em;
}

.t-h3 {
    margin: 0;
    font-size: var(--fs-h3);
    line-height: var(--lh-snug);
    font-weight: var(--fw-semibold);
    font-feature-settings: "cv11" 1, "cv12" 1, "cv13" 1;
    color: var(--c-text);
    text-wrap: balance;
}

.t-lead {
    margin: 0;
    font-size: var(--fs-lg);
    line-height: var(--lh-lead);
}

.t-body {
    margin: 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
}

.t-caption {
    font-size: var(--fs-xs);
    line-height: var(--lh-normal);
    letter-spacing: 0;
}

.muted {
    color: var(--c-text-muted);
}

/* ---------- Buttons ---------- */

.btn {
    position: relative;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 28px;
    border: 0;
    border-radius: var(--r-md);
    font: inherit;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 20px -6px var(--btn-glow, transparent);
    transition: transform var(--ease), box-shadow var(--ease), filter var(--ease), background-color var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 28px -6px var(--btn-glow, transparent);
}

.btn:active {
    transform: none;
    filter: brightness(0.97);
}

.btn-brand {
    background: var(--c-brand);
    color: #fff;
    --btn-glow: rgba(85, 93, 255, 0.5);
}

.btn-ghost {
    background: none;
    color: var(--c-text);
    box-shadow: inset 0 0 0 1px var(--c-line-strong);
}

.btn-ghost:hover {
    background: var(--c-surface-hover);
    box-shadow: inset 0 0 0 1px var(--c-line-strong);
    filter: none;
}

/* ---------- Pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 100px;
    background: var(--c-surface);
    box-shadow: inset 0 0 0 1px var(--c-line);
    color: var(--c-text);
    font-size: var(--fs-sm);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--ease), box-shadow var(--ease), color var(--ease);
}

a.pill:hover {
    background: var(--c-surface-hover);
    box-shadow: inset 0 0 0 1px var(--c-line-strong);
}

.pill[aria-current="page"] {
    background: var(--c-brand);
    box-shadow: none;
    color: #fff;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    background: var(--c-surface);
    box-shadow: inset 0 0 0 1px var(--c-line);
    color: var(--c-text-muted);
    font-size: var(--fs-sm);
    line-height: 1.2;
}

.breadcrumbs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c-text-muted);
    text-decoration: none;
    transition: color var(--ease);
}

.breadcrumbs a:hover {
    color: var(--c-text);
}

.breadcrumbs img {
    width: 16px;
    height: 16px;
}

.breadcrumbs [aria-current="page"] {
    color: var(--c-text);
}

/* ---------- Theme toggle (header, as on mubert.com) ---------- */

.theme-toggle {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-md);
    background: none;
    color: var(--brand);
    cursor: pointer;
    transition: background-color var(--ease);
}

.theme-toggle:hover {
    background: var(--c-bg);
}

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

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

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

.theme-toggle--mobile {
    display: none;
}

@media (max-width: 960px) {
    /* Shorter fixed header on mobile (announcement bar 30 + header 48) */
    body {
        padding-top: 90px;
    }

    .theme-toggle--mobile {
        display: inline-grid;
        margin-left: auto;
        margin-right: 8px;
    }
}
