/* =============================================================================
   Portfolio — Aleksander Kopydłowski
   Concept v3 — "Graphite / Ivory"
   Dwa motywy: ciemny (grafit) i jasny (kość słoniowa). Motyw wybiera skrypt
   w <head> (zapisany wybór albo ustawienie systemu) i wpisuje go do
   <html data-theme="…">, zanim strona się narysuje — bez mignięcia.

   Kolory zmienisz w dwóch blokach poniżej. Odpowiednik palety scen 3D
   znajduje się w src/hero3d.ts (stała PALETTES).
   ============================================================================= */

/* --- motyw ciemny (domyślny) --------------------------------------------- */
:root {
    color-scheme: dark;

    /* tła */
    --bg: #0d0e12;
    --bg-2: #121318;
    --bg-3: #191a21;

    /* powierzchnie i linie */
    --surface: rgba(24, 25, 32, 0.74);
    --surface-2: rgba(32, 33, 42, 0.86);
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.17);

    /* tekst */
    --fg: #f6f4ef;
    --fg-2: #cfcac1;
    --fg-3: #a5a097;

    /* akcenty */
    --accent: #dcb877;          /* złoto dla tekstu */
    --gold: #d1ab66;
    --gold-hi: #f0dcae;
    --gold-dim: rgba(209, 171, 102, 0.15);
    --violet: #8f80ff;
    --violet-dim: rgba(143, 128, 255, 0.16);
    --grad-gold: linear-gradient(105deg, var(--gold-hi), var(--gold) 46%, #b08a4d);
    /* akcent nagłówków: bursztyn → koral → orchidea → fiolet (sąsiednie barwy,
       więc bez szaro-brązowego środka, jaki dawało przejście złoto → fiolet) */
    --grad-accent: linear-gradient(100deg, #f7c873 0%, #f59e72 30%, #e879c6 64%, #9b8cff 100%);

    /* przycisk główny */
    --btn-bg: var(--grad-gold);
    --btn-fg: #16130c;
    --btn-glow: 0 14px 40px -18px rgba(209, 171, 102, 0.85);
    --btn-glow-hover: 0 20px 55px -18px rgba(209, 171, 102, 0.95);

    /* warstwy pomocnicze */
    --nav-bg: rgba(13, 14, 18, 0.74);
    --scrim: rgba(13, 14, 18, 0.86);
    --backdrop: rgba(6, 6, 9, 0.72);
    --field-bg: rgba(255, 255, 255, 0.045);
    --field-bg-focus: rgba(255, 255, 255, 0.07);
    --grid-line: rgba(255, 255, 255, 0.03);
    --grain-opacity: 0.035;
    --aurora-a: rgba(209, 171, 102, 0.14);
    --aurora-b: rgba(143, 128, 255, 0.13);
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    --shadow-lg: 0 40px 90px -50px rgba(0, 0, 0, 0.9);
    --ok: #86d8a9;
    --err: #f2a3a3;

    /* kształt i ruch */
    --r-sm: 10px;
    --r: 16px;
    --r-lg: 24px;
    --r-xl: 32px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

    --maxw: 1200px;
    --gut: clamp(16px, 5vw, 64px);
    --nav-h: 76px;

    --f-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --f-mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* --- motyw jasny ----------------------------------------------------------- */
:root[data-theme="light"] {
    color-scheme: light;

    --bg: #f6f4ef;
    --bg-2: #efece5;
    --bg-3: #e6e2d8;

    --surface: rgba(255, 255, 255, 0.8);
    --surface-2: rgba(255, 255, 255, 0.96);
    --line: rgba(24, 21, 16, 0.1);
    --line-2: rgba(24, 21, 16, 0.2);

    --fg: #15141a;
    --fg-2: #44413b;
    --fg-3: #625e56;

    --accent: #7a5714;
    --gold: #b88a3e;
    --gold-hi: #d9b56d;
    --gold-dim: rgba(184, 138, 62, 0.14);
    --violet: #5a44e0;
    --violet-dim: rgba(90, 68, 224, 0.1);
    --grad-gold: linear-gradient(105deg, #8f661f, #b8862f 50%, #8a621c);
    --grad-accent: linear-gradient(100deg, #b07408 0%, #d4512a 32%, #b02f98 64%, #5a44e0 100%);

    --btn-bg: #15141a;
    --btn-fg: #f6f4ef;
    --btn-glow: 0 14px 34px -18px rgba(21, 20, 26, 0.55);
    --btn-glow-hover: 0 20px 44px -18px rgba(21, 20, 26, 0.6);

    --nav-bg: rgba(246, 244, 239, 0.78);
    --scrim: rgba(246, 244, 239, 0.9);
    --backdrop: rgba(40, 34, 24, 0.32);
    --field-bg: rgba(255, 255, 255, 0.85);
    --field-bg-focus: #ffffff;
    --grid-line: rgba(24, 21, 16, 0.045);
    --grain-opacity: 0.025;
    --aurora-a: rgba(209, 171, 102, 0.22);
    --aurora-b: rgba(120, 100, 255, 0.12);
    --shadow-sm: 0 1px 2px rgba(40, 30, 10, 0.05), 0 8px 24px -16px rgba(40, 30, 10, 0.18);
    --shadow-lg: 0 40px 80px -46px rgba(40, 30, 10, 0.4);
    --ok: #1d7a49;
    --err: #b3261e;
}

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

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

body {
    font-family: var(--f-sans);
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

body.nav-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

::selection { background: var(--gold-dim); color: var(--fg); }

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

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

/* --- typografia ---------------------------------------------------------- */
.display {
    font-family: var(--f-sans);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.04;
    text-wrap: balance;
}

/* akcent: ten sam krój co nagłówek, wyróżniony płynącym gradientem
   (np. „Kopydłowski", „Zbudujmy go.") */
.display em {
    font-style: normal;
    background: var(--grad-accent);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: grad-flow 9s var(--ease-io) infinite alternate;
}

@keyframes grad-flow {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}

.eyebrow,
.card__label,
.tag,
.stack__group h4,
.hero__scroll,
.lang-switch,
.mini-link,
.project__index,
.tile__kind,
.stat__num,
.timeline__date,
.project__status,
.cform__field > span,
.media-ph span {
    font-family: var(--f-mono);
}

.eyebrow,
.card__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 500;
}

.eyebrow::before,
.card__label::before {
    content: "";
    width: 22px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.section-title {
    font-size: clamp(2.1rem, 4.6vw, 3.4rem);
}

/* =============================================================================
   TŁO — warstwy
   ============================================================================= */
.bg-aurora {
    position: fixed;
    inset: -20%;
    z-index: -4;
    pointer-events: none;
    background:
        radial-gradient(36% 34% at 18% 14%, var(--aurora-a), transparent 70%),
        radial-gradient(40% 38% at 84% 26%, var(--aurora-b), transparent 72%),
        radial-gradient(46% 42% at 72% 82%, var(--aurora-a), transparent 74%);
    filter: blur(24px);
    animation: aurora 26s var(--ease-io) infinite alternate;
}

@keyframes aurora {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-2.5%, 2%, 0) scale(1.07); }
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 74px 74px;
    mask-image: radial-gradient(80% 60% at 50% 35%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(80% 60% at 50% 35%, #000 20%, transparent 78%);
}

.bg-grain {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: var(--grain-opacity);
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- płótna scen 3D ------------------------------------------------------- */
#hero3d,
#about3d,
#projects3d {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1.8s var(--ease), transform 2.2s var(--ease);
}

#hero3d.is-ready {
    opacity: 1;
    transform: scale(1);
}

/* konstelacja i glob są tylko tłem pod treścią — mocno przygaszone */
#about3d.is-ready,
#projects3d.is-ready {
    opacity: 0.5;
    transform: scale(1);
}

/* awaryjnie: brak WebGL — zostaje sama poświata z .bg-aurora */
.no-webgl #hero3d,
.no-webgl #about3d,
.no-webgl #projects3d { display: none; }

/* =============================================================================
   NAWIGACJA
   ============================================================================= */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 var(--gut);
    transition: height 0.5s var(--ease), background 0.5s var(--ease),
                border-color 0.5s var(--ease), backdrop-filter 0.5s var(--ease);
    border-bottom: 1px solid transparent;
}

.is-scrolled .nav {
    height: 62px;
    background: var(--nav-bg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom-color: var(--line);
}

.nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

.monogram-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 9px;
    transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}

/* logo jest jasne (biało-złote) — w jasnym motywie odwracamy je na ciemne */
[data-theme="light"] .monogram-img { filter: invert(1) hue-rotate(180deg) brightness(0.9); }

.nav__brand:hover .monogram-img { transform: rotate(-8deg) scale(1.08); }

.brand-word {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-2);
}

.nav__links {
    display: flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.nav__links a {
    position: relative;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-2);
    padding: 7px 16px;
    border-radius: 999px;
    transition: color 0.35s var(--ease), background 0.35s var(--ease);
}

.nav__links a:hover { color: var(--fg); }

.nav__links a.is-active {
    color: var(--fg);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line-2);
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch {
    display: flex;
    align-items: center;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.lang-switch button {
    padding: 5px 11px;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--fg-2);
    border-radius: 999px;
    transition: color 0.35s var(--ease), background 0.35s var(--ease);
}

.lang-switch button.is-active {
    color: var(--btn-fg);
    background: var(--btn-bg);
    font-weight: 600;
}

/* --- przełącznik motywu -------------------------------------------------- */
.theme-toggle {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--fg);
    transition: border-color 0.4s var(--ease), transform 0.5s var(--ease);
}

