/* =========================================================
   ORGANIZACJA PLIKU
   Warstwa zadeklarowana później wygrywa z wcześniejszą
   (niezależnie od specyficzności selektora).

   1. Fundament (fonts … buttons) – wspólny dla wszystkich stron.
   2. Wspólne komponenty (header, footer, cookies, cart, books …).
   3. Strony: KAŻDA strona i podstrona ma własną warstwę page-*.
      Style dotyczące tylko jednej strony dopisuj do jej warstwy,
      nie do warstw wspólnych.
   4. utilities – zawsze na końcu.

   KOLORY: definiuj wyłącznie w warstwie `colors`. W pozostałych
   warstwach używaj var(--c-…) / var(--brand-…), bez wartości
   hex / rgb / hsl wpisanych na sztywno.

   Nowa strona = nowa warstwa page-<nazwa> dopisana do listy poniżej
   oraz blok @layer page-<nazwa> { … } w sekcji STRON.
   ========================================================= */
@layer
    /* fundament */
    fonts,
    colors,
    global,
    typography,
    layout,
    decoration,
    buttons,
    /* wspólne komponenty */
    header,
    footer,
    cookies,
    scroll-to-top,
    cart,
    books,
    /* strony */
    page-home,
    page-shop,
    page-news,
    page-article,
    page-faq,
    page-reviews,
    page-book,
    page-legal,
    page-thankyou,
    page-payment-status,
    page-links,
    page-links-social,
    page-links-reviews,
    page-admin,
    /* animacje */
    motion,
    /* narzędzia */
    utilities;

/* =========================================================
   FONTY
   ========================================================= */
@layer fonts {
    /* open-sans-regular - latin_latin-ext */
    @font-face {
        font-display: swap;
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 400;
        src: url('./fonts/open-sans-v44-latin_latin-ext-regular.woff2') format('woff2');
    }

    /* open-sans-600 - latin_latin-ext */
    @font-face {
        font-display: swap;
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 600;
        src: url('./fonts/open-sans-v44-latin_latin-ext-600.woff2') format('woff2');
    }

    /* open-sans-700 - latin_latin-ext */
    @font-face {
        font-display: swap;
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 700;
        src: url('./fonts/open-sans-v44-latin_latin-ext-700.woff2') format('woff2');
    }

    /* open-sans-800 - latin_latin-ext */
    @font-face {
        font-display: swap;
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 800;
        src: url('./fonts/open-sans-v44-latin_latin-ext-800.woff2') format('woff2');
    }
}

/* =========================================================
   KOLORY – JEDYNE miejsce definiowania kolorów (tokeny). Reszta pliku używa wyłącznie var(--…).
   ========================================================= */
@layer colors {
    :root {
        /* ===== Kolory bazowe strony (jasne tła / tekst) ===== */
        --c-bg: hsl(30, 3%, 76%);
        --c-text: hsl(0, 0%, 100%);
        --c-accent: hsl(21, 59%, 75%);
        --c-banner-bg: hsl(210, 7%, 18%);
        --c-section-bg: hsl(0, 0%, 97%);
        --c-section-text: hsl(0, 2%, 11%);

        /* ===== Przyciski (brąz) ===== */
        --c-buy-btn-bg: hsl(21, 28%, 34%);
        --c-buy-btn-hover: hsl(21, 32%, 42%);

        /* ===== Kosmos: ciemne powierzchnie ===== */
        --c-space-bg: #111820;               /* tło strony (dół gradientu) */
        --c-space-deep: hsl(202, 24%, 9%);   /* tekst na złotych przyciskach, ciemne akcenty */
        --c-space-mid: hsl(177, 21%, 15%);
        --c-space-light: hsl(168, 18%, 21%);
        --c-ink: #090c10;                    /* najciemniejszy: paski, zakładki, banery */
        --c-surface: hsl(205, 22%, 11%);     /* karty */
        --c-surface-2: hsl(205, 18%, 14%);   /* karty wewnętrzne */
        --c-panel-bg: rgba(13, 17, 20, 0.94);
        --c-glow: rgba(55, 91, 81, 0.2);     /* zielonkawa poświata tła */

        /* ===== Tekst na ciemnym ===== */
        --c-space-text: hsl(42, 36%, 94%);
        --c-text-soft: rgba(255, 255, 255, 0.82);
        --c-text-muted: rgba(255, 255, 255, 0.72);

        /* ===== Linie i szkło ===== */
        --c-line: rgba(255, 255, 255, 0.08);
        --c-glass: rgba(255, 255, 255, 0.05);

        /* ===== Złoto ===== */
        --c-gold-bright: hsl(43, 88%, 78%);
        --c-gold: hsl(39, 55%, 49%);
        --c-gold-shadow: hsl(29, 58%, 24%);
        --c-gold-metal: #d4af37;
        --c-gold-shine: #fff3c4;
        --c-gold-tint-soft: color-mix(in srgb, var(--c-gold-metal) 6%, transparent);     /* bardzo delikatne wypełnienia */
        --c-gold-tint: color-mix(in srgb, var(--c-gold-metal) 12%, transparent);         /* wypełnienia, hover, focus */
        --c-gold-line: color-mix(in srgb, var(--c-gold-metal) 28%, transparent);         /* cienkie ramki */
        --c-gold-line-strong: color-mix(in srgb, var(--c-gold-metal) 60%, transparent);  /* ramki akcentowane */
        --c-gold-wash: color-mix(in srgb, var(--c-gold) 10%, transparent);               /* ciepła poświata sekcji */
        --c-gold-glow: color-mix(in srgb, var(--c-gold-bright) 80%, transparent);
        --c-gold-glow-soft: color-mix(in srgb, var(--c-gold-bright) 42%, transparent);
        --c-panel-border: var(--c-gold-line);

        /* ===== Cienie i przesłony ===== */
        --c-shadow-sm: rgba(0, 0, 0, 0.25);
        --c-shadow-md: rgba(0, 0, 0, 0.4);
        --c-shadow-lg: rgba(0, 0, 0, 0.65);
        --c-scrim: rgba(0, 0, 0, 0.7);
        --c-scrim-strong: rgba(0, 0, 0, 0.88);

        /* ===== Jasne powierzchnie (koszyk, karty linków, panel admina) ===== */
        --c-paper: #fff;
        --c-paper-text: hsl(0, 0%, 20%);
        --c-paper-muted: hsl(0, 0%, 38%);
        --c-paper-line: hsl(0, 0%, 87%);

        /* ===== Stany ===== */
        --c-danger: #b00020;
        --c-success: hsl(145, 60%, 24%);
        --c-success-bg: hsl(140, 45%, 90%);

        /* ===== Strony z linkami (socialmedia / opinie) ===== */
        --social-ink: hsl(252, 29%, 17%);
        --social-violet: hsl(258, 50%, 52%);

        /* ===== Kategorie newsów (wspólna, stonowana saturacja) ===== */
        --c-tag-gold: hsl(40, 50%, 59%);
        --c-tag-violet: var(--social-violet);
        --c-tag-teal: hsl(192, 55%, 42%);
        --c-tag-green: hsl(150, 40%, 42%);
        --c-tag-gold-bg: color-mix(in srgb, var(--c-tag-gold) 20%, transparent);
        --c-tag-violet-bg: color-mix(in srgb, var(--c-tag-violet) 20%, transparent);
        --c-tag-teal-bg: color-mix(in srgb, var(--c-tag-teal) 20%, transparent);
        --c-tag-green-bg: color-mix(in srgb, var(--c-tag-green) 20%, transparent);

        /* ===== Kolory marek (ikony serwisów – celowo poza paletą strony) ===== */
        --brand-black: hsl(0, 0%, 0%);
        --brand-ig-yellow: hsl(55, 96%, 79%);
        --brand-ig-orange: hsl(5, 98%, 64%);
        --brand-ig-pink: hsl(319, 71%, 49%);
        --brand-ig-blue: hsl(225, 83%, 54%);
        --brand-facebook: hsl(214, 89%, 52%);
        --brand-lubimyczytac: hsl(353, 72%, 47%);
        --brand-nakanapie: hsl(28, 72%, 48%);
        --brand-granice: hsl(199, 69%, 43%);
        --brand-legimi: hsl(158, 56%, 36%);
    }
}

/* =========================================================
   GLOBAL – reset i tło wspólne dla całej strony
   ========================================================= */
@layer global {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    /* Kosmiczne tło wspólne dla całej strony.
       Podstrony: zdjęcie hero wygaszane pod nagłówkiem.
       Strona główna: zdjęcie hero na całą wysokość ekranu. */
    body {
        position: relative;
        isolation: isolate;
        display: flow-root;
        min-height: 100vh;
        min-height: 100svh;
        margin: 0;
        font-family: var(--ff-open);
        background:
            radial-gradient(ellipse at 80% 44%, var(--c-glow), transparent 38%),
            linear-gradient(180deg, var(--c-ink) 0%, var(--c-space-bg) 100%);
        color: var(--c-space-text);

        &::before {
            content: "";
            position: absolute;
            inset: 0 0 auto;
            height: calc(420 / 16 * 1rem);
            z-index: -1;
            background:
                linear-gradient(var(--c-shadow-sm), var(--c-shadow-sm)),
                url("./img/bg-hero-mobile.webp") center / cover no-repeat;
            mask-image: linear-gradient(to bottom, #000 20%, transparent); /* maska: liczy się tylko kanał alfa, nie kolor */
            opacity: 0.7;

            @media (width >= calc(750 / 16 * 1rem)) {
                background:
                    linear-gradient(var(--c-shadow-sm), var(--c-shadow-sm)),
                    url("./img/bg-hero.webp") center / cover no-repeat;
            }
        }
    }

    img {
        display: block;
        max-width: 100%;
        height: auto;
    }

    a {
        text-decoration: none;
        cursor: pointer;
        color: inherit;
    }

    ul,
    ol {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    input,
    select,
    textarea {
        font-family: inherit;
        padding: 10px;
        accent-color: var(--c-buy-btn-bg);
        border: 1px solid var(--c-buy-btn-bg);
        border-radius: 4px;
        background: var(--c-text);
    }

    input:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: var(--c-buy-btn-bg);
        box-shadow: 0 0 0 1px var(--c-buy-btn-bg);
    }
}

/* =========================================================
   TYPOGRAFIA
   ========================================================= */
@layer typography {
    :root {
        --ff-open: 'Open Sans', Arial, Helvetica, sans-serif;
        --fs-48: calc(48 / 16 * 1rem);
        --fs-40: calc(40 / 16 * 1rem);
        --fs-32: calc(32 / 16 * 1rem);
        --fs-24: calc(24 / 16 * 1rem);
        --fs-20: calc(20 / 16 * 1rem);
        --fs-16: calc(16 / 16 * 1rem);
        --fs-14: calc(14 / 16 * 1rem);
        --font-size-h1: var(--fs-24);
        --font-size-h1-span: var(--fs-32);
        --font-size-h2: var(--fs-24);
        --font-size-h3: var(--fs-20);
        --font-size-p: var(--fs-16);

        @media (width >= calc(750 / 16 * 1rem)) {
            --font-size-h1: var(--fs-32);
            --font-size-h1-span: var(--fs-40);
        }

        @media (width >= calc(1100 / 16 * 1rem)) {
            --font-size-h1: var(--fs-40);
            --font-size-h1-span: var(--fs-48);
            --font-size-h2: var(--fs-32);
            --font-size-h3: var(--fs-24);
            --font-size-p: var(--fs-20);
        }
    }

    h1 {
        font-size: var(--font-size-h1);
        font-weight: 600;
        letter-spacing: 0.05em;

        span {
            font-size: var(--font-size-h1-span);
            font-weight: 800;
        }
    }

    h2 {
        font-size: var(--font-size-h2);
        font-weight: 700;
        letter-spacing: 0.03em;
    }

    h3 {
        font-size: var(--font-size-h3);
        font-weight: 600;
        letter-spacing: 0.03em;
    }

    h1,
    h2,
    h3 {
        margin: 0;
        line-height: 1.1;
    }

    h1,
    h2,
    h3,
    p {
        text-align: center;
    }

    .section-header {
        h1 {
            margin-top: 25px;
        }

        p {
            margin-block: 20px;
        }
    }
}

/* =========================================================
   UKŁAD
   ========================================================= */
@layer layout {
    .wrapper {
        display: grid;
        grid-template-columns: 1fr calc(100% - 64px) 1fr;

        @media (width >= calc(750 / 16 * 1rem)) {
            grid-template-columns: 1fr min(calc(100% - 80px), calc(1110 / 16 * 1rem)) 1fr;
        }

        > * {
            grid-column: 2;
        }
    }
}

/* =========================================================
   DEKORACJE (.img-shadow, .divider--shimmer, .banner)
   ========================================================= */
@layer decoration {
    .img-shadow {
        box-shadow: 10px 10px 11px -7px var(--c-shadow-lg);
    }

    .divider--shimmer {
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--c-gold-metal), var(--c-gold-shine), var(--c-gold-metal), transparent);
        background-size: 200% 100%;
        animation: shimmer 6s linear infinite;

        @media (prefers-reduced-motion: reduce) {
            animation: none;
        }
    }

    @keyframes shimmer {
        from { background-position: 200% 0; }
        to   { background-position: -200% 0; }
    }

    .banner {
        padding-block: 24px;
        border-top: 1px solid var(--c-panel-border);

        p {
            margin: 0;
            color: var(--c-gold-bright);
            font-size: var(--fs-14);
            font-weight: 600;
            letter-spacing: 0.05em;
        }
    }
}

