@layer fonts {
    /* open-sans-regular - latin_latin-ext */
    @font-face {
        font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 400;
        src: url('./fonts/open-sans-v44-latin_latin-ext-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
    }
    /* open-sans-600 - latin_latin-ext */
    @font-face {
        font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 600;
        src: url('./fonts/open-sans-v44-latin_latin-ext-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
    }
    /* open-sans-700 - latin_latin-ext */
    @font-face {
        font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 700;
        src: url('./fonts/open-sans-v44-latin_latin-ext-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
    }
    /* open-sans-800 - latin_latin-ext */
    @font-face {
        font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
        font-family: 'Open Sans';
        font-style: normal;
        font-weight: 800;
        src: url('./fonts/open-sans-v44-latin_latin-ext-800.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
    }
}

@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);
        --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);
            --font-size-h2: var(--fs-24);
            --font-size-h3: var(--fs-20);
        }

        @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;
    }

    p {
        font-size: var(--font-size-p);
        font-weight: 500;
        letter-spacing: 0.01em;
        line-height: 1.3;
        padding: 0;
        margin: 0;
    }
}

@layer colors {
    :root {
    --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-buy-btn-bg: hsl(21, 28%, 34%);
    --c-section-bg: hsl(0, 0%, 97%);
    --c-section-text: #1d1c1c;
    }
}

@layer decoration {
    .img-shadow {
        box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -webkit-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -moz-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
    }
}

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

    body {
        margin: 0;
        font-family: var(--ff-open);
        background: var(--c-bg);
        color: var(--c-text);
    }

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

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

    a:visited,
    a:active {
        color: inherit;
    }

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

@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;
        }
    }
}

@layer banner {
    .banner {
        background-color: var(--c-banner-bg);

        p {
            font-size: 15px;
            font-weight: 600;
            letter-spacing: 0.02em;
            padding-block: 10px;
            text-transform: uppercase;
        }
    }
}

@layer button {
    .button {
        font-weight: 700;
        text-transform: uppercase;
        background: var(--c-buy-btn-bg);
        border: none;
        letter-spacing: 0.05em;
        width: fit-content;
        padding: 10px 20px;
        transition: 250ms ease-in-out;
        transition-property: color, border-radius;
        
        &:hover {
            color: var(--c-section-text);
            border-radius: 25px;
            box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -webkit-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -moz-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
        }
    }
}

@layer header {
    .header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-block: 20px;

        .header-logo {
            
            @media (width >= calc(750 / 16 * 1rem)) {
                width: 220px;
            }
        }

        .header-links {
            display: flex;
        }
    }
}

