/* SwartBerg Studio — global theme.
   The corporate palette: Midnight Navy, Electric Blue and Ice Blue on white and Cloud Grey. Text colours are
   tuned to WCAG AA: Electric Blue itself (#3478F6) is 4.1:1 on white, so links and buttons use a deeper shade of
   it and the brand blue is kept for the mark, rules and accents. Component styles live beside their .razor files. */

@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
}

@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations");
}

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

:root {
    --font-display: "Space Grotesk", "Helvetica Neue", sans-serif;
    --font-body: "Hanken Grotesk", "Helvetica Neue", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    /* Brand colours, the same in every theme */
    --brand-navy: #101c2c;
    --brand-blue: #3478f6;
    --brand-ice: #8ec5ff;
    --logo-accent: var(--brand-blue);

    /* Page surfaces (light by default, follow the OS in dark mode) */
    --paper: #ffffff;
    --paper-raised: #ffffff;
    --paper-sunk: #f3f6fa;      /* Cloud Grey */
    --ink: #101c2c;             /* Midnight Navy */
    --ink-soft: #667085;        /* Cool Grey: 5.0:1 on white, 4.6:1 on Cloud Grey */
    --line: #e1e6ee;
    --accent: #1f62de;          /* Electric Blue for text: 5.4:1 on white */
    --accent-strong: #2a6cea;   /* button fill: 4.8:1 behind white text */
    --success: #11845b;
    --focus: #3478f6;

    /* Night surfaces are Midnight Navy in both themes: the header, hero and call-to-action bands */
    --night: #101c2c;
    --night-raised: #16263b;
    --night-line: #26384f;
    --night-ink: #ffffff;
    --night-soft: #a9b4c6;
    --night-accent: #8ec5ff;    /* Ice Blue */

    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;
    --space-3xl: 6.5rem;

    --radius-sm: 8px;
    --radius-md: 14px;

    --shell: 1200px;
    --gutter: clamp(1rem, 4vw, 2.5rem);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 220ms;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0b1522;
        --paper-raised: #122034;
        --paper-sunk: #08101b;
        --ink: #f3f6fa;
        --ink-soft: #a9b4c6;
        --line: #1f2f45;
        --accent: #8ec5ff;
        --accent-strong: #2a6cea;
        --success: #4cc38a;
        --focus: #8ec5ff;
        --night: #101c2c;
        --night-line: #26384f;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.025em;
    margin: 0 0 var(--space-md);
    text-wrap: balance;
    overflow-wrap: break-word; /* product names like SwartBerg.Mediator are one long word */
}

h1 { font-size: clamp(2.5rem, 6vw, 4.75rem); }
h2 { font-size: clamp(2rem, 4vw, 3.1rem); }
h3 { font-size: clamp(1.35rem, 2vw, 1.6rem); line-height: 1.2; }

h1 em, h2 em { font-style: normal; color: var(--accent); }

p { margin: 0 0 var(--space-md); text-wrap: pretty; }

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

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

::selection { background: var(--accent-strong); color: #fff; }

/* ---- Layout primitives ---- */

.shell {
    width: 100%;
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section { padding-block: var(--space-3xl); }
.section--tight { padding-block: var(--space-2xl); }
.section--sunk { background: var(--paper-sunk); }
.section + .section:not(.section--sunk):not(.band) { border-top: 1px solid var(--line); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 var(--space-lg);
}
.eyebrow::before {
    content: "";
    width: 1.75rem;
    height: 1px;
    background: currentColor;
}

.lead {
    font-size: clamp(1.15rem, 1.6vw, 1.35rem);
    line-height: 1.55;
    color: var(--ink-soft);
    max-width: 42rem;
}

.section-head {
    display: grid;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

@media (min-width: 900px) {
    .section-head--split {
        grid-template-columns: 5fr 6fr;
        align-items: end;
        gap: var(--space-2xl);
    }
    .section-head--split .lead { margin: 0; }
}

.prose { max-width: 40rem; }
.prose p { color: var(--ink-soft); }
.prose p:first-child { color: var(--ink); }

.muted { color: var(--ink-soft); }

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

.button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 3rem;
    padding: 0 var(--space-lg);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out),
                border-color var(--duration) var(--ease-out), transform var(--duration) var(--ease-out);
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }

.button--primary { background: var(--accent-strong); color: #fff; }
.button--primary:hover { background: var(--ink); color: var(--paper); }

.button--ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.button--ghost:hover { border-color: var(--ink); color: var(--ink); }

.on-night .button--primary { background: var(--accent-strong); color: #fff; }
.on-night .button--primary:hover { background: var(--night-ink); color: var(--night); }
.on-night .button--ghost { border-color: var(--night-line); color: var(--night-ink); }
.on-night .button--ghost:hover { border-color: var(--night-ink); color: var(--night-ink); }

.button-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

.arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-weight: 600;
    text-decoration: none;
}
.arrow-link::after { content: "→"; transition: transform var(--duration) var(--ease-out); }
.arrow-link:hover::after { transform: translateX(4px); }

/* ---- Night bands ---- */

.on-night {
    background: var(--night);
    color: var(--night-ink);
}
.on-night .eyebrow { color: var(--night-accent); }
.on-night .lead, .on-night p { color: var(--night-soft); }
.on-night h1 em, .on-night h2 em { color: var(--night-accent); }
.on-night a:not(.button) { color: var(--night-ink); }

/* ---- Card grids ---- */

/* Hairline-ruled card grid. Each card draws its own border and overlaps its neighbour by 1px, so a row with
   fewer cards than columns ends cleanly instead of showing empty ruled cells. */
.grid {
    display: grid;
    padding: 0 1px 1px 0;
}
.grid > * {
    background: var(--paper);
    border: 1px solid var(--line);
    margin: 0 -1px -1px 0;
}
.section--sunk .grid > * { background: var(--paper-sunk); }

@media (min-width: 720px) {
    .grid--2 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.tile { padding: var(--space-xl) var(--space-lg); }
.tile h3 { margin-bottom: var(--space-sm); }
.tile p { color: var(--ink-soft); margin: 0; }
.tile__index {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    margin-bottom: var(--space-lg);
}

/* ---- Legal pages (privacy notice, terms of use) ---- */

.legal {
    max-width: 44rem;
}

.legal h2 {
    font-size: clamp(1.4rem, 2.2vw, 1.75rem);
    margin-top: var(--space-2xl);
}

.legal p,
.legal li {
    color: var(--ink-soft);
}

.legal ul {
    padding-left: 1.25rem;
    margin: 0 0 var(--space-md);
}

.legal li + li {
    margin-top: var(--space-xs);
}

/* ---- Entrance motion (CSS only, honours reduced motion) ---- */

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.rise { animation: rise 700ms var(--ease-out) both; }
.rise--1 { animation-delay: 80ms; }
.rise--2 { animation-delay: 160ms; }
.rise--3 { animation-delay: 240ms; }
.rise--4 { animation-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        transition-duration: 1ms !important;
    }
}

/* ---- Accessibility helpers ---- */

.skip-link {
    position: absolute;
    left: var(--space-md);
    top: -4rem;
    z-index: 100;
    padding: var(--space-xs) var(--space-md);
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-md); }

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