.theme-toggle:hover { border-color: var(--gold); transform: rotate(-12deg); }

.theme-toggle svg {
    grid-area: 1 / 1;
    width: 17px;
    height: 17px;
    transition: opacity 0.4s var(--ease), transform 0.6s var(--ease);
}

/* w ciemnym motywie pokazujemy słońce (przejście na jasny) i odwrotnie */
.theme-toggle .i-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .theme-toggle .i-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-toggle .i-moon { opacity: 1; transform: none; }

.nav__contact {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    color: var(--btn-fg);
    background: var(--btn-bg);
    box-shadow: var(--btn-glow);
    transition: box-shadow 0.4s var(--ease);
    will-change: transform;
}

.nav__contact:hover { box-shadow: var(--btn-glow-hover); }
.nav__contact svg { transition: transform 0.45s var(--ease); }
.nav__contact:hover svg { transform: translateX(4px); }

.nav__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 9px 8px;
}

.nav__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--fg);
    border-radius: 2px;
    transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}

.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =============================================================================
   PRZYCISKI
   ============================================================================= */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 28px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 999px;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease),
                border-color 0.5s var(--ease), color 0.4s var(--ease),
                background 0.4s var(--ease);
    will-change: transform;
}

.btn svg { transition: transform 0.45s var(--ease); }
.btn:hover svg { transform: translateX(5px); }