/* =========================================================
   PRZYCISKI
   ========================================================= */
@layer buttons {
    .button {
        font-weight: 700;
        text-transform: uppercase;
        color: var(--c-text); /* <button> nie dziedziczy koloru – bez tego tekst był czarny na brązie */
        background: var(--c-buy-btn-bg);
        border: none;
        letter-spacing: 0.05em;
        width: fit-content;
        padding: 10px 20px;
        text-align: center;
        transition: 250ms ease-in-out;
        transition-property: color, border-radius, box-shadow;

        &:hover,
        &:focus-visible {
            color: var(--c-gold-bright);
            border-radius: 25px;
            box-shadow: 10px 10px 11px -7px var(--c-shadow-lg);
        }

        &:focus-visible {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: 3px;
        }

        &:disabled {
            cursor: not-allowed;
            opacity: 0.6;
            color: var(--c-text);
        }

        &:disabled:hover,
        &:disabled:focus {
            border-radius: 0;
            box-shadow: none;
            background: var(--c-buy-btn-bg);
        }
    }

    .shop-button {
        display: block;
    }
}

/* =========================================================
   NAGŁÓWEK / NAWIGACJA (partials/header.html – wszystkie strony z menu)
   ========================================================= */
@layer header {
    #site-header {
        position: relative;
        z-index: 1;
    }

    /* Miejsce na treść wstawianą skryptem (js/includes.js, products.js, news.js) –
       bez tego strona przeskakuje, gdy się pojawi (CLS). Działa tylko, póki slot jest pusty. */
    #site-header:empty {
        min-height: 91px;
    }

    #products-list:empty,
    #news-grid:empty {
        min-height: 100vh;
    }

    #reviews:empty {
        min-height: 560px;
    }

    .header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-block: 10px;
    }

    .topnav {
        align-items: center;
    }

    .topnav .topnav__open,
    .topnav .topnav__close {
        background: none;
        border: none;
        padding: 0;

        @media (width >= calc(884 / 16 * 1rem)) {
            display: none;
        }
    }

    .topnav__open[aria-expanded='true'] + .topnav__menu {
        translate: 0;

        @media (prefers-reduced-motion) {
            opacity: 1;
        }
    }

    .topnav__close {
        display: block;
        margin-inline-start: auto;
        margin-block-end: 5rem;
        position: relative;
        top: 0;
        right: 12px;
    }

    .topnav__menu {
        @media (width < calc(884 / 16 * 1rem)) {
            position: fixed;
            inset: 56px 0 0 0;
            padding: 1.5rem;
            background-color: var(--c-banner-bg);
            translate: 100vw 0;
            transition: translate 0.5s ease-in-out !important;
        }

        @media (width < calc(884 / 16 * 1rem)) and (prefers-reduced-motion) {
            translate: 0;
            opacity: 0;
            transition: opacity 500ms ease-in-out;
        }

        @media (calc(547 / 16 * 1rem) <= width < calc(884 / 16 * 1rem)) {
            inset: 38px 0 0 0;
        }
    }

    .topnav__links {
        display: flex;
        gap: 1.2rem;
        align-items: center;
        margin: 0;
        padding: 0;
        font-weight: 600;

        @media (width < calc(884 / 16 * 1rem)) {
            flex-direction: column;
        }

        @media (width >= calc(884 / 16 * 1rem)) {
            font-size: var(--fs-14);
        }
    }

    .topnav__item {
        transition: 250ms ease-in-out;

        &:last-child {
            @media (width < calc(884 / 16 * 1rem)) {
                display: block;
                margin-top: 40px;
            }

            @media (width >= calc(884 / 16 * 1rem)) {
                margin-inline-start: 30px;
            }
        }

        &:hover {
            color: var(--c-gold);
            text-shadow: 1px 2px 5px var(--c-gold-shadow);
        }
    }

    .topnav__cart a {
        display: flex;
        align-items: center;
        gap: 10px;
        transition: 250ms ease-in-out;

        @media (width < calc(884 / 16 * 1rem)) {
            &::after {
                content: "Mój koszyk";
            }
        }

        &:hover {
            transform: scale(1.3);
        }

        img {
            width: 25px;
            height: 25px;
        }
    }

    .topnav__item--dropdown {
        position: relative;
    }

    .topnav__dropdown-toggle {
        padding: 0;
        border: none;
        background: none;
        color: inherit;
        font: inherit;
        cursor: pointer;
    }

    .topnav__submenu {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        min-width: 220px;
        padding: 0.75rem 0;
        background: color-mix(in srgb, var(--c-ink) 95%, transparent);
        backdrop-filter: blur(10px);
        border: 1px solid var(--c-line);
        border-radius: 12px;
        box-shadow:
            0 10px 30px var(--c-shadow-sm),
            0 2px 8px var(--c-shadow-sm);
        color: var(--c-text);
        text-shadow: none;
        margin: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition:
            opacity .2s ease,
            transform .2s ease,
            visibility .2s ease;
        z-index: 100;

        &::before {
            content: "";
            position: absolute;
            top: -6px;
            left: 20px;
            width: 12px;
            height: 12px;
            background: color-mix(in srgb, var(--c-ink) 95%, transparent);
            border-left: 1px solid var(--c-line);
            border-top: 1px solid var(--c-line);
            transform: rotate(45deg);
        }

        .topnav__link {
            display: block;
            padding: 0.75rem 1.25rem;
            white-space: nowrap;
            transition: background-color .2s ease;

            &:hover {
                background: var(--c-line);
                color: var(--c-gold-bright);
            }
        }
    }

    .topnav__item--dropdown:hover .topnav__submenu,
    .topnav__item--dropdown:focus-within .topnav__submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .topnav__arrow {
        display: inline-block;
        margin-left: 6px;
        font-size: 0.7em;
        transition: transform .2s ease;
    }

    .topnav__item--dropdown:hover .topnav__arrow,
    .topnav__item--dropdown:focus-within .topnav__arrow {
        transform: rotate(180deg);
    }
}

/* =========================================================
   STOPKA (partials/footer.html)
   ========================================================= */
@layer footer {
    .footer {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        align-items: center;
        justify-content: center;
        padding-bottom: 20px;

        /* na telefonie: miejsce na pływające przyciski (ciasteczko, strzałka w górę) */
        @media (width < calc(700 / 16 * 1rem)) {
            flex-direction: column;
            padding-bottom: calc(84px + env(safe-area-inset-bottom));
        }

        nav {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: center;

            @media (width < calc(700 / 16 * 1rem)) {
                flex-direction: column;
                align-items: center;
                gap: 14px;
            }

            a {
                transition: color 250ms ease-in-out;

                &:hover {
                    color: var(--c-gold-bright);
                }
            }
        }
    }
}

/* =========================================================
   BANER COOKIES
   ========================================================= */
@layer cookies {
    .cookie-banner {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: 900px;
        margin: 0 auto;
        background: var(--c-ink);
        color: var(--c-text);
        padding: 16px 20px;
        border-radius: 12px;
        box-shadow: 0 10px 40px var(--c-shadow-md);
        z-index: 9999;

        p {
            font-size: 0.9rem;
            line-height: 1.4;
        }

        @media (width <= calc(600 / 16 * 1rem)) {
            /* telefon: baner u góry i niższy – na dole zasłaniał przycisk zakupu w hero */
            top: 10px;
            bottom: auto;
            left: 10px;
            right: 10px;
            padding: 12px 14px;

            p {
                font-size: 0.8rem;
                line-height: 1.35;
            }

            .cookie-banner__content {
                gap: 10px;
            }

            .cookie-banner__actions .button {
                flex: 1;
                padding-block: 8px;
            }
        }

        a {
            color: var(--c-gold-bright);
            text-decoration: underline;
        }
    }

    .cookie-banner__content {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .cookie-banner__actions {
        display: flex;
        gap: 10px;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .cookie-icon {
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        border-radius: 50%;
        font-size: 30px;
        cursor: pointer;
        z-index: 1000;
        transition: all 0.3s ease;
        opacity: 0.6;

        &:hover {
            transform: scale(1.3);
        }
    }

    .cookie-modal {
        position: fixed;
        inset: 0;
        background: var(--c-scrim);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10000;
    }

    .cookie-modal__content {
        background: var(--c-ink);
        border: 1px solid var(--c-panel-border);
        color: var(--c-space-text);
        padding: 30px;
        border-radius: 12px;
        max-width: 500px;
        width: 90%;
        text-align: left;

        h3,
        p {
            font-size: var(--fs-14);
        }

        h3 {
            padding-bottom: 10px;
        }

        a {
            color: var(--c-gold-bright);
        }

        label {
            display: block;
            margin: 15px 0;
            font-size: var(--fs-14);
        }

        input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin-right: 10px;
            cursor: pointer;

            &:disabled {
                opacity: 0.6;
                cursor: not-allowed;
            }
        }
    }

    .cookie-modal__actions {
        margin-top: 20px;
        display: flex;
        gap: 10px;
        justify-content: flex-end;
    }
}

/* =========================================================
   PRZYCISK „DO GÓRY"
   ========================================================= */
@layer scroll-to-top {
    #scroll-to-top {
        position: fixed;
        bottom: 30px;
        right: 30px;
        width: 40px;
        height: 40px;
        background-color: var(--c-buy-btn-bg);
        color: var(--c-text);
        border: none;
        border-radius: 50%;
        font-size: 25px;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease, scale 0.3s ease;
        display: flex;
        justify-content: center;
        z-index: 999;

        &:hover,
        &:active {
            scale: 1.2;
        }

        &.visible {
            opacity: 1;
            visibility: visible;
        }
    }
}

/* =========================================================
   KOSZYK I ZAMÓWIENIE – komponent ładowany na wszystkich stronach z menu (js/cart.js)
   ========================================================= */
