/* ==========================================================================
   Global styles: fonts, design tokens, base rules and shared utilities.
   Component-specific styles live next to their components (*.razor.css).
   ========================================================================== */

/* --- Fonts (self-hosted, variable, SIL OFL - see /fonts/LICENSE-*.txt) -----
   Each family is split into "latin" and "latin-ext" files. The browser only
   downloads the file that contains the characters actually used on the page;
   latin-ext holds the Polish letters (ą ć ę ł ń ś ź ż). */
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "JetBrains Mono Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url("../fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "JetBrains Mono Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Design tokens --------------------------------------------------------
   Change the look of the whole site here. Everything else uses var(--...). */
:root {
    color-scheme: dark;

    /* Surfaces */
    --color-bg: #0b0f1a;
    --color-surface: #121829;
    --color-surface-raised: #182036;
    --color-border: #232c47;

    /* Text (both muted and *-soft variants pass WCAG AA on --color-bg) */
    --color-text: #e6e9f2;
    --color-text-muted: #9aa4bd;

    /* Brand colors. The "soft" variants are lighter and meant for text on dark. */
    --color-blue: #3b82f6;
    --color-blue-soft: #7aa7ff;
    --color-violet: #8b5cf6;
    --color-violet-soft: #b39bfa;

    /* Single contrasting accent - use sparingly (main CTA, tiny details) */
    --color-accent: #f5b841;
    --color-on-accent: #1a1300;

    --gradient-brand: linear-gradient(135deg, var(--color-blue), var(--color-violet));
    --gradient-text: linear-gradient(90deg, #6ea0ff, #a78bfa);

    /* Typography */
    --font-sans: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono Variable", ui-monospace, "Cascadia Code", Consolas, monospace;

    /* Layout */
    --header-height: 4.5rem;
    /* Space above and below every section (the gap between two sections is twice this). */
    --section-space: clamp(2.5rem, 2vw + 1.5rem, 4rem);
    --container-width: 72rem;
    --radius-sm: 0.5rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.25rem;

    /* Motion */
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --duration: 200ms;
}

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

html {
    -webkit-text-size-adjust: 100%;
    /* Reserve space for the scrollbar so the page does not jump when it is hidden (open gallery). */
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
    /* Anchor links (#about) stop below the sticky header instead of under it. */
    scroll-padding-top: var(--header-height);
}

body {
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* The page behind an open gallery (<dialog>) does not scroll. */
body:has(dialog[open]) {
    overflow: hidden;
}

h1, h2, h3, h4 {
    margin: 0 0 0.75em;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 6vw + 1rem, 4.5rem); }
h2 { font-size: clamp(1.75rem, 2.5vw + 1rem, 2.5rem); }
h3 { font-size: 1.25rem; }

p {
    margin: 0 0 1em;
}

a {
    color: var(--color-blue-soft);
    text-underline-offset: 0.2em;
}

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

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

img {
    height: auto;
}

/* Keyboard focus: always visible, one consistent style. */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

/* <main> receives focus only from the "Skip to content" link; a ring around the whole page would be noise. */
main:focus {
    outline: none;
}

::selection {
    background: color-mix(in srgb, var(--color-violet) 55%, transparent);
    color: #fff;
}

/* Respect the user's "reduce motion" OS setting. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

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

/* --- Shared utilities ---------------------------------------------------- */
.container {
    width: min(100% - 2rem, var(--container-width));
    margin-inline: auto;
}

.section {
    padding-block: var(--section-space);
}

/* Small monospace label above a heading */
.eyebrow {
    margin: 0 0 1rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-violet-soft);
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

/* "Skip to content" link: hidden until it receives keyboard focus. */
.skip-link {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8125rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background: color-mix(in srgb, var(--color-accent) 88%, white);
    color: var(--color-on-accent);
}

.btn-secondary {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-secondary:hover {
    border-color: color-mix(in srgb, var(--color-violet) 60%, var(--color-border));
    background: var(--color-surface-raised);
    color: var(--color-text);
}

/* Inactive button (e.g. the CV button until the file exists) */
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:disabled:hover {
    border-color: var(--color-border);
    background: var(--color-surface);
    transform: none;
}

/* Icons inside buttons and links keep their size in flex containers. */
.icon {
    flex: none;
}

/* Card surface shared by skills, certificates and (later) projects. */
.card {
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    transition: border-color var(--duration) var(--ease);
}

.card:hover {
    border-color: color-mix(in srgb, var(--color-violet) 45%, var(--color-border));
}

/* Sections fade in and rise slightly as they scroll into view. Pure CSS (scroll-driven animation):
   browsers that do not support it, and visitors who prefer reduced motion, just see the content.
   `both` = the element is invisible before the animation range and normal after it. */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .section-heading,
        .card,
        .about {
            animation: reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 35%;
        }

        @keyframes reveal {
            from {
                opacity: 0;
                translate: 0 1.25rem;
            }
        }
    }
}

/* Technology "chips" (skills, projects) */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chips li {
    padding: 0.375rem 0.8125rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-raised);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* Text that still has to be written by the site owner. Remove the class when the final text is in. */
.placeholder {
    max-width: 48rem;
    padding: 1.5rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
}