.btn--primary {
    color: var(--btn-fg);
    background: var(--btn-bg);
    font-weight: 600;
    box-shadow: var(--btn-glow);
}

/* połysk przesuwający się po przycisku */
.btn--primary::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.45) 50%, transparent 75%);
    transform: translateX(-120%);
    transition: transform 0.9s var(--ease);
}

[data-theme="light"] .btn--primary::after {
    background: linear-gradient(100deg, transparent 25%, rgba(217, 181, 109, 0.5) 50%, transparent 75%);
}

.btn--primary:hover::after { transform: translateX(120%); }
.btn--primary:hover { box-shadow: var(--btn-glow-hover); }

.btn--ghost {
    color: var(--fg);
    border: 1px solid var(--line-2);
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn--ghost:hover {
    border-color: var(--gold);
    color: var(--accent);
}

/* =============================================================================
   HERO (landing)
   ============================================================================= */
.hero {
    position: relative;
    min-height: 100svh;
    display: grid;
    align-content: center;
    padding: calc(var(--nav-h) + 40px) var(--gut) 90px;
    max-width: var(--maxw);
    margin: 0 auto;
    z-index: 1;
}

/* czytelność tekstu na tle sceny 3D */
.hero::before {
    content: "";
    position: absolute;
    left: calc(var(--gut) * -0.5);
    top: 8%;
    width: min(760px, 92%);
    height: 84%;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(60% 55% at 30% 50%, var(--scrim), transparent 72%);
}

.hero__name {
    /* bez kursywy nazwisko jest szersze — 5.6rem trzyma je z dala od paneli 3D */
    font-size: clamp(3rem, 7vw, 5.6rem);
    margin-bottom: 26px;
    transition: transform 0.5s var(--ease);
    transform-style: preserve-3d;
}


/* Maskowane wejście linii tytułu. Maska obcinała glify wychodzące poza ciasny
   wiersz: z prawej ogon kursywy, u góry kropkę nad "i" w "Kopydłowski".
   Zapas dokładamy paddingiem i cofamy marginesem, żeby układ został bez zmian. */
.hero__name .ln {
    display: block;
    overflow: hidden;
    padding-top: 0.18em;
    margin-top: -0.18em;
    padding-right: 0.16em;
    margin-right: -0.16em;
    padding-bottom: 0.08em;
}

.hero__name .ln > span {
    display: block;
    transform: translateY(105%);
    transition: transform 1.15s var(--ease);
}

.hero__name .ln.is-visible > span { transform: translateY(0); }

.hero__role {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: clamp(1.02rem, 1.7vw, 1.2rem);
    font-weight: 500;
    color: var(--fg);
    margin-bottom: 18px;
}

.hero__role .sep { color: var(--gold); }

.hero__tagline {
    max-width: 52ch;
    color: var(--fg-2);
    font-size: clamp(1.02rem, 1.5vw, 1.1rem);
    margin-bottom: 38px;
}

.hero__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 56px;
}