@layer cart {
    /* --- Koszyk --- */

    .cart-modal-window {
        position: fixed;
        inset: 0;
        /* nad zakładkami książki (5), paskiem zakupu (900), strzałką w górę (999) i oknem produktu (2000);
           pod banerem cookies (9999) */
        z-index: 3000;
        display: none;

        &.is-open {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            overflow-y: auto;

            @media (width <= calc(700 / 16 * 1rem)) {
                align-items: flex-start;
                padding: 10px;
            }
        }
    }

    .cart-modal__overlay {
        position: absolute;
        inset: 0;
        background: var(--c-scrim);
    }

    .cart-modal__panel {
        position: relative;
        background: var(--c-paper);
        color: var(--c-section-text);
        border-radius: 12px;
        max-width: 740px;
        width: calc(100% - 40px);
        max-height: calc(100dvh - 40px);
        padding: 20px;
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 2;

        @media (width <= calc(700 / 16 * 1rem)) {
            max-width: 100%;
            width: 100%;
            max-height: calc(100dvh - 20px);
            border-radius: 0;
            padding: 16px;
            margin: 0;
        }

        h3 {
            margin-bottom: 10px;
        }
    }

    .cart-modal__close {
        position: absolute;
        top: 8px;
        right: 8px;
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;

        @media (width <= calc(700 / 16 * 1rem)) {
            top: 10px;
            right: 10px;
        }
    }

    .cart-modal__body {
        display: flex;
        flex-direction: column;
        gap: 20px;

        @media (width <= calc(700 / 16 * 1rem)) {
            gap: 16px;
        }
    }

    .cart-modal__items {
        flex: 1 1 60%;
        display: flex;
        flex-direction: column;

        @media (width <= calc(700 / 16 * 1rem)) {
            width: 100%;
        }
    }

    .cart-item {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 8px;
        border-radius: 8px;
        background: var(--c-section-bg);

        @media (width <= calc(700 / 16 * 1rem)) {
            flex-direction: column;
            align-items: stretch;
            gap: 10px;
        }
    }

    .cart-item__left {
        display: flex;
        align-items: center;
        gap: 20px;

        @media (width <= calc(700 / 16 * 1rem)) {
            gap: 12px;
        }

        img {
            width: auto;
            height: 80px;
            object-fit: cover;
        }
    }

    .cart-item__right {
        display: flex;
        gap: 8px;
        align-items: center;

        @media (width <= calc(700 / 16 * 1rem)) {
            justify-content: space-between;
        }
    }

    .cart-qty {
        width: 54px;
        border: 1px solid var(--c-buy-btn-bg);
        padding: 4px 8px;
        text-align: center;
    }

    .cart-remove {
        background: none;
        border: none;
        color: var(--c-buy-btn-bg);
        cursor: pointer;
        font-size: 14px;
    }

    .cart-modal__summary {
        width: 240px;
        margin: 40px auto;

        @media (width <= calc(700 / 16 * 1rem)) {
            width: 100%;
            margin: 0;
            padding-top: 10px;
        }

        .cart-empty {
            color: var(--c-paper-muted);
            text-align: center;
        }
    }

    .cart-checkout {
        width: 100%;
        cursor: pointer;
        margin-top: 15px;
    }

    .cart-continue {
        display: inline-block;
        position: absolute;
        left: 20px;
        bottom: 20px;
        background: none;
        color: var(--c-buy-btn-bg);
        text-decoration: underline;
        cursor: pointer;
        font-weight: 700;

        @media (width <= calc(700 / 16 * 1rem)) {
            position: static;
            margin-top: 12px;
            text-align: center;
        }
    }

    .cart-stock-warning {
        @media (width <= calc(400 / 16 * 1rem)) {
            display: none;
        }
    }

    .cart-flash {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 24px;
        background: var(--c-scrim);
        color: var(--c-text);
        padding: 10px 16px;
        border-radius: 8px;
        opacity: 0;
        transition: opacity 200ms ease-in-out;
        z-index: 4000; /* nad oknem koszyka (3000) – komunikaty koszyka muszą być widoczne */
        pointer-events: none;

        &.is-visible {
            opacity: 1;
        }
    }

    .cart-count {
        position: relative;
        top: -15px;
        left: -20px;
        display: inline-block;
        background: var(--c-buy-btn-bg);
        color: var(--c-text);
        font-weight: 700;
        padding: 2px 8px;
        border-radius: 999px;
        margin-left: 6px;
        font-size: 13px;
    }

    /* --- Kroki zamówienia --- */

    .cart-step {
        display: none;

        &.active {
            display: block;
        }

        span {
            font-size: var(--font-size-p);
        }
    }

    .personalization-notice {
        margin-top: 16px;

        span {
            font-size: var(--fs-14);
            font-weight: 500;
        }
    }

    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 24px;
    }

    .form-group {
        &.full {
            grid-column: span 2;
        }

        label {
            display: block;
            margin-bottom: 6px;
            font-weight: 600;
        }

        input {
            width: 100%;
        }
    }

    .shipping-option {
        display: flex;
        padding: 12px 0;
        cursor: pointer;

        span {
            font-weight: 600;
            font-size: 15px;
        }

        input[type="radio"] {
            margin-right: 12px;
        }
    }

    .checkout-actions {
        margin-top: 30px;
    }

    .summary-section p {
        font-size: 15px;
        text-align: left;
    }

    .summary-section-special {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 40px;
    }

    .variant-hint {
        color: var(--c-text-muted);
        font-style: italic;
    }

    .cart-variant-selector {
        margin: 10px 0 14px 0;

        label {
            display: block;
            margin-bottom: 6px;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--c-paper-text);
        }

        select {
            width: 80%;
            padding: 5px 6px;
            border: 1px solid var(--c-paper-line);
            border-radius: 6px;
            background: var(--c-paper);
        }
    }

    .cart-item__format {
        font-size: 0.85em;
        color: var(--c-paper-muted);
    }

    .cart-item__preorder {
        font-size: 0.85em;
        color: var(--c-danger);
    }

    /* Elementy przełączane przez cart.js (style.display) – domyślnie ukryte */
    .cart-totals,
    .checkout-preview-total {
        display: none;
    }

    .preorder-global-info {
        display: none;
        margin-bottom: 10px;
        color: var(--c-danger);
        font-size: 0.9em;
    }

    .required-mark {
        color: var(--c-danger);
    }

    /* --- Paczkomat InPost --- */

    .paczkomat-section {
        display: none;
        margin-block: 10px;
        background: var(--c-section-bg);
        border: 1px solid var(--c-paper-line);
        border-radius: 10px;
    }

    .paczkomat-section__hint {
        margin: 10px 0 12px;
        color: var(--c-paper-text);
        line-height: 1.3;
    }

    .paczkomat-section__map-btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .paczkomat-section__code {
        padding: 6px;
        font-family: monospace;
        font-size: 1.1em;
        text-transform: uppercase;
    }

    .paczkomat-section__note {
        padding-bottom: 6px;
        color: var(--c-paper-muted);
    }

    /* --- Podsumowanie zamówienia --- */

    .summary-item {
        margin-bottom: 12px;
    }

    .summary-preorder-notice {
        margin-top: 10px;
        color: var(--c-danger);
    }

    /* --- Ostrzeżenie: brak wybranego formatu ebooka --- */

    .variant-warning {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--c-scrim);
    }

    .variant-warning__box {
        width: 90%;
        max-width: 440px;
        padding: 35px 30px;
        border-radius: 12px;
        background: var(--c-paper);
        color: var(--c-section-text);
        text-align: center;
        box-shadow: 0 20px 50px var(--c-shadow-md);
    }

    .variant-warning__title {
        margin: 0 0 18px;
        color: var(--c-danger);
    }

    .variant-warning__text {
        margin-bottom: 28px;
        font-size: 1.08rem;
        line-height: 1.55;
    }

    .variant-warning__btn {
        padding: 14px 36px;
        font-size: 1.05rem;
    }
}

/* =========================================================
   KARTY KSIĄŻEK – komponent: index.html + sekcja serii na stronach książek
   ========================================================= */
@layer books {
    .books {
        padding-block: 0;
        color: var(--c-space-text);
    }

    .book_series {
        display: block;
        margin: 0 0 14px;
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .books-inner > h2 {
        position: relative;
        padding-block-end: 16px;

        &::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 50%;
            width: 48px;
            height: 1px;
            background: var(--c-gold);
            transform: translateX(-50%);
        }
    }

    .books-intro {
        margin-block: 16px 0;
        color: var(--c-text-muted);
        font-size: 12px;
    }

    .book_themes {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 0;
        margin-block: 20px;
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 600;

        li:not(:last-child)::after {
            content: "•";
            display: inline-block;
            margin-inline: 8px;
            color: var(--c-gold);
        }
    }

    .books-box {
        width: min(100%, calc(900 / 16 * 1rem));
        margin: 40px auto;
        padding: clamp(20px, 4vw, 36px);
        border: 1px solid var(--c-panel-border);
        border-radius: 10px;
        background:
            radial-gradient(ellipse at 50% 0%, var(--c-gold-wash), transparent 45%),
            var(--c-panel-bg);
    }

    .books-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: 1fr;
        gap: 28px;
        width: min(100%, calc(700 / 16 * 1rem));
        margin: 24px auto 0;

        @media (width < calc(700 / 16 * 1rem)) {
            width: min(100%, 220px);
        }

        @media (width >= calc(700 / 16 * 1rem)) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    /* --- Karta książki --- */

    .book-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 0;
        text-align: center;

        .button {
            min-width: 120px;
            margin-block-start: 0;
            padding: 8px 14px;
            border-radius: 4px;
            font-size: 12px;

            &:hover,
            &:focus-visible {
                border-radius: 4px;
            }
        }

        .book-card__details {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 32px;
            padding: 6px 10px;
            border: 1px solid var(--c-gold-line-strong);
            border-radius: 4px;
            background: transparent;
            color: var(--c-gold-bright);
            font-size: 11px;
            font-weight: 600;
            transition: background-color 180ms ease, color 180ms ease;

            &:hover,
            &:focus-visible {
                background: var(--c-gold-bright);
                color: var(--c-space-deep);
            }
        }
    }

    .book-card__cover {
        position: relative;
        display: grid;
        place-items: center;
        width: 100%;
        aspect-ratio: 3 / 4;
        margin: 0;
        overflow: hidden;
        border: 1px solid var(--c-text-muted);
        border-radius: 9px;
        background-color: var(--c-space-deep);

        img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
    }

    .books-item__download {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 1rem;
        border-radius: 8px;
        background: var(--c-scrim);
        color: var(--c-text);
        font-weight: 700;
        opacity: 0;
        text-align: center;
        transition: opacity 200ms ease;
    }

    .book-card__cover:hover .books-item__download,
    .books-item__download:focus-visible {
        opacity: 1;
    }

    /* Dotyk nie ma hovera: zamiast niewidzialnej nakładki na całej okładce
       (dotknięcie okładki pobierało PDF bez ostrzeżenia) – widoczna plakietka u dołu */
    @media (hover: none) {
        .books-item__download {
            inset: auto auto 10px 50%;
            translate: -50% 0;
            width: max-content;
            padding: 6px 14px;
            border: 1px solid var(--c-gold-line-strong);
            border-radius: 999px;
            color: var(--c-gold-bright);
            font-size: 13px;
            opacity: 1;
        }
    }

    /* Okładka zastępcza (tom w przygotowaniu) */

    .book-card__cover--placeholder {
        display: flex;
        flex-direction: column;
        justify-content: center;
        background:
            linear-gradient(color-mix(in srgb, var(--c-ink) 30%, transparent), color-mix(in srgb, var(--c-ink) 70%, transparent)),
            url("./img/bg-hero-mobile.webp") center / cover no-repeat;
        color: var(--c-gold-bright);
    }

    .book-card__cover-design {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        justify-content: center;
        padding: 24px 18px;
        text-align: center;
    }

    .book-card__cover-series {
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 800;
    }

    .book-card__cover-divider {
        width: min(100%, 140px);
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
    }

    .book-card__cover-title {
        color: var(--c-space-text);
        font-size: var(--fs-16);
        font-weight: 700;
    }

    .book-card__cover-status {
        color: var(--c-text-muted);
        font-size: 10px;
        font-weight: 800;
    }

    .book-card__lock {
        position: relative;
        width: 18px;
        height: 14px;
        margin: 0;
        border: 1.5px solid var(--c-gold);
        border-radius: 3px;

        &::before {
            content: "";
            position: absolute;
            left: 3px;
            top: -9px;
            width: 9px;
            height: 9px;
            border: 1.5px solid var(--c-gold);
            border-bottom: 0;
            border-radius: 7px 7px 0 0;
        }

        &::after {
            content: "";
            position: absolute;
            top: 4px;
            left: 50%;
            width: 2px;
            height: 3px;
            border-radius: 2px;
            background: var(--c-gold);
            transform: translateX(-50%);
        }
    }

    .book-card__content {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding-block-start: 10px;

        h3 {
            margin-block-end: 12px;
            font-size: var(--fs-16);
        }
    }

    .book-card__volume {
        margin: 0 0 8px;
        color: var(--c-gold);
        font-size: 12px;
    }

    .book-card__description {
        margin: 0 0 16px;
        color: var(--c-text-muted);
        font-size: 12px;
    }

    .book-card__actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin-block-start: auto;
    }

    /* --- Okienko „Darmowy fragment” (js/sample-gate.js) --- */

    .sample-dialog {
        width: min(100% - 32px, calc(460 / 16 * 1rem));
        padding: clamp(24px, 5vw, 36px);
        border: 1px solid var(--c-gold-line-strong);
        border-radius: 12px;
        background:
            radial-gradient(ellipse at 50% 0%, var(--c-gold-wash), transparent 60%),
            var(--c-surface);
        color: var(--c-text);
        text-align: center;

        &::backdrop {
            background: var(--c-scrim);
        }

        h2 {
            margin-block-end: 10px;
        }

        @media (prefers-reduced-motion: no-preference) {
            &[open] {
                animation: sample-dialog-in 250ms var(--ease-out);
            }
        }
    }

    @keyframes sample-dialog-in {
        from {
            opacity: 0;
            scale: 0.96;
        }
    }

    .sample-dialog__close {
        position: absolute;
        top: 10px;
        right: 12px;
        border: none;
        background: none;
        color: var(--c-text-muted);
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
    }

    .sample-dialog__intro {
        margin: 0 0 20px;
        color: var(--c-text-muted);
        line-height: 1.6;
    }

    .sample-dialog__form {
        display: grid;
        gap: 12px;
        text-align: start;

        label:not(.sample-dialog__check) {
            display: grid;
            gap: 4px;
            font-size: var(--fs-14);
            font-weight: 600;
        }

        input[type="text"],
        input[type="email"] {
            padding: 11px 14px;
            border: 1px solid var(--c-gold-line-strong);
            border-radius: 6px;
            background: var(--c-surface);
            color: var(--c-text);
            font: inherit;
            font-size: var(--fs-16);

            &:focus-visible {
                outline: none;
                border-color: var(--c-gold-bright);
                box-shadow: 0 0 0 1px var(--c-gold-bright);
            }
        }

        .button {
            justify-self: center;
            margin-block-start: 6px;
        }
    }

    .sample-dialog__check {
        display: flex;
        gap: 10px;
        align-items: flex-start;
        font-size: var(--fs-14);
        line-height: 1.5;
        color: var(--c-text-muted);

        input {
            flex-shrink: 0;
            margin-top: 3px;
            accent-color: var(--c-gold-bright);
        }
    }

    .sample-dialog__legal,
    .sample-dialog__status {
        margin: 0;
        font-size: var(--fs-14);
        text-align: center;
        color: var(--c-text-muted);

        a {
            color: var(--c-gold-bright);
            text-decoration: underline;
        }
    }

    .sample-dialog__status {
        color: var(--c-gold-bright);
        font-weight: 600;

        &:empty {
            display: none;
        }

        &.is-error {
            color: var(--c-text);
        }
    }
}

/* =========================================================
   STRONA: index.html – hero, scroll-hint, (sekcje „autor" i „newsletter" są teraz zakomentowane w HTML)
   ========================================================= */