@layer topnav {
    .topnav {
        justify-content: end;
        align-items: center;
    }

    .topnav button {
        background: none;
        border: none;
        padding: 0;

        @media (width >= calc(750 / 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;

        img {
            width: 2.5rem;
        }
    }

    .topnav__menu {

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

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

        @media (width >= calc(582 / 16 * 1rem)) {
            inset: 39px 0 0 0;
        }
    }

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

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

        @media (width >= calc(1000 / 16 * 1rem)) {
            font-size: 17px;
        }

        
    }

    .topnav__item {
        list-style-type: none;
        transition: 250ms ease-in-out;

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

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

        &:hover {
            color: var(--c-buy-btn-bg);
            text-shadow: 1px 2px 5px rgba(111,79,62,0.6);
        }
    }

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

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

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

@layer hero {
    .hero {
        padding: 20px 0 40px 0;
        justify-items: center;

        @media (width >= calc(700 / 16 * 1rem)) {
            display: flex;
            min-height: 60vh;
            align-items: center;
            justify-content: center;
            background-image: url(./img/hero.png);
            background-repeat: no-repeat;
            background-size: cover;
            background-position: center;
        }

    }

    .hero-img {
        img {
            width: 300px;
            padding-block-end: 40px;

            @media (width >= calc(700 / 16 * 1rem)) {
                    position: relative;
                    width: auto;  
                    min-height: 50vh; 
                    top: 60px;                
            }
        }
    }

    .hero-content {
        display: flex;
        flex-direction: column;

        @media (width >= calc(700 / 16 * 1rem)) {
            align-items: center;
            position: relative;
            top: 15px; 
        }

        h1 {
            padding-block-end: 25px;
            width: 20ch;
        }

        p {
            width: 30ch;

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

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

        a {
            margin-block-start: 40px;
            align-self: center;
        }
    }
}

@layer author {
    .author {
        gap: clamp(20px, 5vw, 60px);
        padding-block: 40px;
        justify-items: center;
        align-items: center;
        background-color: var(--c-section-bg);

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

    .author-img {

        img {
            width: clamp(200px, 25vw, 300px);
            border-radius: 20px;

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

    .author-content {
        display: flex;
        flex-direction: column;
        color: var(--c-section-text);
        justify-content: center;

        @media (width >= calc(700 / 16 * 1rem)) {
            padding-right: 20px;
        }

        h2 {
            margin: 0 auto;
            padding-block-start: 25px;

            @media (width >= calc(700 / 16 * 1rem)) {
                padding-block-start: 0;
            }
        }

        p {
            width: clamp(25ch, 50vw, 60ch);
            padding-block-start: 25px;
        }
    }
}

@layer books {
    .books-mobile {
        display: grid;
        place-items: center;
        text-align: center;
        gap: 15px;
        padding-block-start: 20px;
        
        a {
            display: block;
            margin: 0 auto;
            margin: 20px auto 0 auto;
        }
    }

    .books-mobile .mobile-book {
    width: 150px;
}

    @media (width >= calc(700 / 16 * 1rem)) {
        .books-mobile {
            display: none;
        }
    }

    .books {
        padding-block: 40px;

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

    .books-box {
        display: flex;
        margin-block-start: 40px;
        align-items: center;
        justify-content: center; 

        @media (width < calc(700 / 16 * 1rem)) {
            display: none;
        }

        .books-item,
        .books-content {
            width: auto;
        }

        .books-item {

            img {
                width: clamp(200px, 25vw, 300px);
                margin: 0 auto;
                justify-content: center;
            }
        }

        .books-content {
            margin-left: clamp(20px, 3vw, 40px);

            h3 {
                margin-block-end: 20px;
                text-align: left;
            }

            p {
                width: clamp(45ch, 50vw, 60ch);
                text-align: left;
            }

            a {
                display: block;
                margin-top: 30px;

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

@layer contact {
    .contact {
        background-color: var(--c-section-bg);
        color: var(--c-section-text);
        padding-block-start: 40px;
    }

    .contact-box {
        display: block;
        padding-block: 40px;
        align-items: center;

        @media (width >= calc(700 / 16 * 1rem)) {
            display: flex;
            width: auto;
            gap: 50px;
            margin: 40px auto;
            padding-block: 0;
        }
    }

    .contact-box__email {
        text-align: center;

        a {
            color: var(--c-buy-btn-bg);

            &:hover {
            transform: scale(1.2);
            color: var(--c-buy-btn-bg);
            text-shadow: 1px 2px 5px rgba(111,79,62,0.6);
            }
        }
    }

.contact-box__email h3,
.contact-box__social h3 {
    margin-block-end: 25px;
    position: relative;
    padding-bottom: 1px;

    &::before {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 1px;  
        background: var(--c-text);

        @media (max-width: calc(700 / 16 * 1rem)) {
            width: 200px;
            left: 50%;
            transform: translateX(-50%);
        }
    }
}
    .contact-box__email h3 {
         @media (max-width: calc(700 / 16 * 1rem)) {
            
            &::before {
                width: 165px;
            }
        }
    }

    .contact-box__social {
        
        @media (width < calc(700 / 16 * 1rem)) {
            margin-block-start: 25px;
        }

        ul {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        img {

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

    .facebook {
        background-color: var(--c-text);
    }
}

@layer newsletter {
    .newsletter {
        background-color: var(--c-banner-bg);
        color: var(--c-color);
        padding-block: 40px;
        margin-bottom: 40px;
    
        p {
            font-size: var(--fs-20);
        }
    }

    .newsletter-span {
        font-size: var(--fs-20);
        color: var(--c-buy-btn-bg);
        text-transform: uppercase;
    }

    .newsletter-box {
        max-width: 500px;
        margin: 0 auto;

        @media (max-width: 480px) {
            .newsletter-form input,
            .newsletter-form button {
                flex: none; 
                width: 100%;
                max-width: 300px;
                margin: 0 auto;
            }
        }
    }

    .newsletter-form {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }

    .newsletter-form input {
        flex: 1 1 150px;
        padding: 8px 12px;
        border: 1px solid var(--c-buy-btn-bg);
        caret-color: var(--c-buy-btn-bg);
        
        &:focus {
            box-shadow: 0 0 0 2px var(--c-buy-btn-bg);
            outline: none;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
    }

    .newsletter-form button {
        padding: 8px 16px;
        background-color: var(--c-buy-btn-bg);
        color: #fff;
        border: none;
        cursor: pointer;
    }

    .newsletter-form button:hover {
        border-radius: 25px;
        box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -webkit-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
            -moz-box-shadow: 10px 10px 11px -7px rgba(0,0,0,0.75);
    }

    /* MAILLITE EMBEDDED FORM OVERRIDES */

        #mlb2-33741014 input {
            caret-color: #6f4f3e;

            &:focus,
            :focus-visible {
                outline: none !important;
                border-color: #6f4f3e !important; /* kolor bordera */
                box-shadow: 0 0 0 1px #6f4f3e; /* delikatny glow */
            }
    }

    .label-description {

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

    #mlb2-33741014 .ml-form-recaptcha {
        max-width: 100%;
        overflow: hidden;
    }
}

@layer footer {
    .footer {
        padding-block: 20px;

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

@layer shop {
    .filters {

        h1 {
            margin-top: 40px;
        }

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

        .button.active {
            border-radius: 25px;
            color: var(--c-section-text);
            background: var(--c-accent);
            box-shadow: 6px 8px 14px rgba(0,0,0,0.12);
        }
    }

    .products {
        padding-block: 20px 40px;
        /* background-color: var(--c-section-bg); */
        color: var(--c-section-text);
        margin-block-end: 20px;
    }

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

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

    .products-group h2 {
        margin: 0 0 12px 0;
        font-size: var(--fs-20);
        text-align: center;
    }

    .products-group .group-items {
        display: grid;
        /* keep card widths consistent and center the grid */
        grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
        gap: 20px;
        justify-content: center;
        /* align-items: stretch; make grid items equal height */
        /* max-width: calc(1110px - 40px); */
        margin-inline: auto;
    }

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

    .product {
        background: var(--c-section-bg);
        color: var(--c-section-text);
        border-radius: 12px;
        padding: 20px;
        box-shadow: 10px 6px 16px rgba(0,0,0,0.08);
        display: flex;
        flex-direction: column;
    }

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

    .product img {
        width: 250px;
        height: 160px; /* fixed image area so cards align */
        object-fit: contain;
        margin-bottom: 12px;
        border-radius: 8px;
    }

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

    .product-info h3 {
        font-size: var(--fs-16);
        margin-bottom: 8px;
        text-align: center;

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

    .product-info p {
        font-size: var(--fs-16);
        flex-grow: 1;
        text-align: center;
    }

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

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

    /* cart modal styles */
    .cart-modal-window {
        position: fixed;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 1100;
    }

    .cart-modal-window.is-open {
        display: flex;
    }

    .cart-modal__overlay {
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.6);
    }

    .cart-modal__panel {
        position: relative;
        background: #fff;
        color: var(--c-section-text);
        border-radius: 12px;
        max-width: 740px;
        width: calc(100% - 40px);
        padding: 20px;
        z-index: 2;
    }

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

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

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

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

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

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

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

    .cart-qty {
        width: 54px;
        border: 1px solid var(--c-buy-btn-bg);
        padding: 4px 8px;
        border-radius: 4px;
        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;
    }

    .cart-modal__summary .cart-empty {
        color: #555;
        text-align: center;
    }

    .cart-totals {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .cart-checkout {
        width: 100%;
        cursor: pointer;
    }

    /* continue shopping link - visible when cart has items (cart-totals is shown) */
    .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;
    }

    .cart-flash {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 24px;
        background: rgba(0,0,0,0.75);
        color: var(--c-text);
        padding: 10px 16px;
        border-radius: 8px;
        opacity: 0;
        transition: opacity 200ms ease-in-out;
        z-index: 1200;
    }

    .cart-flash.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;
    }

    @media (max-width: calc(700 / 16 * 1rem)) {
        .cart-modal__body { flex-direction: column; }
        .cart-modal__summary { width: 100%; }
    }
}