.hero__scroll {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fg-3);
}

.hero__scroll .bar {
    position: relative;
    width: 54px;
    height: 1px;
    background: var(--line-2);
    overflow: hidden;
}

.hero__scroll .bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--grad-gold);
    transform-origin: left;
    animation: scrollbar 2.6s var(--ease-io) infinite;
}

@keyframes scrollbar {
    0%        { transform: translateX(-100%); }
    55%, 100% { transform: translateX(100%); }
}

/* =============================================================================
   REVEAL (wspólne)
   ============================================================================= */
[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.95s var(--ease), transform 0.95s var(--ease);
}

[data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

/* linie tytułu hero mają własną animację — nie przesuwamy ich dwa razy */
.hero__name .ln[data-reveal] { opacity: 1; transform: none; }

/* płynna zamiana języka (klasę ustawia script.js na 200 ms) */
[data-i18n] { transition: opacity 0.2s var(--ease); }
.lang-swapping [data-i18n] { opacity: 0; }

/* =============================================================================
   UKŁAD SEKCJI
   ============================================================================= */
.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--gut);
}

.home-feature {
    position: relative;
    z-index: 1;
    padding: clamp(40px, 8vh, 110px) 0 clamp(70px, 12vh, 140px);
}

.home-feature__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 22px;
    margin-bottom: 40px;
}

.mini-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    transition: gap 0.45s var(--ease);
}

.mini-link:hover { gap: 15px; }

/* =============================================================================
   BENTO — kafelki na stronie głównej
   ============================================================================= */
.bento {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
        "air   air   p2m   pr"
        "me    me    stats stats"
        "stack stack cta   cta";
    grid-auto-rows: minmax(0, auto);
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: clamp(22px, 2.4vw, 30px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    isolation: isolate;
    transition: border-color 0.6s var(--ease), transform 0.6s var(--ease),
                box-shadow 0.6s var(--ease), background 0.6s var(--ease);
}

.tile:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow-lg);
}

.tile--air   { grid-area: air; }
.tile--p2m   { grid-area: p2m; }
.tile--pr    { grid-area: pr; }
.tile--me    { grid-area: me; }
.tile--stack { grid-area: stack; }
.tile--stats { grid-area: stats; }
.tile--cta   { grid-area: cta; }

/* --- kafelek projektu: zdjęcie u góry, opis pod spodem -------------------
   Grafiki promo mają własne napisy i logotypy, więc nie kładziemy na nich
   tekstu — opis stoi niżej, na tle karty (czytelny w obu motywach). */
.tile--project { padding: 0; }

.tile__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: var(--bg-3);
}

.tile__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease);
}

.tile--project:hover .tile__media img { transform: scale(1.05); }

.tile__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: clamp(20px, 2.2vw, 26px);
}

.tile__kind {
    align-self: flex-start;
    margin-bottom: 14px;
    padding: 4px 10px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    border-radius: 999px;
    background: var(--gold-dim);
}

.tile__title {
    font-size: clamp(1.45rem, 2.2vw, 1.8rem);
    margin-bottom: 8px;
}

.tile--air .tile__title { font-size: clamp(1.8rem, 3vw, 2.4rem); }

.tile__desc {
    max-width: 52ch;
    font-size: 15px;
    color: var(--fg-2);
}

.tile__more { margin-top: auto; padding-top: 18px; }

.tile__go {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #111;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.5);
    transform: rotate(-45deg);
    transition: transform 0.5s var(--ease);
}

.tile:hover .tile__go { transform: rotate(0deg) scale(1.06); }

/* cała karta jest klikalna — link z tytułu rozciągnięty na kafelek */
.tile__link::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* --- kafelek "O mnie" ---------------------------------------------------- */
.tile--me {
    flex-direction: row;
    align-items: center;
    gap: clamp(18px, 2.4vw, 28px);
}

