/* ============================================ */
/* MOTYWY (CSS variables)                      */
/* ============================================ */

:root,
[data-theme="light"] {
    --bg: #fff8ec;
    --bg-soft: #fdf1df;
    --paper: #fffdf7;

    --ink: #20213a;
    --muted: #74748f;

    --accent: #e46b3c;
    --accent-2: #7b4ba0;
    --night: #102749;

    --radius-xl: 2.1rem;
    --radius-lg: 1.6rem;
    --radius-md: 1.1rem;

    --shadow-soft: 0 22px 45px rgba(13, 24, 46, 0.28);
    --shadow-card: 0 16px 34px rgba(0, 0, 0, 0.16);

    --header-bg: rgba(255, 248, 236, 0.94);
    --header-border: rgba(16, 39, 73, 0.06);
    --hairline: rgba(32, 33, 58, 0.18);
    --hairline-strong: rgba(32, 33, 58, 0.2);
    --input-bg: #fffefb;
    --footer-bg: #f4e5d3;
    --hero-noise-blend: overlay;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #1a1625;
    --bg-soft: #211a30;
    --paper: #2a2238;

    --ink: #f0ebe3;
    --muted: #a297b8;

    --accent: #ff8a5c;
    --accent-2: #b48ad6;
    --night: #e7d8ff;

    --shadow-soft: 0 22px 45px rgba(0, 0, 0, 0.55);
    --shadow-card: 0 16px 34px rgba(0, 0, 0, 0.45);

    --header-bg: rgba(26, 22, 37, 0.88);
    --header-border: rgba(255, 255, 255, 0.06);
    --hairline: rgba(255, 255, 255, 0.14);
    --hairline-strong: rgba(255, 255, 255, 0.2);
    --input-bg: #1f192d;
    --footer-bg: #15111e;
    --hero-noise-blend: screen;

    color-scheme: dark;
}

/* ============================================ */
/* RESET + BAZA                                */
/* ============================================ */

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

html, body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
            radial-gradient(circle at 0 0, rgba(228, 107, 60, 0.08), transparent 55%),
            radial-gradient(circle at 100% 100%, rgba(123, 75, 160, 0.14), transparent 55%),
            linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 50%, var(--bg) 100%);
    font-family: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    line-height: 1.7;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    html { scroll-behavior: auto !important; }
    .floating, .hero-noise { animation: none !important; }
    .reveal { opacity: 1; transform: none; }
    .hero-title-main {
        border-right: none !important;
        animation: none !important;
        white-space: normal !important;
    }
    .hero-title-sub {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}

/* ============================================ */
/* SKIP LINK (dostępność)                      */
/* ============================================ */

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--ink);
    color: var(--paper);
    padding: 0.7rem 1.1rem;
    z-index: 1000;
    text-decoration: none;
    border-radius: 0 0 0.6rem 0;
    font-size: 0.9rem;
    transition: top 0.18s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.site-header, main, .site-footer {
    position: relative;
    z-index: 1;
}

/* ============================================ */
/* GLOBAL CONTAINER                            */
/* ============================================ */

.inner {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

/* ============================================ */
/* HEADER                                       */
/* ============================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--header-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    gap: 1.2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.logo-name {
    font-size: 0.96rem;
    font-weight: 500;
}

.logo-tag {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.logo-image {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    opacity: 0.96;
    transition: transform 0.25s ease, opacity 0.25s ease;
    filter: saturate(115%);
}

.logo:hover .logo-image {
    transform: scale(1.08) rotate(-2deg);
    opacity: 1;
}

[data-theme="dark"] .logo-image {
    filter: saturate(115%) brightness(1.1);
}

/* NAV */
.nav {
    display: flex;
    align-items: center;
    gap: 1.05rem;
    font-size: 0.86rem;
    position: relative;
}

.nav-highlight {
    position: absolute;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    bottom: 0.1rem;
    left: 0;
    width: 0;
    transition: transform 0.25s ease, width 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}

.nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav a:hover {
    background: rgba(16, 39, 73, 0.06);
    color: var(--ink);
    transform: translateY(-1px);
}

[data-theme="dark"] .nav a:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* aria-current = aktualna sekcja */
.nav a[aria-current] {
    color: var(--accent);
    font-weight: 500;
}

.nav-toggle {
    display: none;
    border: none;
    background: none;
    padding: 0.3rem;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
}

/* THEME TOGGLE */
.theme-toggle {
    background: none;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    font-size: 1rem;
    transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
    margin-left: 0.5rem;
}

.theme-toggle:hover {
    background: rgba(16, 39, 73, 0.06);
    transform: scale(1.05);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.theme-toggle .theme-icon-light { display: none; }
.theme-toggle .theme-icon-dark { display: inline; }

[data-theme="dark"] .theme-toggle .theme-icon-light { display: inline; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }

/* ============================================ */
/* HERO                                         */
/* ============================================ */

.hero {
    position: relative;
    padding: 3.6rem 0 3.4rem;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.6;
}

[data-theme="dark"] .hero-bg {
    opacity: 0.25;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: contrast(110%) saturate(110%);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
}

.hero-title {
    margin: 0 0 1rem;
    font-family: "Playfair Display", serif;
    font-size: clamp(2.5rem, 3.2vw, 3rem);
    line-height: 1.15;
}

.hero-title-main {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid;
    border-color: rgba(32, 33, 58, 0.8);
    animation: caretBlink 0.8s steps(1, end) infinite;
}

[data-theme="dark"] .hero-title-main {
    border-color: rgba(240, 235, 227, 0.8);
}

.hero-title-sub {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px);
    animation: subtitleFade 0.8s ease forwards;
    animation-delay: 2.6s;
}

@media (max-width: 480px) {
    .hero-title-main {
        white-space: normal;
    }
}

@keyframes caretBlink {
    0%, 49%   { border-right-color: currentColor; }
    50%,100%  { border-right-color: transparent; }
}

@keyframes subtitleFade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--accent-2);
    margin: 0 0 0.8rem;
}

