/* =========================================================================
   TheSSS AI — base
   Self-hosted fonts, a small reset and element defaults. No classes here
   except the accessibility helpers at the end.
   ========================================================================= */

/* --- Fonts (latin subsets, variable weight; SIL Open Font License) ------ */
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("/assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/assets/fonts/instrument-sans-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Instrument Sans";
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url("/assets/fonts/instrument-sans-italic-latin.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

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

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

img,
picture,
video,
svg,
iframe {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

ul[class],
ol[class] {
    list-style: none;
    padding: 0;
}

/* --- Typography ----------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: var(--leading-snug);
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 {
    font-size: var(--text-3xl);
    line-height: var(--leading-tight);
    letter-spacing: -0.035em;
}

h2 {
    font-size: var(--text-2xl);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

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

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

p,
li,
dd {
    text-wrap: pretty;
}

strong,
b {
    font-weight: var(--weight-semibold);
}

a {
    color: var(--color-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--duration-fast) ease;
}

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

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

hr {
    border: 0;
    border-top: 1px solid var(--color-border);
}

::selection {
    background: rgba(214, 58, 196, 0.22);
}

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: 4px;
}

/* --- Accessibility helpers ----------------------------------------------- */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: calc(var(--z-header) + 1);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: var(--weight-semibold);
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
    color: var(--color-bg);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}