@layer page-home {
    .hero {
        padding: 0 40px 0;
        position: relative;
        min-height: calc(100vh - 90px);
        min-height: calc(100svh - 90px);
        justify-items: center;
        align-content: center;

        /* telefon: okładka bliżej nagłówka zamiast na środku ekranu */
        @media (width < calc(700 / 16 * 1rem)) {
            align-content: start;
            padding-block-start: 8px;
        }

        @media (width >= calc(700 / 16 * 1rem)) {
            display: flex;
            align-items: center;
            justify-content: center;
            align-content: center;
        }
    }

    .hero-img {
        @media (width < calc(700 / 16 * 1rem)) {
            margin-block-end: 20px;
        }
    }

    .hero-img img {
        width: 190px;
        filter:
            drop-shadow(0 0 5px var(--c-gold-glow-soft))
            drop-shadow(0 0 20px var(--c-gold-line));

        @media (width >= calc(700 / 16 * 1rem)) {
            width: 300px;
        }

        @media (width >= calc(1000 / 16 * 1rem)) {
            width: 340px;
        }
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;

        @media (width >= calc(700 / 16 * 1rem)) {
            margin-left: 40px;
        }

        h1 {
            padding-block-end: clamp(14px, 3vw, 25px);
            width: 20ch;
        }

        p {
            width: 30ch;

            @media (width >= calc(1100 / 16 * 1rem)) {
                width: 45ch;
            }
        }

        .cta-slot {
            margin-block-start: clamp(22px, 5vw, 40px);
        }

        .hero-price {
            font-weight: 600;
            white-space: nowrap;
        }
    }

    .scroll-hint {
        position: absolute;
        left: 50%;
        bottom: 32px;
        transform: translateX(-50%);
        width: 26px;
        height: 42px;
        border: 1.6px solid var(--c-gold-line-strong);
        border-radius: 14px;
        display: flex;
        justify-content: center;
        padding-top: 8px;
        animation: hint-float 2.4s ease-in-out infinite;

        @media (prefers-reduced-motion: reduce) {
            animation: none;
        }
    }

    .scroll-hint__dot {
        width: 2.5px;
        height: 8px;
        border-radius: 1px;
        background: var(--c-gold-metal);
        opacity: 0.35;
        animation: hint-glow 2.4s ease-in-out infinite;

        @media (prefers-reduced-motion: reduce) {
            animation: none;
            opacity: 1;
        }
    }

    @keyframes hint-glow {
        0%, 100% {
            opacity: 0.35;
            box-shadow: none;
        }
        50% {
            opacity: 1;
            box-shadow: 0 0 6px 1px var(--c-gold-glow);
        }
    }

    @keyframes hint-float {
        0%, 100% { transform: translate(-50%, 0); }
        50%      { transform: translate(-50%, 3px); }
    }

    body.homepage::before {
        height: 100vh;
        height: 100svh;
        mask-image: none;
        opacity: 1;
    }

    /* Mały złoty nadtytuł sekcji (opinie, autorka, kontakt) */
    .home-eyebrow {
        margin: 0 0 10px;
        color: var(--c-gold);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-align: center;
        text-transform: uppercase;
    }

    /* --- Opinie (treść z partials/reviews.html) --- */

    .reviews-summary {
        margin: -14px 0 28px;
        color: var(--c-gold-bright);
        font-size: var(--fs-14);
        font-weight: 600;

        &[hidden] {
            display: none;
        }
    }

    .reviews-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 14px 28px;
        margin-block-start: 28px;

        .button {
            border-radius: 6px;
        }
    }

    .reviews-more-link,
    .author-link {
        color: var(--c-gold-bright);
        font-size: var(--fs-14);
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;

        &::after {
            content: " →";
        }

        &:hover,
        &:focus-visible {
            text-decoration: underline;
            text-underline-offset: 4px;
        }
    }

    /* --- O autorce --- */

    .author {
        padding-block: clamp(48px, 8vw, 80px);
        color: var(--c-space-text);
    }

    .author-box {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: clamp(24px, 5vw, 56px);
        align-items: center;
        width: min(100%, calc(980 / 16 * 1rem));
        margin-inline: auto;
        padding: clamp(20px, 4vw, 44px);
        border: 1px solid var(--c-gold-line);
        border-radius: 12px;
        background:
            radial-gradient(ellipse at 0% 0%, var(--c-gold-wash), transparent 45%),
            var(--c-surface);

        @media (width >= calc(800 / 16 * 1rem)) {
            grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        }
    }

    .author-img {
        margin: 0;

        img {
            width: min(100%, 340px);
            margin-inline: auto;
            border: 1px solid var(--c-gold-line);
            border-radius: 12px;
            box-shadow: 0 20px 40px var(--c-shadow-md);
        }
    }

    .author-content {
        h2 {
            margin-block-end: 14px;
        }

        > p {
            margin: 0 0 14px;
            color: var(--c-text-soft);
            line-height: 1.75;
        }

        /* długie akapity czyta się lepiej wyrównane do lewej */
        > p:not(.home-eyebrow, .author-lead) {
            text-align: start;
        }

        @media (width >= calc(800 / 16 * 1rem)) {
            :is(h2, p, .home-eyebrow) {
                text-align: left;
            }
        }
    }

    .author-content > .author-lead {
        margin-block-end: 22px;
        color: var(--c-gold-bright);
        font-size: var(--fs-16);
        font-style: italic;
        line-height: 1.6;
    }

    .author-facts {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        margin-block: 24px;

        @media (width >= calc(560 / 16 * 1rem)) {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        li {
            display: grid;
            gap: 2px;
            padding: 12px 14px;
            border: 1px solid var(--c-gold-line);
            border-radius: 8px;
            background: var(--c-surface-2);
        }

        strong {
            color: var(--c-gold);
            font-size: 11px;
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }

        span {
            font-size: var(--fs-14);
        }
    }

    .author-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 14px 28px;

        @media (width >= calc(800 / 16 * 1rem)) {
            justify-content: flex-start;
        }

        .button {
            border-radius: 6px;
        }
    }

    /* --- Kontakt --- */

    .contact {
        padding-block: 0 clamp(48px, 8vw, 80px);
        color: var(--c-space-text);
    }

    .contact-box {
        display: grid;
        justify-items: center;
        width: min(100%, calc(720 / 16 * 1rem));
        margin-inline: auto;
        text-align: center;

        h2 {
            margin-block-end: 12px;
        }
    }

    .contact-intro {
        max-width: 52ch;
        margin: 0 0 22px;
        color: var(--c-text-muted);
        line-height: 1.7;
    }

    .contact-email {
        padding: 14px 26px;
        border: 1px solid var(--c-gold-line-strong);
        border-radius: 6px;
        color: var(--c-gold-bright);
        font-size: var(--fs-16);
        font-weight: 700;
        transition: background-color 180ms ease;

        &:hover,
        &:focus-visible {
            background: var(--c-gold-tint);
        }
    }

    .contact-social-title {
        margin: 32px 0 12px;
        color: var(--c-text-muted);
        font-size: var(--fs-14);
    }

    .contact-social {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;

        a {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px 8px 10px;
            border: 1px solid var(--c-gold-line);
            border-radius: 999px;
            background: var(--c-surface);
            font-size: var(--fs-14);
            font-weight: 600;
            transition: border-color 180ms ease;

            &:hover,
            &:focus-visible {
                border-color: var(--c-gold-bright);
            }
        }

        /* Ikony SVG są ciemnobrązowe – złote kółko zapewnia kontrast na ciemnym tle */
        img {
            width: 26px;
            height: 26px;
            padding: 3px;
            border-radius: 50%;
            background: var(--c-gold-bright);
        }
    }

    .newsletter {
        background:
            url("./img/zawijas-2.webp") left max(-60px, calc(50% - 560px)) center / auto 135% no-repeat,
            radial-gradient(ellipse at 50% 0%, var(--c-gold-wash), transparent 52%),
            linear-gradient(180deg, var(--c-space-deep), var(--c-panel-bg));
        color: var(--c-text);
        padding-block: clamp(40px, 7vw, 64px);
        margin-bottom: 40px;
        border-block: 1px solid var(--c-gold-line);
    }

    .newsletter-box {
        display: grid;
        justify-items: center;
        width: min(100%, calc(560 / 16 * 1rem));
        margin-inline: auto;
        text-align: center;

        h2 {
            margin-block-end: 12px;
        }
    }

    .newsletter-intro {
        max-width: 48ch;
        margin: 0 0 22px;
        color: var(--c-text-muted);
        line-height: 1.7;
    }

    .newsletter-form {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;

        input[type="email"] {
            flex: 1 1 240px;
            min-width: 0;
            padding: 12px 16px;
            border: 1px solid var(--c-gold-line-strong);
            border-radius: 6px;
            background: var(--c-surface);
            color: var(--c-text);
            font: inherit;
            font-size: var(--fs-16); /* 16px – iOS nie przybliża strony przy fokusie */
            caret-color: var(--c-gold-bright);

            &::placeholder {
                color: var(--c-text-muted);
            }

            &:focus-visible {
                outline: none;
                border-color: var(--c-gold-bright);
                box-shadow: 0 0 0 1px var(--c-gold-bright);
            }
        }

        .button:disabled {
            opacity: 0.6;
            cursor: wait;
        }
    }

    .newsletter-hp {
        position: absolute;
        left: -9999px;
    }

    .newsletter-consent,
    .newsletter-status {
        flex-basis: 100%;
        margin: 4px 0 0;
        color: var(--c-text-muted);
        font-size: var(--fs-14);

        a {
            color: var(--c-gold-bright);
            text-decoration: underline;
        }
    }

    .newsletter-status {
        color: var(--c-gold-bright);
        font-weight: 600;

        &:empty {
            display: none;
        }

        &.is-error {
            color: var(--c-text);
        }
    }
}

/* =========================================================
   STRONA: shop.html – lista produktów, filtry
   ========================================================= */
@layer page-shop {
    .filters {
        h1 {
            margin-top: 40px;
        }

        .shop-intro {
            max-width: 60ch;
            margin: 12px auto 0;
            color: var(--c-text-muted);
            text-align: center;
            line-height: 1.6;

            a {
                color: var(--c-gold-bright);
                text-decoration: underline;
            }
        }

        ul {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            justify-content: center;
            margin-block: 40px;
        }

        /* wszystkie filtry jako pigułki – wcześniej tylko aktywny był zaokrąglony */
        .button {
            border-radius: 25px;
        }

        .button.active {
            border-radius: 25px;
            color: var(--c-space-deep);
            background: var(--c-gold-bright);
            box-shadow: 6px 8px 14px var(--c-shadow-sm);
        }
    }

    /* --- Lista produktów --- */

    .products {
        padding-block: 20px 40px;
        color: var(--c-space-text);
        margin-block-end: 20px;
    }

    .products-list {
        margin-bottom: 40px;
    }

    .products-group {
        margin-block-end: 24px;

        h2 {
            margin: 0 0 12px 0;
            font-size: var(--fs-20);
        }

        .group-items {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
            gap: 20px;
            justify-content: center;
            margin-inline: auto;
        }

        .group-items > .product {
            height: 100%;
            align-items: stretch;
        }
    }

    .product {
        background: var(--c-panel-bg);
        color: var(--c-space-text);
        border: 1px solid var(--c-panel-border);
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 12px 30px var(--c-shadow-md);
        display: flex;
        flex-direction: column;

        img {
            height: 200px;
            object-fit: contain;
            margin-bottom: 12px;
        }
    }

    .product-card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .product-info {
        display: flex;
        flex-direction: column;
        gap: 8px;

        h3 {
            font-size: var(--fs-16);
            margin-bottom: 8px;

            span {
                font-weight: 800;
            }
        }

        p {
            font-size: var(--fs-16);
            flex-grow: 1;
        }
    }

    .product-price {
        font-weight: 700;
        color: var(--c-gold-bright);
        margin-bottom: 8px;
    }

    .button.buy {
        width: fit-content;
        margin: 0 auto;
        display: block;
        cursor: pointer;
    }

    .product-image {
        position: relative;
        cursor: pointer;
        overflow: hidden;

        img {
            width: 100%;
            display: block;
            transition: transform .25s ease;
        }

        &:hover .product-overlay {
            opacity: 1;
        }
    }

    .product-overlay {
        position: absolute;
        inset: 0;
        background: var(--c-scrim);
        color: var(--c-text);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        letter-spacing: .1em;
        opacity: 0;
        transition: opacity .25s ease;
    }

    .autopay {
        display: block;

        h2 {
            margin-block-end: 20px;
        }

        img {
            width: 100%;
            max-width: 500px;
            margin: 0 auto;
            display: block;
            border-radius: 8px;
        }
    }

    /* --- Modal produktu --- */

    .modal {
        position: fixed;
        inset: 0;
        display: none;
        z-index: 2000;

        &.open {
            display: block;
        }
    }

    .modal-overlay {
        position: absolute;
        inset: 0;
        background: var(--c-scrim);
    }

    .modal-box {
        position: relative;
        max-width: 900px;
        margin: 5vh auto;
        background: var(--c-ink);
        border: 1px solid var(--c-panel-border);
        padding: 30px;
        border-radius: 12px;

        @media (width <= calc(1100 / 16 * 1rem)) {
            max-width: 90%;
            padding: 20px;
        }

        @media (width <= calc(750 / 16 * 1rem)) {
            margin: 3vh auto;
            padding: 15px;
        }
    }

    .modal-content {
        display: grid;
        grid-template-columns: 300px 1fr;
        gap: 30px;

        @media (width <= calc(1100 / 16 * 1rem)) {
            grid-template-columns: 1fr;
            gap: 20px;
        }

        @media (width <= calc(750 / 16 * 1rem)) {
            gap: 15px;
        }

        p {
            margin-block: 20px;
        }

        img {
            width: 60%;
            margin: 0 auto;
        }
    }

    .modal-close {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .modal-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 25px;
        padding-top: 20px;
        border-top: 1px solid var(--c-line);

        @media (width <= calc(750 / 16 * 1rem)) {
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }
    }

    #modal-price {
        font-size: 1.4rem;
        font-weight: 600;

        @media (width <= calc(750 / 16 * 1rem)) {
            font-size: 1.2rem;
        }
    }
}