.hero-lead {
    font-size: 0.98rem;
    color: var(--muted);
    max-width: 30rem;
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.hero-portrait {
    display: flex;
    justify-content: flex-end;
}

.portrait-frame {
    position: relative;
    max-width: 420px;
    width: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transform-origin: center;
    will-change: transform;
}

.hero-photo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.hero-poly {
    position: absolute;
    width: 40%;
    bottom: -10%;
    right: -10%;
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45));
}

.floating {
    animation: float 8s ease-in-out infinite;
}

.hero-noise {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.16), transparent 60%),
    radial-gradient(circle at 70% 80%, rgba(255,170,80,0.12), transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(125,75,160,0.10), transparent 60%);
    mix-blend-mode: var(--hero-noise-blend);
    animation: fogMove 26s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes fogMove {
    0%   { transform: translate(0%, 0%) scale(1); opacity: 0.45; }
    50%  { transform: translate(-4%, 2%) scale(1.15); opacity: 0.6; }
    100% { transform: translate(3%, -3%) scale(1.1); opacity: 0.35; }
}

/* ============================================ */
/* BUTTONS                                      */
/* ============================================ */

.btn {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.6rem 1.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
            transform 0.12s ease,
            box-shadow 0.12s ease,
            background 0.18s ease,
            color 0.18s ease,
            border-color 0.18s ease;
}

.btn.primary {
    background: linear-gradient(115deg, var(--accent), #ff9c62);
    color: #fffdf8;
    box-shadow: 0 14px 26px rgba(228, 107, 60, 0.42);
}

.btn.primary:hover {
    transform: translateY(-1px) translateX(0.5px);
    box-shadow: 0 20px 36px rgba(228, 107, 60, 0.52);
}

.btn.ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--hairline-strong);
}

.btn.ghost:hover {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .btn.ghost:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* ============================================ */
/* SECTIONS                                     */
/* ============================================ */

.section {
    padding: 3.2rem 0;
}

.section-soft {
    background: var(--bg-soft);
}

.section-header {
    text-align: center;
    margin-bottom: 2.1rem;
}

.section-header h2 {
    margin: 0;
    font-family: "Playfair Display", serif;
    font-size: 1.7rem;
}

.section-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.section-label.left {
    display: inline-block;
}

/* ============================================ */
/* BOOKS                                        */
/* ============================================ */

.section-books {
    position: relative;
}

.book-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr);
    gap: 2.2rem;
    align-items: center;
    padding: 1.8rem 1.7rem;
    border-radius: var(--radius-xl);
    background: var(--paper);
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.book-layout--reverse {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.05fr);
}

.book-layout--reverse .book-image {
    order: 2;
}

.book-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
}

.book-content h3 {
    margin: 0 0 0.4rem;
    font-size: 1.3rem;
    font-family: "Playfair Display", serif;
}

.book-meta {
    margin: 0 0 0.8rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
}

/* ============================================ */
/* ABOUT                                        */
/* ============================================ */

.section-about {
    position: relative;
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr);
    gap: 2.2rem;
    align-items: center;
}

.about-photo img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
}

.about-text h2 {
    margin-top: 0.2rem;
}

/* ============================================ */
/* CONTACT                                      */
/* ============================================ */

.section-contact {
    background:
            radial-gradient(circle at 5% 5%, rgba(228, 107, 60, 0.12), transparent 55%),
            var(--bg-soft);
}

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 2.1rem;
}