.tile--me > div { flex: 1 1 0; min-width: 0; }

.tile__avatar {
    flex: none;
    width: clamp(76px, 9vw, 112px);
    height: clamp(76px, 9vw, 112px);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--line-2);
}

.tile__h {
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 6px;
}

.tile__p {
    font-size: 15px;
    color: var(--fg-2);
    margin-bottom: 14px;
}

/* --- kafelek z liczbami -------------------------------------------------- */
.tile--stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0;
}

.stat {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: clamp(18px, 2vw, 26px);
}

.stat:nth-child(odd) { border-right: 1px solid var(--line); }
.stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }

.stat__num {
    display: block;
    font-size: clamp(2rem, 3.4vw, 2.7rem);
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1.1;
    background: var(--grad-gold);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.stat__label {
    display: block;
    font-size: 13.5px;
    color: var(--fg-2);
    line-height: 1.45;
}

/* --- kafelek ze stackiem (dwa przeciwbieżne paski) ------------------------ */
.tile--stack { gap: 12px; padding-inline: 0; }
.tile--stack .card__label { margin-inline: clamp(22px, 2.4vw, 30px); }
/* rzędy chipów wyśrodkowane w pionie — wysokość kafelka dyktuje sąsiedni */
.tile--stack .marquee:first-of-type { margin-top: auto; }
.tile--stack .marquee:last-of-type { margin-bottom: auto; }

.marquee {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.marquee__track {
    display: flex;
    width: max-content;
    gap: 10px;
    animation: marquee 34s linear infinite;
}

.marquee--rev .marquee__track { animation-direction: reverse; animation-duration: 40s; }
.tile--stack .marquee:nth-of-type(3) .marquee__track { animation-duration: 47s; }
.tile--stack:hover .marquee__track { animation-play-state: paused; }

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-50% - 5px)); }
}

/* --- kafelek kontaktu ---------------------------------------------------- */
.tile--cta {
    justify-content: space-between;
    gap: 22px;
    background:
        radial-gradient(120% 140% at 0% 0%, var(--gold-dim), transparent 60%),
        radial-gradient(100% 120% at 100% 100%, var(--violet-dim), transparent 60%),
        var(--surface);
}

.tile--cta h2 {
    font-size: clamp(1.8rem, 3.6vw, 2.7rem);
    margin-bottom: 8px;
}

.tile--cta p {
    max-width: 46ch;
    color: var(--fg-2);
    font-size: 15px;
}

.tile__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    color: var(--fg);
    background: var(--surface);
    transition: color 0.4s var(--ease), border-color 0.4s var(--ease),
                transform 0.4s var(--ease), background 0.4s var(--ease);
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn:hover {
    color: var(--accent);
    border-color: var(--gold);
    background: var(--gold-dim);
    transform: translateY(-3px);
}

/* =============================================================================
   KARTY — wspólna warstwa "szkła" + spotlight
   ============================================================================= */
.card {
    position: relative;
    padding: clamp(24px, 3.2vw, 36px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    isolation: isolate;
    transition: border-color 0.6s var(--ease), transform 0.6s var(--ease),
                background 0.6s var(--ease);
}

/* poświata podążająca za kursorem (--mx/--my ustawia script.js); karty mają
   isolation: isolate, więc z-index -1 kładzie ją nad tłem karty, pod treścią */
.card::before,
.tile::before,
.project__media::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s var(--ease);
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
                var(--gold-dim), transparent 70%);
}

/* na zdjęciu projektu poświata musi leżeć nad obrazem */
.project__media::before { z-index: 1; }

.card:hover::before,
.tile:hover::before,
.project__media:hover::before { opacity: 1; }

.card:hover { border-color: var(--line-2); background: var(--surface-2); }

.card__label { margin-bottom: 20px; }

.card h2 {
    font-size: clamp(1.6rem, 2.8vw, 2.1rem);
    margin-bottom: 16px;
}

.card p { color: var(--fg-2); }

/* =============================================================================
   O MNIE
   ============================================================================= */
.about {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: clamp(20px, 3vw, 40px);
    align-items: start;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: calc(var(--nav-h) + 56px) var(--gut) 110px;
}

.about__aside {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
}

.about__photo {
    position: relative;
    border-radius: var(--r);
    overflow: hidden;
    aspect-ratio: 4 / 5;
}