/* =========================================================
   STRONA: news.html – lista wpisów („Blog pisarski")
   ========================================================= */
@layer page-news {
    #news-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 30px;
        margin: 20px auto;

        @media (width <= calc(1100 / 16 * 1rem)) {
            grid-template-columns: repeat(2, 1fr);
        }

        @media (width <= calc(700 / 16 * 1rem)) {
            grid-template-columns: 1fr;
        }
    }

    /* --- Karta wpisu --- */

    .news-card {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        border-radius: 18px;
        background: var(--c-glass);
        backdrop-filter: blur(14px);
        border: 1px solid var(--c-line);
        box-shadow: 0 8px 30px var(--c-shadow-sm);
        /* uniesienie pod kursorem: @layer motion */

        span,
        p {
            font-size: var(--fs-14);
        }

        h3 {
            margin: 15px 0;
        }

        a {
            display: block;
            margin: auto 0 15px;
            align-self: flex-end;
            color: var(--c-gold-bright);
            position: relative;
            transition: color 0.25s ease, transform 0.25s ease;

            &::after {
                content: "";
                position: absolute;
                left: 0;
                bottom: -3px;
                width: 0%;
                height: 1px;
                background: currentColor;
                transition: width 0.3s ease;
            }

            &:hover {
                color: var(--c-space-text);
                transform: translateX(-4px);

                &::after {
                    width: 100%;
                }
            }
        }
    }

    .news-card__content {
        display: flex;
        flex-direction: column;
        flex: 1;
        margin: 0 10px;
    }

    .news-card__top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }

    .news-card__category {
        display: inline-block;
        margin-top: 10px;
        padding: 6px 12px;
        border-radius: 999px;
        font-size: 0.8rem;
        font-weight: 800;
        color: var(--c-gold-bright);

        &.proces-tworczy {
            background: var(--c-tag-gold-bg);
        }

        &.wizualny-swiat {
            background: var(--c-tag-violet-bg);
        }

        &.proces-wydawniczy {
            background: var(--c-tag-teal-bg);
        }

        &.ciekawostki {
            background: var(--c-tag-green-bg);
        }

        &.wydarzenia {
            background: var(--c-tag-violet-bg);
        }
    }

    .news-card__date {
        font-size: 0.75rem;
        opacity: 0.6;
        font-variant-numeric: tabular-nums;
    }
}

/* =========================================================
   STRONA: blog/*.html – pojedynczy artykuł
   ========================================================= */
@layer page-article {
    /* --- Wpis bloga --- */

    /* Kolumna wpisu nie rośnie ponad ekran (szeroka tabela albo brakujące zdjęcie rozpychały stronę na telefonie) */
    .news__article,
    .news__article-content {
        width: 100%; /* przy margin: auto bez tego szerokość brała się z zawartości */
        min-width: 0;
    }

    .news__article-content table {
        /* szeroka tabela przewija się w bok we własnym polu */
        display: block;
        overflow-x: auto;
        max-width: 100%;
        margin-block: 20px;
        border-collapse: collapse;
        font-size: var(--fs-14);
        line-height: 1.5;

        th,
        td {
            padding: 10px 12px;
            border: 1px solid var(--c-gold-line);
            text-align: left;
            vertical-align: top;
            min-width: 120px;
        }

        th {
            background: var(--c-gold-tint);
            color: var(--c-gold-bright);
            font-weight: 700;
        }
    }

    .news__article {
        margin: 0 auto;

        a {
            margin-top: 20px;
            color: var(--c-gold-bright);

            &:hover {
                color: var(--c-space-text);
            }
        }

        img {
            margin-block: 25px;
        }

        h1 {
            max-width: 800px;
        }

        span {
            margin: 20px 0;
        }
    }

    .news__article-content {
        /* ~70 znaków w linii – długie wiersze na desktopie męczyły przy czytaniu */
        max-width: 68ch;
        margin: 0 auto 20px;
        color: var(--c-space-text);

        p {
            font-size: var(--fs-16);
            line-height: 1.75;
            text-align: start; /* justowanie robiło dziury między słowami na telefonie */
        }

        span {
            display: block;
            font-size: var(--fs-16);
            font-weight: 700;
        }

        /* śródtytuły i listy w nowszych wpisach */
        h2 {
            margin: 2em 0 0.5em;
            font-size: var(--fs-24);
            text-align: start;
        }

        ul,
        ol {
            padding-left: 1.5em;
            font-size: var(--fs-16);
            line-height: 1.75;
        }

        ul {
            list-style: disc;
        }

        ol {
            list-style: decimal;
        }

        table {
            width: 100%;
            margin-block: 1em;
            border-collapse: collapse;
            font-size: var(--fs-16);
        }

        th,
        td {
            padding: 8px 12px;
            border-bottom: 1px solid var(--c-gold-line-strong);
            text-align: start;
        }

        a {
            color: var(--c-gold-bright);
        }
    }

    .article-pagination {
        display: flex;
        text-align: center;
        justify-content: space-between;
    }

    .article-navigation {
        margin: 40px 0;
        text-align: center;

        a {
            display: inline-block;
            padding: 14px 28px;
            border-radius: 999px;
            border: 1px solid var(--c-gold-line-strong);
            color: var(--c-gold-bright);
            transition: .3s;

            &:hover {
                background: var(--c-gold-bright);
                color: var(--c-space-deep);
            }
        }
    }
}

/* =========================================================
   STRONA: faq.html
   ========================================================= */
@layer page-faq {
    .faq {
        @media (width <= calc(700 / 16 * 1rem)) {
            padding-block: 32px;
        }

        h1 {
            margin-top: 25px;
        }

        p {
            margin-block: 20px;
        }
    }

    .faq-content {
        margin-top: 15px;
    }

    .faq-intro {
        max-width: 60ch;
        margin: 0 auto 40px;
        opacity: 0.75;

        a {
            color: var(--c-gold-bright);
        }
    }

    .faq-category {
        color: var(--c-space-text);
        max-width: calc(760 / 16 * 1rem);
        margin: 40px auto;

        h2 {
            font-size: var(--fs-20);
            text-align: left;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--c-panel-border);
        }
    }

    .faq-item {
        border: 1px solid var(--c-panel-border);
        border-radius: 16px;
        background: var(--c-panel-bg);
        box-shadow: 0 8px 24px var(--c-shadow-md);
        margin-bottom: 14px;
        overflow: hidden;

        summary {
            cursor: pointer;
            list-style: none;
            padding: 18px 24px;
            font-weight: 700;
            font-size: var(--fs-16);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            text-align: left;
            transition: background-color 200ms ease;

            @media (width <= calc(700 / 16 * 1rem)) {
                padding: 14px 18px;
                font-size: var(--fs-14);
            }

            &:hover {
                background-color: var(--c-gold-tint-soft);
            }

            &::-webkit-details-marker {
                display: none;
            }

            &::after {
                content: "+";
                font-size: 1.4rem;
                font-weight: 400;
                color: var(--c-gold);
                transition: transform 250ms ease;
                flex-shrink: 0;
            }
        }

        &[open] summary::after {
            transform: rotate(45deg);
        }

        p {
            padding: 0 24px 20px;
            text-align: left;
            font-size: var(--fs-14);
            line-height: 1.6;
        }
    }
}

/* =========================================================
   STRONA: all-reviews.html – opinie czytelników
   ========================================================= */
@layer page-reviews {
    .reviews {
        color: var(--c-space-text);
        padding-block: 48px;
        background:
            url("./img/zawijas-1.webp") right 4% top -40px / auto 105% no-repeat,
            radial-gradient(ellipse at 80% 0%, var(--c-gold-wash), transparent 35%),
            linear-gradient(180deg, var(--c-space-deep), var(--c-space-mid));

        @media (width < calc(700 / 16 * 1rem)) {
            padding-block: 40px;
        }

        > h2 {
            margin-bottom: 30px;
        }
    }

    .reviews-slider {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "prev viewport next";
        align-items: center;
        gap: clamp(12px, 2vw, 24px);
        width: min(100%, calc(980 / 16 * 1rem));
        margin-inline: auto;

        @media (width < calc(700 / 16 * 1rem)) {
            grid-template-columns: 1fr auto auto 1fr;
            grid-template-areas:
                "viewport viewport viewport viewport"
                ". prev next .";
        }
    }

    .reviews-slider:not([data-initialized='true']) .review-btn,
    .review-dots {
        display: none;
    }

    .reviews[data-slider-ready='true'] .review-dots {
        display: flex;
    }

    .reviews-item[hidden],
    .review-btn[hidden],
    .review-dots[hidden] {
        display: none !important;
    }

    .reviews-viewport {
        grid-area: viewport;
        width: 100%;
        overflow: hidden;
        touch-action: pan-y;
        /* cień karty tutaj, nie na .reviews-item – overflow: hidden ucinał go przy rogach */
        filter: drop-shadow(0 20px 35px var(--c-shadow-md));
    }

    .reviews-track {
        display: grid;
        gap: 20px;
    }

    .reviews-slider[data-initialized='true'] {
        .reviews-track {
            display: block;
        }

        .reviews-item {
            display: none;
        }

        .reviews-item.active {
            display: block;
            animation: reviews-fade 350ms ease;
        }
    }

    .reviews-item {
        position: relative;
        overflow: hidden;
        padding: clamp(24px, 4vw, 40px);
        border-radius: 28px;
        border: 1px solid var(--c-panel-border);
        background-color: var(--c-panel-bg);
        background-image: url('./img/feather-sm.webp');
        background-repeat: no-repeat;
        background-size: clamp(35px, 5vw, 50px);
        background-position: right 30px top 10px;

        @media (width < calc(700 / 16 * 1rem)) {
            border-radius: 22px;
            padding-inline: 22px;
        }

        &::before {
            content: "\201C";
            position: absolute;
            top: 10px;
            left: 18px;
            font-size: clamp(3rem, 8vw, 5rem);
            line-height: 1;
            color: var(--c-gold-line);
            font-weight: 800;
        }
    }

    .review-stars {
        display: flex;
        margin-bottom: 18px;
        justify-content: center;
        color: var(--c-gold-bright);
        font-size: clamp(1.2rem, 2vw, 1.45rem);
        letter-spacing: 0.18em;
    }

    .review-short,
    .review-full,
    .review-book,
    .review-author {
        position: relative;
        z-index: 1;
        text-align: center;
    }

    .review-book {
        margin-bottom: 16px;
        color: var(--c-gold);
        font-size: var(--fs-14);
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .review-short,
    .review-full {
        color: var(--c-space-text);
        font-size: var(--fs-14);
        line-height: 1.6;
    }

    .review-short {
        font-weight: 600;
    }

    .review-full {
        display: none;
        margin-top: 20px;
    }

    .reviews-item.is-expanded {
        .review-short {
            display: none;
        }

        .review-full {
            display: block;
        }
    }

    .read-more {
        position: relative;
        z-index: 1;
        margin-top: 15px;
        padding: 5px 9px;
        border: 1px solid var(--c-gold-line-strong);
        border-radius: 999px;
        background: transparent;
        color: var(--c-gold-bright);
        font: inherit;
        font-size: var(--fs-14);
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        cursor: pointer;
        transition: 250ms ease;
        transition-property: background-color, color, transform, box-shadow;

        &:hover,
        &:focus-visible {
            background-color: var(--c-gold-bright);
            color: var(--c-space-deep);
            transform: translateY(-1px);
            box-shadow: 0 10px 22px var(--c-shadow-md);
        }
    }

    .review-author {
        margin-top: 18px;
        color: var(--c-gold);
        font-size: var(--fs-14);
        font-weight: 700;
        letter-spacing: 0.04em;
        text-align: right;
    }

    .review-btn {
        width: 50px;
        height: 50px;
        border: 1px solid var(--c-panel-border);
        border-radius: 50%;
        background: var(--c-panel-bg);
        color: var(--c-gold-bright);
        font-size: 1.4rem;
        line-height: 1;
        box-shadow: 0 12px 25px var(--c-shadow-md);
        cursor: pointer;
        transition: 250ms ease;
        transition-property: transform, background-color, color, box-shadow;

        &:hover,
        &:focus-visible {
            transform: translateY(-2px);
            background-color: var(--c-gold-bright);
            color: var(--c-space-deep);
            box-shadow: 0 16px 30px var(--c-shadow-md);
        }

        &:disabled {
            opacity: 0.45;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        &.prev {
            grid-area: prev;

            @media (width < calc(700 / 16 * 1rem)) {
                justify-self: end;
            }
        }

        &.next {
            grid-area: next;

            @media (width < calc(700 / 16 * 1rem)) {
                justify-self: start;
            }
        }
    }

    .review-dots {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 22px;
    }

    .review-dot {
        width: 12px;
        height: 12px;
        border: none;
        border-radius: 999px;
        background: var(--c-gold-line);
        cursor: pointer;
        transition: 250ms ease;
        transition-property: width, background-color, transform;

        &:hover,
        &:focus-visible {
            transform: scale(1.1);
            background: var(--c-gold-line-strong);
        }

        &[aria-current='true'] {
            width: 34px;
            background: var(--c-gold);
        }
    }

    @keyframes reviews-fade {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .reviews-slider[data-initialized='true'] .reviews-item.active,
        .read-more,
        .review-btn,
        .review-dot {
            animation: none;
            transition: none;
        }
    }

    /* --- Strona wszystkich opinii (all-reviews.html) --- */

    .reviews-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        width: min(100% - 32px, calc(980 / 16 * 1rem));
        margin: 0 auto 48px;
    }

    .review-card {
        border-radius: 16px;
        padding: 24px;
        box-shadow: 0 20px 35px var(--c-shadow-md);
    }

    .reviews-external {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;

        a {
            color: var(--c-gold-bright);
            font-weight: 600;
            transition: color 250ms ease;

            &:hover {
                color: var(--c-space-text);
            }
        }
    }

    .reviews-external__links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        margin-bottom: 25px;
    }
}