.contact-form,
.order-form {
    background: var(--paper);
    border-radius: var(--radius-xl);
    padding: 1.6rem 1.5rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.contact-form label,
.order-form label {
    font-size: 0.84rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.contact-form input,
.contact-form textarea,
.order-form input,
.order-form textarea {
    border-radius: 0.9rem;
    border: 1px solid var(--hairline-strong);
    padding: 0.6rem 0.8rem;
    font: inherit;
    background: var(--input-bg);
    color: var(--ink);
}

.contact-form input:focus,
.contact-form textarea:focus,
.order-form input:focus,
.order-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(228, 107, 60, 0.18);
}

.order-form .checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.55rem;
}

.checkbox input {
    margin-top: 0.25rem;
}

.contact-info h3 {
    margin-top: 0;
}

.contact-info a {
    color: var(--accent);
    text-underline-offset: 0.18em;
    overflow-wrap: anywhere;
}

.contact-info-note {
    font-size: 0.92rem;
    color: var(--muted);
}

/* ============================================ */
/* ORDER FORM                                   */
/* ============================================ */

.section-intro {
    max-width: 38rem;
    margin: 0.6rem auto 0;
    color: var(--muted);
    font-size: 0.97rem;
    line-height: 1.55;
}

.order-fieldset {
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.order-fieldset legend {
    font-family: "Playfair Display", serif;
    font-size: 1.02rem;
    color: var(--ink);
    margin-bottom: 0.15rem;
    padding: 0;
}

.order-product {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.8rem;
    background: var(--input-bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
}

.order-product img {
    width: 80px;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.order-product-info h4 {
    margin: 0 0 0.3rem;
    font-family: "Playfair Display", serif;
    font-size: 1.05rem;
}

.order-price {
    margin: 0;
    font-size: 0.95rem;
    color: var(--ink);
}

.order-price strong {
    font-size: 1.15rem;
    color: var(--accent);
}

.order-product-info {
    flex: 1;
    min-width: 0;
}

.order-form .order-qty {
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.order-form .order-qty input {
    width: 4.2rem;
    text-align: center;
    padding: 0.45rem 0.3rem;
}

.order-total {
    margin: 0.2rem 0 0;
    text-align: right;
    font-size: 0.95rem;
}

.order-total strong {
    font-size: 1.15rem;
    color: var(--accent);
}

.order-price-note {
    color: var(--muted);
    font-size: 0.85rem;
    margin-left: 0.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 0.7rem;
}

.form-optional {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.78rem;
    margin-left: 0.25rem;
}

.checkbox-required a {
    color: var(--accent);
}

.checkbox-required {
    padding: 0.5rem 0.7rem;
    background: var(--input-bg);
    border-radius: 0.7rem;
    border: 1px solid var(--hairline);
    font-size: 0.82rem;
}

.form-footnote {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}

.form-status {
    margin: 0;
    font-size: 0.9rem;
    text-align: center;
}

.form-status:empty {
    display: none;
}

.form-status.is-success {
    color: var(--accent);
}

.form-status.is-error {
    color: #c0392b;
}

[data-theme="dark"] .form-status.is-error {
    color: #ff8a80;
}

/* Mobilne: rząd kod+miejscowość zwija się */
@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .order-product {
        gap: 0.75rem;
        padding: 0.65rem;
    }

    .order-product img {
        width: 56px;
    }

    .order-product-info h4 {
        font-size: 0.98rem;
    }
}

/* ============================================ */
/* FOOTER                                       */
/* ============================================ */

.site-footer {
    border-top: 1px solid var(--header-border);
    background: var(--footer-bg);
}

.footer-inner {
    padding: 0.95rem 0 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--hairline-strong);
    padding-bottom: 1px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-note {
    opacity: 0.85;
}

/* ============================================ */
/* ANIMACJE                                     */
/* ============================================ */

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

.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition:
            opacity 0.7s ease-out,
            transform 0.7s ease-out;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================ */
/* RESPONSIVE                                   */
/* ============================================ */

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2.4rem;
    }

    .hero-portrait {
        justify-content: flex-start;
    }

    .book-layout,
    .book-layout--reverse {
        grid-template-columns: 1fr;
    }

    .book-layout--reverse .book-image {
        order: 0;
    }

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

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}

@media (max-width: 720px) {
    .nav {
        position: absolute;
        inset-inline: 0;
        top: 100%;
        padding: 0.8rem 1rem 1.1rem;
        flex-direction: column;
        /* pełne tło – backdrop-filter nie działa w elemencie zagnieżdżonym w headerze */
        background: var(--bg);
        border-bottom: 1px solid var(--header-border);
        box-shadow: 0 18px 30px rgba(0, 0, 0, 0.12);
        transform-origin: top;
        transform: scaleY(0.82);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
        align-items: flex-start;
    }

    .nav.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: scaleY(1);
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .nav-highlight {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .theme-toggle {
        margin-left: 0;
        margin-top: 0.4rem;
    }
}