.about__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* w kwadratowym kadrze (tablet) zostawiamy głowę, a nie środek marynarki */
    object-position: 50% 20%;
    transition: transform 1.1s var(--ease);
}

.about__aside:hover .about__photo img { transform: scale(1.04); }

.about__id h1 {
    font-size: 1.7rem;
    margin-bottom: 8px;
}

.about__id .role {
    font-family: var(--f-mono);
    font-size: 12.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.about__id .bio {
    font-size: 15px;
    color: var(--fg-2);
    margin-bottom: 18px;
}

.about__socials {
    display: flex;
    gap: 10px;
}

.about__socials a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    color: var(--fg-2);
    transition: color 0.4s var(--ease), border-color 0.4s var(--ease),
                transform 0.4s var(--ease), background 0.4s var(--ease);
}

.about__socials a svg { width: 17px; height: 17px; }

.about__socials a:hover {
    color: var(--accent);
    border-color: var(--gold);
    background: var(--gold-dim);
    transform: translateY(-3px);
}

.about__contact { width: 100%; }

.about__main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.about-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 16px;
}

.about-quote {
    margin-top: 24px;
    padding: 20px 24px;
    border-left: 2px solid var(--gold);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: linear-gradient(90deg, var(--gold-dim), transparent);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.45;
    color: var(--fg);
}

.about-quote cite {
    display: block;
    margin-top: 10px;
    font-family: var(--f-mono);
    font-style: normal;
    font-size: 12.5px;
    letter-spacing: 0.06em;
    color: var(--fg-3);
}

/* --- oś czasu ------------------------------------------------------------- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.timeline__item {
    position: relative;
    padding-left: 22px;
}

.timeline__item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-dim);
}

.timeline__item::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 20px;
    bottom: -22px;
    width: 1px;
    background: linear-gradient(180deg, var(--line-2), transparent);
}

.timeline__item:last-child::after { display: none; }

.timeline__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline__role { font-weight: 600; font-size: 16px; }

.timeline__date {
    font-size: 12.5px;
    letter-spacing: 0.04em;
    color: var(--accent);
    white-space: nowrap;
}

.timeline__org {
    display: block;
    font-size: 15px;
    color: var(--fg-2);
    margin-top: 3px;
}

/* --- zainteresowania ------------------------------------------------------ */
.hobbies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 14px;
}

.hobby {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--field-bg);
    transition: border-color 0.5s var(--ease), transform 0.5s var(--ease);
}

.hobby:hover {
    border-color: var(--gold);
    transform: translateY(-3px);
}

.hobby__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.hobby__title { font-weight: 600; font-size: 16px; }

.hobby__icon {
    font-size: 18px;
    transition: transform 0.55s var(--ease);
}

.hobby:hover .hobby__icon { transform: scale(1.2) rotate(-8deg); }

.hobby p { font-size: 14.5px; }

/* --- stack / tagi --------------------------------------------------------- */
.stack__group { margin-bottom: 24px; }
.stack__group:last-child { margin-bottom: 0; }

.stack__group h4 {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-3);
    margin-bottom: 12px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 6px 13px;
    font-size: 13px;
    white-space: nowrap;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--fg-2);
    background: var(--field-bg);
    transition: color 0.4s var(--ease), border-color 0.4s var(--ease),
                background 0.4s var(--ease), transform 0.4s var(--ease);
}

.tags .tag { white-space: normal; }

.tag:hover {
    color: var(--accent);
    border-color: var(--gold);
    background: var(--gold-dim);
    transform: translateY(-2px);
}

/* =============================================================================
   PROJEKTY
   ============================================================================= */
.projects {
    position: relative;
    z-index: 1;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: calc(var(--nav-h) + 56px) var(--gut) 110px;
}

.projects__head {
    max-width: 62ch;
    margin-bottom: clamp(48px, 8vh, 88px);
}

.projects__head h1 {
    font-size: clamp(2.8rem, 7.4vw, 5.4rem);
    margin: 16px 0 18px;
}

.projects__head p,
.projects__subhead p { color: var(--fg-2); font-size: 17px; }

.projects__subhead {
    max-width: 62ch;
    margin: clamp(56px, 9vh, 96px) 0 44px;
    padding-top: 44px;
    border-top: 1px solid var(--line);
}

.projects__subhead h2 {
    font-size: clamp(2rem, 4.6vw, 3.1rem);
    margin: 14px 0 14px;
}

