/* ═══════════════════════════════════════════
   Base - reset, typography, utility classes
   ═══════════════════════════════════════════ */

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--fw-normal);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--fw-semibold);
    line-height: var(--leading-tight);
    text-wrap: balance;
    color: var(--color-text);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5,
h6 {
    font-size: var(--text-base);
}

p {
    margin: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

code,
pre,
kbd {
    font-family: var(--font-mono);
    font-size: .9em;
}

/* ── Utility ── */
.text-xs {
    font-size: var(--text-xs);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-base {
    font-size: var(--text-base);
}

.text-lg {
    font-size: var(--text-lg);
}

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

.text-secondary {
    color: var(--color-text-secondary);
}

.text-danger {
    color: var(--color-danger-fg);
}

.text-success {
    color: var(--color-success-fg);
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fw-medium {
    font-weight: var(--fw-medium);
}

.fw-semibold {
    font-weight: var(--fw-semibold);
}

.fw-bold {
    font-weight: var(--fw-bold);
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ── Focus ring ── */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ── Settings sub-nav ── */
.settings-nav {
    display: flex;
    gap: var(--sp-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--sp-6);
    padding-bottom: 0;
}

.settings-tab {
    display: block;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--dur-base), border-color var(--dur-base);
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--color-text);
}

.settings-tab.is-active {
    color: var(--color-text);
    border-color: var(--color-primary);
}

.form-hint {
    font-size: 0.75rem;
    opacity: 0.5;
    font-weight: 100;
}