/* ==========================================================================
   Shared components: reset, buttons, inputs, switches, links.
   Loaded after tokens.css on every page.
   ========================================================================== */

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4, p {
    margin: 0;
}

/* ── Icons ─────────────────────────────────────────────────────────────── */

.icon {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text);
    font: 500 var(--fs-sm) / 1 var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:focus-visible,
.input:focus-visible,
.switch:focus-visible,
.clickable-tag:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-ghost {
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-secondary {
    background: var(--surface-2);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-danger-hover:hover:not(:disabled) {
    background: var(--bad-soft);
    color: var(--bad);
}

.btn-icon {
    width: 32px;
    padding: 0;
}

.btn-block {
    width: 100%;
}


/* Switch — a checkbox dressed as a toggle */
.switch {
    appearance: none;
    position: relative;
    flex: none;
    width: 30px;
    height: 18px;
    margin: 0;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    cursor: pointer;
    transition: background-color var(--dur) var(--ease);
}

.switch::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
    transition: transform var(--dur) var(--ease);
}

.switch:checked {
    background: var(--accent);
}

.switch:checked::before {
    transform: translateX(12px);
}


.input {
    height: 30px;
    padding: 0 var(--sp-2);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    font: 400 var(--fs-sm) var(--font-sans);
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.input:hover {
    border-color: var(--line-strong);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder {
    color: var(--text-3);
}

.input-mono {
    font-family: var(--font-mono);
}

.input-short {
    width: 72px;
    text-align: center;
}

select.input {
    cursor: pointer;
}

.text-link {
    align-self: flex-start;
    color: var(--accent-text);
    font-size: var(--fs-xs);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}


kbd {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-2);
    box-shadow: inset 0 -1px 0 var(--line-strong);
    font: 500 11px var(--font-mono);
}