.project {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: clamp(22px, 4vw, 56px);
    align-items: center;
    margin-bottom: clamp(56px, 10vh, 112px);
    padding: clamp(14px, 1.6vw, 18px);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
}

.project:nth-child(even) .project__media { order: 2; }

/* kotwice z kafelków bento (/projects#point2me) nie lądują pod nawigacją */
.project[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

.project__media {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--bg-3);
    aspect-ratio: 16 / 10;
    transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
    will-change: transform;
}

.project__media:hover { box-shadow: var(--shadow-lg); }

.project__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease);
}

.project__media:hover img { transform: scale(1.045); }

.project__body { padding: clamp(6px, 1.4vw, 18px) clamp(6px, 1.4vw, 22px); }

.media-ph {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    height: 100%;
    color: var(--fg-3);
    background:
        repeating-linear-gradient(45deg, var(--grid-line) 0 12px, transparent 12px 24px),
        var(--bg-3);
}

.media-ph span {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.project__index {
    display: block;
    font-size: 12.5px;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 12px;
}

.project__title {
    font-size: clamp(2rem, 3.8vw, 2.8rem);
    margin-bottom: 16px;
}

.project__desc {
    color: var(--fg-2);
    margin-bottom: 16px;
}

.project__suitable {
    font-size: 15px;
    color: var(--fg-2);
    margin-bottom: 20px;
}

.project__suitable strong { color: var(--fg); font-weight: 600; }

.project__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 26px;
}

.project__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.project__status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    font-size: 12.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px dashed var(--line-2);
    border-radius: 999px;
    color: var(--fg-3);
}

/* =============================================================================
   STOPKA
   ============================================================================= */
.footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 34px var(--gut);
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--fg-3);
}

.footer__socials {
    display: flex;
    gap: 24px;
}

.footer__socials a {
    position: relative;
    color: var(--fg-2);
    transition: color 0.4s var(--ease);
}

.footer__socials a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 1px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.45s var(--ease);
}

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

.footer__socials a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* =============================================================================
   MODAL KONTAKTOWY
   ============================================================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}

.modal.is-open {
    opacity: 1;
    visibility: visible;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--backdrop);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal__card {
    position: relative;
    width: min(560px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 40px);
    border: 1px solid var(--line-2);
    border-radius: var(--r-xl);
    background: var(--bg-2);
    box-shadow: var(--shadow-lg);
    transform: translateY(22px) scale(0.97);
    transition: transform 0.65s var(--ease);
}

.modal.is-open .modal__card { transform: none; }

.modal__close {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 28px;
    line-height: 1;
    color: var(--fg-2);
    transition: color 0.35s var(--ease), transform 0.35s var(--ease);
}

.modal__close:hover { color: var(--accent); transform: rotate(90deg); }

.modal__card h2 {
    font-size: clamp(1.7rem, 3.4vw, 2.2rem);
    margin-bottom: 10px;
}

.modal__sub {
    color: var(--fg-2);
    font-size: 15px;
    margin-bottom: 24px;
}

/* --- formularz ------------------------------------------------------------ */
.cform {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cform__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.cform__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cform__field > span {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-2);
}

.cform__field input,
.cform__field textarea {
    width: 100%;
    min-width: 0;
    padding: 13px 16px;
    font-size: 16px; /* 16 px — iOS nie przybliża wtedy strony po kliknięciu w pole */
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    resize: vertical;
    transition: border-color 0.4s var(--ease), background 0.4s var(--ease),
                box-shadow 0.4s var(--ease);
}

.cform__field input:focus,
.cform__field textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--field-bg-focus);
    box-shadow: 0 0 0 3px var(--gold-dim);
}

.cform__submit {
    margin-top: 6px;
    align-self: flex-start;
}

.cform__submit[disabled] {
    opacity: 0.55;
    pointer-events: none;
}

.cform__status {
    min-height: 20px;
    font-size: 14.5px;
}

.cform__status.ok { color: var(--ok); }
.cform__status.err { color: var(--err); }

/* =============================================================================
   ELEMENTY GLOBALNE (dodawane przez script.js)
   ============================================================================= */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 300;
    pointer-events: none;
}

.scroll-progress span {
    display: block;
    height: 100%;
    background: var(--grad-gold);
    transform: scaleX(0);
    transform-origin: left;
}

.to-top {
    position: fixed;
    right: clamp(14px, 3vw, 34px);
    bottom: clamp(14px, 3vw, 34px);
    z-index: 90;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    color: var(--fg);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease),
                color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.to-top.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.to-top:hover {
    color: var(--accent);
    border-color: var(--gold);
}