/* =========================================================
   STRONA: partials/books/*.html – strony książek (ZRESETOWANA, ZBUNTOWANA)
   ========================================================= */
@layer page-book {
    /* =========================================================
       PODSTRONY KSIĄŻEK (partials/books/*.html) + js/book-page.js
       Jeden szablon dla wszystkich książek. Kolejność na stronie:
       hero zakupowe → haczyk → zakładki ze szczegółami → seria → CTA
       ========================================================= */

    html:has(> body.book-page) {
        scroll-padding-top: 70px;
        background-color: var(--c-space-bg);
    }

    body.book-page {
        --book-card: var(--c-surface);
        --book-card-2: var(--c-surface-2);
        --book-line: var(--c-gold-line);
        --book-muted: var(--c-text-muted);
        --book-radius: 12px;

        background:
            radial-gradient(ellipse at 20% 0%, var(--c-glow), transparent 45%),
            linear-gradient(180deg, var(--c-ink) 0, var(--c-space-bg) 100vh) no-repeat,
            var(--c-space-bg);
        color: var(--c-space-text);
    }

    .book {
        padding-block-end: 40px;
    }

    .book-eyebrow {
        margin: 0 0 10px;
        color: var(--c-gold);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    /* --- Okruszki --- */

    .book-breadcrumbs ol {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding-block: 8px 12px;
        color: var(--book-muted);
        font-size: 12px;

        li:not(:last-child)::after {
            content: "›";
            margin-inline-start: 6px;
            color: var(--c-gold);
        }

        a:hover,
        a:focus-visible {
            color: var(--c-gold-bright);
        }
    }

    /* --- Hero zakupowe --- */

    .book-hero__inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: clamp(18px, 4vw, 40px);
        border: 1px solid var(--book-line);
        border-radius: var(--book-radius);
        background:
            radial-gradient(ellipse at 85% 10%, var(--c-gold-wash), transparent 45%),
            var(--book-card);

        @media (width >= calc(800 / 16 * 1rem)) {
            grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
            align-items: center;
            gap: clamp(28px, 4vw, 56px);
        }
    }

    .book-hero__media {
        display: grid;
        gap: 14px;
        justify-items: center;
    }

    .book-hero__cover {
        /* Na telefonie mniejsza okładka – tytuł i cena mieszczą się bliżej góry */
        width: min(100%, 190px);
        margin: 0;

        @media (width >= calc(800 / 16 * 1rem)) {
            width: min(100%, 360px);
        }

        figcaption {
            min-height: 1.5em;
            margin-block-start: 12px;
            color: var(--c-gold-bright);
            font-size: var(--fs-14);
            text-align: center;
        }
    }

    .book-zoom {
        display: block;
        width: 100%;
        padding: 0;
        border: 0;
        background: none;
        cursor: zoom-in;

        &:focus-visible {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: 4px;
        }
    }

    .book-hero__main {
        width: 100%;
        aspect-ratio: 3 / 4;
        object-fit: contain;
        filter:
            drop-shadow(0 18px 30px var(--c-shadow-lg))
            drop-shadow(0 0 18px var(--c-gold-line));
    }

    .book-thumbs {
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .book-thumbs__item {
        width: 46px;

        @media (width >= calc(800 / 16 * 1rem)) {
            width: 58px;
        }

        padding: 0;
        overflow: hidden;
        border: 1px solid var(--book-line);
        border-radius: 6px;
        background: var(--book-card-2);
        cursor: pointer;
        opacity: 0.7;
        transition: opacity 180ms ease, border-color 180ms ease;

        img {
            width: 100%;
            aspect-ratio: 3 / 4;
            object-fit: cover;
        }

        &:hover,
        &[aria-pressed="true"] {
            border-color: var(--c-gold-bright);
            opacity: 1;
        }

        &:focus-visible {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: 2px;
        }
    }

    .book-hero__summary {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;

        @media (width >= calc(800 / 16 * 1rem)) {
            align-items: flex-start;
            text-align: left;

            p,
            h1 {
                text-align: left;
            }
        }

        h1 {
            margin-block: 4px 10px;
            font-size: clamp(2rem, 5vw, 3rem);
            font-weight: 800;
            letter-spacing: 0.04em;
        }
    }

    .book-hero__series {
        margin: 0 0 6px;
        color: var(--c-gold);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .book-hero__author {
        margin: 0;
        font-size: var(--fs-14);
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .book-rating {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-block-end: 12px;
        font-size: var(--fs-14);

        &[hidden] {
            display: none;
        }

        &:hover .book-rating__value,
        &:focus-visible .book-rating__value {
            text-decoration: underline;
        }
    }

    .book-rating__stars {
        color: var(--c-gold-bright);
        letter-spacing: 0.1em;
    }

    .book-rating__value {
        color: var(--book-muted);
    }

    .book-hero__tagline {
        margin: 0 0 6px;
        font-size: var(--fs-16);
        font-style: italic;
    }

    .book-hero__genres {
        margin: 0;
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    /* Wybór wydania */

    .book-formats {
        width: 100%;
        margin: 22px 0 0;
        padding: 18px 0 0;
        border: 0;
        border-top: 1px solid var(--book-line);

        legend {
            margin-block-end: 12px;
            padding: 0;
            font-size: var(--fs-14);
            font-weight: 600;
        }
    }

    .book-formats__options {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .book-format {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 14px 6px 12px;
        border: 1px solid var(--book-line);
        border-radius: 8px;
        background: var(--book-card-2);
        text-align: center;
        cursor: pointer;
        transition: border-color 180ms ease, background-color 180ms ease;

        input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        &:hover {
            border-color: var(--c-gold-line-strong);
        }

        &:has(input:checked) {
            border-color: var(--c-gold-bright);
            background: var(--c-gold-tint);
            box-shadow: inset 0 0 0 1px var(--c-gold-bright);
        }

        &:has(input:focus-visible) {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: 2px;
        }
    }

    .book-format__name {
        font-size: var(--fs-14);
        font-weight: 700;
    }

    .book-format__price {
        font-size: var(--fs-16);
        font-weight: 800;
        white-space: nowrap;
    }

    .book-format__note {
        color: var(--book-muted);
        font-size: 11px;
    }

    .book-format__badge {
        position: absolute;
        top: -9px;
        left: 50%;
        transform: translateX(-50%);
        padding: 1px 8px;
        border-radius: 999px;
        background: var(--c-gold-bright);
        color: var(--c-space-deep);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.04em;
        white-space: nowrap;
        text-transform: uppercase;
    }

    .book-variants {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px 14px;
        width: 100%;
        margin-block-start: 12px;
        font-size: var(--fs-14);

        &[hidden] {
            display: none;
        }

        @media (width >= calc(800 / 16 * 1rem)) {
            justify-content: flex-start;
        }
    }

    .book-variants__options {
        display: flex;
        gap: 8px;

        label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 12px;
            border: 1px solid var(--book-line);
            border-radius: 999px;
            cursor: pointer;

            &:has(input:checked) {
                border-color: var(--c-gold-bright);
                color: var(--c-gold-bright);
            }
        }

        input {
            accent-color: var(--c-gold-bright);
        }
    }

    .book-hero__offer {
        margin: 16px 0 0;
        color: var(--book-muted);
        font-size: var(--fs-14);
        line-height: 1.5;

        strong {
            color: var(--c-gold-bright);
        }
    }

    .book-hero__actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        width: 100%;
        margin-block-start: 18px;
    }

    .book-buy {
        width: 100%;
        padding: 14px 20px;
        border-radius: 6px;
        color: var(--c-text);
        font-family: inherit;
        font-size: var(--fs-16);
        cursor: pointer;

        &:hover,
        &:focus-visible {
            border-radius: 6px;
            background: var(--c-buy-btn-hover);
            color: var(--c-text);
        }
    }

    .book-sample {
        display: block;
        padding: 12px 20px;
        border: 1px solid var(--c-gold-line-strong);
        border-radius: 6px;
        color: var(--c-gold-bright);
        font-size: var(--fs-14);
        font-weight: 700;
        letter-spacing: 0.05em;
        text-align: center;
        text-transform: uppercase;
        transition: background-color 180ms ease;

        &:hover,
        &:focus-visible {
            background: var(--c-gold-tint);
        }
    }

    .book-trust {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 16px;
        margin-block-start: 16px;
        color: var(--book-muted);
        font-size: 12px;

        @media (width >= calc(800 / 16 * 1rem)) {
            justify-content: flex-start;
        }

        li::before {
            content: "✓";
            margin-inline-end: 6px;
            color: var(--c-gold-bright);
        }
    }

    /* --- Zakładki ze szczegółami --- */

    .book-details {
        /* wysokość paska zakładek – treść nie chowa się pod nim */
        scroll-margin-top: 52px;
    }

    /* top + bottom: pasek widać na dole ekranu od razu po wejściu,
       dojeżdża na swoje miejsce i przykleja się u góry (rodzicem jest <main>) */
    .book-tabs {
        position: sticky;
        top: 0;
        bottom: 0;
        z-index: 5;
        margin-block-start: clamp(28px, 5vw, 48px);
        border-block: 1px solid var(--book-line);
        background: color-mix(in srgb, var(--c-ink) 96%, transparent);
        backdrop-filter: blur(10px);

        &.is-peeking {
            border-top-color: var(--c-gold-line-strong);
            box-shadow: 0 -12px 30px var(--c-shadow-lg);
        }

        /* Delikatna strzałka: "pod spodem jest więcej" */
        &.is-peeking::before {
            content: "";
            position: absolute;
            top: -7px;
            left: 50%;
            width: 12px;
            height: 12px;
            border-top: 1px solid var(--c-gold-line-strong);
            border-left: 1px solid var(--c-gold-line-strong);
            background: var(--c-ink);
            transform: translateX(-50%) rotate(225deg);
            animation: book-tabs-hint 2.4s ease-in-out infinite;
        }
    }

    .book-tabs__list {
        display: flex;
        gap: clamp(18px, 4vw, 44px);
        justify-content: flex-start;
        padding-inline: 16px;
        overflow-x: auto;
        scrollbar-width: none;

        &::-webkit-scrollbar {
            display: none;
        }

        @media (width >= calc(800 / 16 * 1rem)) {
            justify-content: center;
        }
    }

    @keyframes book-tabs-hint {
        0%, 100% { translate: 0 0; }
        50% { translate: 0 3px; }
    }

    .book-tabs__tab {
        flex-shrink: 0;
        padding-block: 15px 13px;
        border-bottom: 2px solid transparent;
        color: var(--book-muted);
        font-size: var(--fs-14);
        font-weight: 600;
        white-space: nowrap;
        transition: color 180ms ease, border-color 180ms ease;

        &:hover,
        &[aria-selected="true"] {
            border-bottom-color: var(--c-gold-bright);
            color: var(--c-gold-bright);
        }

        &:focus-visible {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: -2px;
        }
    }

    .book-panels {
        padding-block: clamp(32px, 6vw, 56px);
    }

    .book-panel {
        width: min(100%, calc(820 / 16 * 1rem));
        margin-inline: auto;

        /* Bez JS wszystkie panele są widoczne jeden pod drugim */
        & + & {
            margin-block-start: 56px;
        }

        .is-tabbed & + & {
            margin-block-start: 0;
        }

        p,
        h3 {
            text-align: left;
        }

        h3 {
            margin-block: 28px 12px;
            font-size: var(--fs-16);
            font-weight: 700;
        }

        a:not(.button) {
            color: var(--c-gold-bright);
            text-decoration: underline;
            text-underline-offset: 3px;
        }
    }

    .book-panel__title {
        margin-block-end: 24px;
        font-size: var(--fs-24);
    }

    .book-panel__note {
        margin-block-start: 24px;
        color: var(--book-muted);
        font-size: var(--fs-14);
        line-height: 1.6;
    }

    /* Opis */

    .book-story p {
        margin: 0 0 18px;
        color: var(--c-text-soft);
        line-height: 1.8;
    }

    .book-story__highlight {
        margin: 28px 0;
        padding: 18px 22px;
        border-left: 2px solid var(--c-gold);
        background: var(--c-gold-tint-soft);
        font-size: var(--fs-16);
        font-weight: 600;
        line-height: 1.6;
    }

    .book-tropes {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;

        li {
            padding: 7px 14px;
            border: 1px solid var(--book-line);
            border-radius: 999px;
            color: var(--c-gold-bright);
            font-size: var(--fs-14);
        }
    }

    /* Wydanie i dodatki */

    .book-extras {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        margin-block-end: 28px;

        @media (width >= calc(650 / 16 * 1rem)) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        li {
            display: grid;
            gap: 4px;
            padding: 14px 16px;
            border: 1px solid var(--book-line);
            border-radius: 8px;
            background: var(--book-card);
        }

        strong {
            color: var(--c-gold-bright);
        }

        span {
            color: var(--book-muted);
            font-size: var(--fs-14);
        }
    }

    /* flex zamiast grida: niepełny ostatni rząd (np. 3 grafiki postaci) jest wyśrodkowany */
    .book-gallery {
        --cols: 2;
        --gap: 14px;
        --col: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--gap);

        @media (width >= calc(800 / 16 * 1rem)) {
            --cols: 4;
        }
    }

    .book-gallery__item {
        flex: 0 0 var(--col);
        overflow: hidden;
        padding: 0;
        border: 1px solid var(--book-line);
        border-radius: 8px;
        background: var(--book-card);
        color: inherit;
        font: inherit;
        cursor: zoom-in;

        img {
            width: 100%;
            aspect-ratio: 4 / 5;
            object-fit: cover;
            transition: transform 400ms ease;
        }

        span {
            display: block;
            padding: 10px;
            font-size: 12px;
        }

        &:hover img {
            transform: scale(1.04);
        }

        &:focus-visible {
            outline: 2px solid var(--c-gold-bright);
            outline-offset: 2px;
        }
    }

    .book-gallery__item--wide {
        flex-basis: calc(var(--col) * 2 + var(--gap));

        img {
            aspect-ratio: 1400 / 380;
            object-fit: contain;
            background: var(--c-ink);
        }
    }

    /* Formaty i dostawa */

    .book-compare-wrap {
        overflow-x: auto;
    }

    .book-compare,
    .book-specs {
        width: 100%;
        border-collapse: collapse;
        font-size: var(--fs-14);

        th,
        td {
            padding: 12px 10px;
            border-bottom: 1px solid var(--book-line);
        }
    }

    .book-compare {
        min-width: 420px;

        thead th {
            color: var(--c-gold-bright);
        }

        tbody th {
            font-weight: 400;
            text-align: left;
        }

        td {
            font-weight: 700;
            text-align: center;
        }
    }

    .book-delivery {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        margin-block-start: 28px;

        @media (width >= calc(650 / 16 * 1rem)) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        > div {
            padding: 18px 20px;
            border: 1px solid var(--book-line);
            border-radius: 8px;
            background: var(--book-card);
        }

        h3 {
            margin-block-start: 0;
        }

        li {
            padding-block: 4px;
            color: var(--book-muted);
            font-size: var(--fs-14);

            &::before {
                content: "•";
                margin-inline-end: 8px;
                color: var(--c-gold);
            }
        }
    }

    /* Informacje szczegółowe */

    .book-specs {
        th {
            width: 42%;
            color: var(--c-gold);
            font-weight: 600;
            text-align: left;
            vertical-align: top;
        }
    }

    /* Opinie */

    .book-reviews__summary {
        margin-block-end: 20px;
        color: var(--book-muted);

        &[hidden] {
            display: none;
        }
    }

    .book-reviews {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;

        @media (width >= calc(650 / 16 * 1rem)) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    .book-review {
        margin: 0;
        padding: 20px 22px;
        border: 1px solid var(--book-line);
        border-radius: 8px;
        background: var(--book-card);

        blockquote {
            margin: 10px 0 12px;
            font-style: italic;
            line-height: 1.6;
        }

        figcaption {
            color: var(--c-gold-bright);
            font-size: var(--fs-14);
        }
    }

    .book-review__stars {
        margin: 0;
        color: var(--c-gold-bright);
        letter-spacing: 0.1em;
    }

    .book-reviews__links {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 16px 24px;
        margin-block-start: 24px;

        .button {
            border-radius: 6px;
        }
    }

    /* --- Seria --- */

    .book-series {
        padding-block: clamp(40px, 7vw, 64px);
        justify-items: center;
        border-top: 1px solid var(--book-line);
    }

    .book-series__list {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        width: min(100%, calc(720 / 16 * 1rem));
        margin-block-start: 24px;

        @media (width >= calc(650 / 16 * 1rem)) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    .book-series__item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 14px;
        border: 1px solid var(--book-line);
        border-radius: 8px;
        background: var(--book-card);
        transition: border-color 180ms ease;

        img,
        .book-series__placeholder {
            flex-shrink: 0;
            width: 64px;
            aspect-ratio: 363 / 531;
            border-radius: 4px;
        }

        p {
            margin: 0;
            text-align: left;
        }

        &:is(a):hover,
        &:is(a):focus-visible {
            border-color: var(--c-gold-bright);
        }
    }

    .book-series__item--current {
        border-color: var(--c-gold-line-strong);
    }

    .book-series__placeholder {
        display: grid;
        place-items: center;
        border: 1px solid var(--book-line);
        background:
            linear-gradient(color-mix(in srgb, var(--c-ink) 30%, transparent), color-mix(in srgb, var(--c-ink) 70%, transparent)),
            url("./img/bg-hero-mobile.webp") center / cover no-repeat;
    }

    .book-series__volume {
        color: var(--c-gold);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .book-series__name {
        font-weight: 800;
        letter-spacing: 0.04em;
    }

    .book-series__status {
        color: var(--book-muted);
        font-size: 12px;
    }

    /* --- Końcowe CTA --- */

    .book-final {
        justify-items: center;
        padding: clamp(36px, 6vw, 56px) clamp(18px, 4vw, 40px);
        border: 1px solid var(--book-line);
        border-radius: var(--book-radius);
        background:
            url("./img/zawijas-1.webp") right -30px center / auto 130% no-repeat,
            radial-gradient(ellipse at 50% 0%, var(--c-gold-wash), transparent 60%),
            var(--book-card);
        text-align: center;

        h2 {
            margin-block-end: 10px;
        }

        > p {
            max-width: 52ch;
            margin: 0 auto 22px;
            color: var(--book-muted);
        }

        .book-buy,
        .book-sample {
            width: min(100%, 420px);
        }

        .book-sample {
            margin-block-start: 12px;
        }
    }

    /* --- Mobilny pasek zakupu --- */

    .book-buybar {
        position: fixed;
        inset: auto 0 0;
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--book-line);
        background: color-mix(in srgb, var(--c-ink) 97%, transparent);
        backdrop-filter: blur(10px);
        transform: translateY(110%);
        transition: transform 250ms ease;

        &.is-visible {
            transform: translateY(0);
        }

        &[hidden] {
            display: none;
        }

        @media (width >= calc(800 / 16 * 1rem)) {
            display: none;
        }

        .book-buy {
            width: auto;
            padding: 10px 18px;
            font-size: var(--fs-14);
        }
    }

    .book-buybar__info {
        display: grid;
        font-weight: 800;
        line-height: 1.3;
    }

    .book-buybar__title {
        color: var(--c-gold-bright);
        font-size: 12px;
        letter-spacing: 0.08em;
    }

    /* Pływające przyciski nie mogą zasłaniać paska zakupu */
    body.book-page:is(:has(.book-buybar.is-visible), .book-tabs-peeking) :is(#scroll-to-top, #cookie-icon) {
        bottom: 84px;
    }

    /* --- Powiększenie zdjęć --- */

    .book-lightbox {
        max-width: min(92vw, 900px);
        max-height: 92vh;
        padding: 0;
        border: 0;
        background: transparent;
        overflow: visible;

        &::backdrop {
            background: var(--c-scrim-strong);
        }

        img {
            max-width: 100%;
            max-height: 88vh;
            margin: auto;
            border-radius: 8px;
        }
    }

    .book-lightbox__close {
        position: absolute;
        top: -44px;
        right: 0;
        border: 0;
        background: none;
        color: var(--c-text);
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
    }

    /* --- Zapowiedź (książka przed premierą) --- */

    .book-hero__placeholder {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 18px;
        width: min(100%, 300px);
        aspect-ratio: 363 / 531;
        margin-inline: auto;
        border: 1px solid var(--c-text-muted);
        border-radius: 9px;
        background:
            linear-gradient(color-mix(in srgb, var(--c-ink) 30%, transparent), color-mix(in srgb, var(--c-ink) 70%, transparent)),
            url("./img/bg-hero-mobile.webp") center / cover no-repeat;
        box-shadow: 0 18px 30px var(--c-shadow-lg);

        @media (width >= calc(800 / 16 * 1rem)) {
            width: min(100%, 340px);
        }
    }

    .book-hero__placeholder-series {
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 800;
        letter-spacing: 0.14em;
    }

    .book-hero__placeholder-title {
        /* na wąskiej okładce (telefon) 24px wychodziło poza ramkę */
        font-size: clamp(18px, 5.5vw, var(--fs-24));
        font-weight: 800;
        letter-spacing: 0.06em;
    }

    .book-hero__placeholder-status {
        color: var(--book-muted);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .book-status {
        display: inline-block;
        margin: 0 0 14px;
        padding: 6px 14px;
        border: 1px solid var(--c-gold-line-strong);
        border-radius: 999px;
        color: var(--c-gold-bright);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .book-progress {
        display: grid;
        gap: 0;
        counter-reset: book-step;

        li {
            position: relative;
            display: grid;
            gap: 2px;
            padding: 0 0 22px 36px;
            counter-increment: book-step;

            &::before {
                content: counter(book-step);
                position: absolute;
                top: 0;
                left: 0;
                display: grid;
                place-items: center;
                width: 24px;
                height: 24px;
                border: 1px solid var(--book-line);
                border-radius: 50%;
                color: var(--book-muted);
                font-size: 12px;
                font-weight: 700;
            }

            &:not(:last-child)::after {
                content: "";
                position: absolute;
                top: 26px;
                bottom: 2px;
                left: 11.5px;
                width: 1px;
                background: var(--book-line);
            }

            span {
                color: var(--book-muted);
                font-size: var(--fs-14);
            }
        }

        .is-done::before {
            content: "✓";
            border-color: var(--c-gold);
            background: var(--c-gold);
            color: var(--c-space-deep);
        }

        .is-current::before {
            border-color: var(--c-gold-bright);
            color: var(--c-gold-bright);
            box-shadow: 0 0 0 4px var(--c-gold-tint);
        }

        .is-current strong {
            color: var(--c-gold-bright);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .book-tabs.is-peeking::before {
            animation: none;
        }

        .book-buybar,
        .book-format,
        .book-gallery__item img {
            transition: none;
        }
    }
}

/* =========================================================
   STRONA: partials/politics.html, partials/regulations.html
   ========================================================= */
@layer page-legal {
    .page-legal {
        * {
            text-align: left;
        }

        h1,
        .legal-meta {
            text-align: center;
            margin-block: 20px;
        }

        section {
            margin-block: 25px;

            h2 {
                font-size: var(--fs-20);
                margin-bottom: 20px;
            }

            p {
                font-size: var(--fs-16);
                line-height: 1.3;

                &:not(:last-child) {
                    padding-bottom: 10px;
                }
            }

            ul {
                list-style: disc;
                padding-left: 15px;

                li {
                    padding-bottom: 10px;
                }
            }
        }
    }
}

/* =========================================================
   STRONA: thankyou.html (baza wspólna z payment-status.html)
   ========================================================= */
@layer page-thankyou {
    .thankyou-container {
        min-height: calc(100vh - 6rem);
        padding: 6rem 1.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.2rem;
        text-align: center;
        color: var(--c-space-text);
        background:
            radial-gradient(ellipse at 50% 0%, var(--c-gold-wash), transparent 45%),
            var(--c-panel-bg);
        border: 1px solid var(--c-panel-border);
        border-radius: 20px;
        box-shadow: 0 12px 34px var(--c-shadow-md);
        margin: 3rem auto;
        max-width: 900px;

        @media (width <= calc(700 / 16 * 1rem)) {
            margin: 1.2rem;
            padding: 2rem 1rem;
            border-radius: 14px;
        }

        h1 {
            margin: 0;
            font-size: clamp(1.8rem, 4vw, 2.6rem);
            font-weight: 800;
            color: var(--c-space-text);
            text-shadow: 2px 2px 10px var(--c-shadow-sm);
        }

        p {
            max-width: 42ch;
            margin: 0 auto;
            line-height: 1.45;
            color: var(--c-space-text);

            a {
                color: var(--c-gold-bright);
            }
        }

        .button {
            @media (width <= calc(700 / 16 * 1rem)) {
                width: 100%;
                max-width: 260px;
            }

            &:hover,
            &:focus-visible {
                transform: translateY(-2px);
                box-shadow: 0 10px 20px var(--c-shadow-md);
                filter: brightness(1.05);
            }
        }
    }

    .actions {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 1rem;

        @media (width <= calc(700 / 16 * 1rem)) {
            gap: 0.7rem;
        }
    }

    .small {
        font-size: var(--fs-14);
        color: var(--c-text);
        margin-top: 0.8rem;
        line-height: 1.4;

        a {
            color: var(--c-text);
            text-decoration: underline;
            font-weight: 600;

            &:hover {
                color: var(--c-gold-bright);
            }
        }
    }
}

/* =========================================================
   STRONA: payment-status.html – tu trafiają style TYLKO dla tej strony (na razie korzysta z bazy .thankyou-container)
   ========================================================= */
@layer page-payment-status {
    /* Na razie brak stylów tylko dla tej strony – patrz .thankyou-container w warstwie page-thankyou. */
}

/* =========================================================
   STRONY Z LINKAMI: wspólne elementy klamich_SM_linki.html i klamich_recenzje.html
   ========================================================= */
@layer page-links {
    .share-wrap {
        padding: 22px 26px 30px;

        button {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            gap: 10px;
            padding: 15px;
            border: none;
            border-radius: 3px;
            background: var(--c-buy-btn-bg);
            color: var(--c-text);
            font-family: 'JetBrains Mono', monospace;
            letter-spacing: 0.03em;
            cursor: pointer;
            transition: background 0.15s ease;

            svg {
                width: 15px;
                height: 15px;
            }
        }

        span {
            font-size: var(--fs-14);
            font-weight: 800;
            color: var(--c-text);
            text-align: center;
        }
    }
}

/* =========================================================
   STRONA: klamich_SM_linki.html – linki do social mediów
   ========================================================= */
@layer page-links-social {
    body.socialmedia-layout {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 32px 18px;

        &::before {
            content: none;
        }
    }

    .socialmedia-layout {
        .card {
            width: 100%;
            max-width: 420px;
            overflow: hidden;
            background: var(--c-section-bg);
            border-radius: 4px;
            box-shadow: 0 30px 60px var(--c-shadow-md);
        }

        .header-sm {
            width: 100%;
            background: var(--c-banner-bg);
            border-bottom: 1px solid var(--c-bg);
        }

        .header-image {
            width: 100%;
            aspect-ratio: 3 / 2;
            position: relative;
            overflow: hidden;
            background-image: url('/img/bg-linki.webp');
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
        }

        .links {
            padding: 6px 0;
        }

        .link-row {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 18px 26px;
            border-bottom: 1px solid var(--c-bg);
            color: var(--social-ink);
            transition: background 0.15s ease;

            &:hover {
                background: var(--c-bg);
            }
        }

        .icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 42px;
            padding: 8px;
            border-radius: 50%;

            &.tiktok { background: var(--brand-black); }
            &.instagram { background: radial-gradient(circle at 30% 110%, var(--brand-ig-yellow) 0%, var(--brand-ig-yellow) 5%, var(--brand-ig-orange) 45%, var(--brand-ig-pink) 60%, var(--brand-ig-blue) 90%); }
            &.facebook { background: var(--brand-facebook); }
            &.website { background: var(--social-violet); }
        }

        .text .name {
            display: block;
            margin-bottom: 2px;
            font-size: 16px;
            font-weight: 500;
        }

        .text .sub {
            display: block;
            color: var(--c-banner-bg);
            font-size: 11.5px;
            font-weight: 600;
        }

        .share-btn.copied {
            background: var(--c-banner-bg);
        }
    }
}

/* =========================================================
   STRONA: klamich_recenzje.html – linki „zostaw opinię"
   ========================================================= */
@layer page-links-reviews {
    body.reviews-layout {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 32px 18px;

        &::before {
            content: none;
        }
    }

    .reviews-card {
        width: 100%;
        max-width: 420px;
        overflow: hidden;
        background: var(--c-section-bg);
        border-radius: 4px;
        box-shadow: 0 30px 60px var(--c-shadow-md);
    }

    .reviews-header {
        width: 100%;
        background: var(--c-banner-bg);
        border-bottom: 1px solid var(--c-bg);

        .header-image {
            width: 100%;
            aspect-ratio: 3 / 2;
            position: relative;
            overflow: hidden;
            background-image: url('/img/bg-recenzje.webp');
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
        }
    }

    .reviews-links {
        padding: 6px 0;
    }

    .reviews-link {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 18px 26px;
        border-bottom: 1px solid var(--c-bg);
        color: var(--social-ink);
        transition: background 0.15s ease;

        &:hover {
            background: var(--c-bg);
        }

        .text .name {
            display: block;
            margin-bottom: 2px;
            font-size: 16px;
            font-weight: 500;
        }

        .text .sub {
            display: block;
            color: var(--c-banner-bg);
            font-size: 11.5px;
            font-weight: 600;
        }
    }

    .reviews-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 8px;
        border-radius: 50%;

        svg {
            width: 100%;
            height: 100%;
        }

        &.lubimyczytac { background: var(--brand-lubimyczytac); }
        &.nakanapie { background: var(--brand-nakanapie); }
        &.granice { background: var(--brand-granice); }
        &.legimi { background: var(--brand-legimi); }
        &.empik { background: var(--brand-black); }
    }

    .reviews-layout .share-btn {
        &.copied {
            background: var(--c-banner-bg);
        }
    }
}

/* =========================================================
   PANELE ADMINA: admin-stats.php, generate-link.php, send-ebook-mail.php, formularz logowania (includes/admin-auth.php)
   ========================================================= */
@layer page-admin {
    body.admin-layout {
        background: var(--c-paper);
        color: var(--c-section-text);

        &::before {
            content: none;
        }

        /* Neutralizacja globalnej typografii (:where = zerowa specyficzność) */
        :where(h1, h2) {
            font-weight: bold;
            letter-spacing: normal;
            line-height: normal;
            text-align: left;
        }

        :where(h1) {
            margin-block: 0.67em;
            font-size: 2em;
        }

        :where(h2) {
            margin-block: 0.83em;
            font-size: 1.5em;
        }

        :where(p) {
            text-align: left;
        }

        /* Globalny reset linków usuwa podkreślenie – w panelu zostawiamy je widoczne */
        a {
            color: var(--c-buy-btn-bg);
            text-decoration: underline;
        }
    }

    /* --- generate-link.php, send-ebook-mail.php i komunikaty skryptów --- */

    body.admin-generator {
        max-width: 700px;
        margin: 40px;
        font-family: Arial, sans-serif;

        :is(input, select, button) {
            width: 100%;
            margin: 8px 0;
            padding: 10px;
        }

        .inline input {
            width: auto;
        }
    }

    /* --- formularz logowania (includes/admin-auth.php) --- */

    body.admin-login {
        box-sizing: content-box; /* jak w oryginale: 360px treści + 16px marginesu po bokach */
        max-width: 360px;
        margin: 80px auto;
        padding: 0 16px;
        font-family: Arial, sans-serif;

        :is(input, button) {
            width: 100%;
            margin: 8px 0;
            padding: 10px;
            box-sizing: border-box;
        }
    }

    /* Większa specyficzność: w admin-stats działa reset `body.admin-stats * { margin: 0 }` */
    body.admin-layout .admin-logout {
        margin-top: 30px;
    }

    .admin-link {
        font-size: 15px;
        word-break: break-all;
    }

    .admin-status--success {
        color: var(--c-success);
    }

    .admin-status--error {
        color: var(--c-danger);
    }

    /* --- admin-stats.php --- */

    body.admin-stats {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 20px;
        font-family: 'Open Sans', Arial, sans-serif;
        background: linear-gradient(135deg, var(--c-space-deep) 0%, var(--c-space-light) 100%);

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .container {
            background: var(--c-paper);
            border-radius: 10px;
            box-shadow: 0 10px 40px var(--c-shadow-md);
            padding: 40px;
            max-width: 600px;
            width: 100%;
        }

        h1 {
            color: var(--c-paper-text);
            margin-bottom: 30px;
            text-align: center;
            font-size: 28px;
        }

        .stats-grid {
            display: grid;
            gap: 20px;
        }

        .stat-card {
            background: var(--c-section-bg);
            padding: 20px;
            border-radius: 8px;
            border-left: 4px solid var(--c-buy-btn-bg);
        }

        .stat-label {
            color: var(--c-paper-muted);
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 8px;
        }

        .stat-value {
            color: var(--c-buy-btn-bg);
            font-size: 42px;
            font-weight: 700;
        }

        .info-box {
            background: color-mix(in srgb, var(--c-gold) 12%, var(--c-paper));
            border: 1px solid color-mix(in srgb, var(--c-gold) 35%, var(--c-paper));
            padding: 15px;
            border-radius: 6px;
            margin-top: 20px;
            font-size: 13px;
            color: var(--c-paper-text);
            line-height: 1.6;

            strong {
                color: var(--c-paper-text);
            }
        }

        .button-group {
            display: flex;
            gap: 10px;
            margin-top: 30px;
        }

        button {
            flex: 1;
            padding: 12px 20px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-refresh {
            background: var(--c-buy-btn-bg);
            color: var(--c-paper);

            &:hover {
                background: var(--c-buy-btn-hover);
                transform: translateY(-2px);
                box-shadow: 0 5px 15px color-mix(in srgb, var(--c-buy-btn-bg) 40%, transparent);
            }
        }

        .btn-reset {
            background: var(--c-danger);
            color: var(--c-paper);

            &:hover {
                background: color-mix(in srgb, var(--c-danger) 85%, var(--c-ink));
                transform: translateY(-2px);
                box-shadow: 0 5px 15px color-mix(in srgb, var(--c-danger) 40%, transparent);
            }

            &:disabled {
                opacity: 0.6;
                cursor: not-allowed;
                transform: none;
            }
        }

        .success-message {
            background: var(--c-success-bg);
            color: var(--c-success);
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 20px;
            display: none;

            &.show {
                display: block;
            }
        }
    }
}

/* =========================================================
   ANIMACJE (klasy .reveal / .stagger / .tilt nadaje js/motion.js)
   ========================================================= */
@layer motion {
    :root {
        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    }

    @media (prefers-reduced-motion: no-preference) {
        html {
            scroll-behavior: smooth;
        }
    }

    /* --- Wjazd sekcji przy przewijaniu (raz, nie przy każdym przewinięciu) --- */

    /* Chowanie bez przejścia, odsłanianie z przejściem */
    .reveal:not(.is-visible) {
        opacity: 0;
        translate: 0 32px;

        .stagger > * {
            opacity: 0;
            translate: 0 16px;
        }
    }

    .reveal.is-visible {
        transition:
            opacity 900ms var(--ease-out),
            translate 900ms var(--ease-out);

        .stagger > * {
            transition:
                opacity 700ms var(--ease-out),
                translate 700ms var(--ease-out);
            transition-delay: calc(var(--i, 0) * 70ms + 120ms);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .reveal:not(.is-visible),
        .reveal:not(.is-visible) .stagger > * {
            translate: none;
        }

        .reveal.is-visible,
        .reveal.is-visible .stagger > * {
            transition-duration: 300ms;
            transition-delay: 0ms;
        }
    }

    @media print {
        .reveal,
        .reveal .stagger > * {
            opacity: 1 !important;
            translate: none !important;
        }
    }

    /* --- Okładka w hero unosi się jak w nieważkości --- */

    /* tylko od tabletu w górę – na telefonie było za mocne */
    @media (prefers-reduced-motion: no-preference) and (width >= calc(700 / 16 * 1rem)) {
        .hero-img {
            animation: cover-float 7s ease-in-out infinite;
        }
    }

    @keyframes cover-float {
        0%, 100% { transform: translateY(0); }
        50%      { transform: translateY(-10px); }
    }

    /* --- Okładki pochylają się za kursorem (tylko mysz, bez reduced motion) --- */

    .tilt {
        transition: transform 500ms var(--ease-out);
        will-change: transform;
    }

    /* --- Przyciski: wciśnięcie --- */

    .button {
        transition:
            color 250ms ease,
            border-radius 250ms ease,
            box-shadow 250ms ease,
            scale 160ms var(--ease-out);

        &:active:not(:disabled) {
            scale: 0.97;
        }
    }

    /* --- Karty: delikatne uniesienie pod kursorem --- */

    @media (hover: hover) and (pointer: fine) {
        .product,
        .news-card {
            transition:
                translate 300ms var(--ease-out),
                box-shadow 300ms ease,
                border-color 300ms ease;

            &:hover {
                translate: 0 -5px;
                border-color: var(--c-gold-line-strong);
                box-shadow: 0 18px 40px var(--c-shadow-md);
            }
        }
    }

    /* --- Pasek postępu czytania na wpisach bloga --- */

    @supports (animation-timeline: scroll()) {
        body:has(.news__article-content)::after {
            content: "";
            position: fixed;
            inset: 0 0 auto;
            z-index: 1500;
            height: 2px;
            background: linear-gradient(90deg, var(--c-gold-metal), var(--c-gold-bright));
            box-shadow: 0 0 8px var(--c-gold-glow);
            transform-origin: 0 50%;
            pointer-events: none;
            animation: read-progress linear both;
            animation-timeline: scroll(root);
        }
    }

    @keyframes read-progress {
        from { scale: 0 1; }
        to   { scale: 1 1; }
    }
}

/* =========================================================
   NARZĘDZIA
   ========================================================= */
@layer utilities {
    .visually-hidden {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .hidden {
        display: none !important;
    }

    .include-error {
        color: var(--c-danger);
        text-align: center;
    }
}