.to-top svg { width: 17px; height: 17px; }

/* --- easter egg: kod Konami → papierowy samolot -------------------------- */
.ee-plane {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 400;
    pointer-events: none;
    color: var(--gold);
    filter: drop-shadow(0 8px 18px var(--gold-dim));
}

.ee-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 400;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--bg-2);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    opacity: 0;
    transform: translate(-50%, 16px);
    transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.ee-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* =============================================================================
   PRZEJŚCIA — między podstronami i przy zmianie motywu
   ============================================================================= */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.38s; }

/* zmiana motywu: nowy widok wjeżdża kołem od przycisku (animację odpala script.js) */
:root.theme-vt::view-transition-old(root),
:root.theme-vt::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* bez tego zrzut nowego widoku łapałby kolory w połowie animacji */
:root.theme-vt *,
:root.theme-vt *::before,
:root.theme-vt *::after { transition: none !important; }

/* =============================================================================
   RESPONSYWNOŚĆ
   ============================================================================= */
@media (min-width: 1024px) {
    /* Tekst hero dostaje własną kolumnę, żeby nigdy nie wszedł pod panele 3D
       stojące po prawej (ich pozycje ustawia src/hero3d.ts). */
    .hero { grid-template-columns: minmax(0, 640px); }
}

@media (max-width: 1024px) {
    .bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "air   air"
            "p2m   pr"
            "me    me"
            "stats stats"
            "stack stack"
            "cta   cta";
    }

    .about { grid-template-columns: 1fr; }

    .about__aside {
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .about__photo {
        width: 170px;
        flex: none;
        aspect-ratio: 1;
    }

    .about__id { flex: 1 1 240px; }
}

@media (max-width: 860px) {
    .nav__links {
        position: fixed;
        inset: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 0;
        border: none;
        border-radius: 0;
        background: var(--bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
    }

    .nav__links.is-open {
        opacity: 1;
        visibility: visible;
    }

    .nav__links a { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; padding: 10px 26px; }

    /* logo, PL/EN i motyw zostają widoczne nad otwartym menu */
    .nav__brand,
    .nav__actions,
    .nav__burger { position: relative; z-index: 2; }
    .nav__burger { display: flex; }
    .nav__contact { display: none; }
    .brand-word { display: none; }

    /* na wąskich ekranach scena 3D robi za tło — przygaszamy ją pod tekstem;
       zostaje sama warstwa cząstek (panele wyłącza hero3d.ts) */
    #hero3d.is-ready { opacity: 0.75; }
    #about3d.is-ready,
    #projects3d.is-ready { opacity: 0.3; }

    .hero { text-align: center; justify-items: center; }
    .hero::before { left: 0; width: 100%; }
    .hero__role, .hero__cta { justify-content: center; }
    .hero__tagline { margin-inline: auto; }

    .project:nth-child(even) .project__media { order: 0; }

}

@media (max-width: 600px) {
    .bento {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "air" "p2m" "pr" "me" "stats" "stack" "cta";
        gap: 12px;
    }

    .tile--me { align-items: flex-start; }
    .tile__avatar { width: 64px; height: 64px; }

}

@media (max-width: 560px) {
    /* separator „/" zawisałby na końcu linii przy zawijaniu roli */
    .hero__role { flex-direction: column; gap: 4px; }
    .hero__role .sep { display: none; }

    .cform__row { grid-template-columns: 1fr; }
    .footer { justify-content: center; text-align: center; }
    .home-feature__head { flex-direction: column; align-items: flex-start; }

    /* Poniżej 1024 px karta "O mnie" ustawia się w rząd (zdjęcie 170 px + tekst).
       Na najwęższych telefonach to się nie mieściło i strona przewijała się
       w poziomie — tutaj wracamy do układu pionowego. */
    .about__aside { flex-direction: column; align-items: stretch; }
    .about__photo { width: 100%; aspect-ratio: 4 / 5; }
}

@media (max-width: 380px) {
    .nav { gap: 12px; }
    .nav__actions { gap: 6px; }
    .lang-switch button { padding: 5px 9px; }
}

/* =============================================================================
   OGRANICZONY RUCH
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

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

    [data-reveal] { opacity: 1; transform: none; }
    .hero__name .ln > span { transform: none; }
    .marquee__track { animation: none; }

    @view-transition { navigation: none; }
}
