/* ============================================================
   LAYOUT — page-shell components reused across every page:
     .container, .topbar, .header, .search, .iconbtn, .badge,
     .nav, .footer (+ newsletter strip), responsive.
   Inlined as critical CSS by layouts/default.inc.php.
   ============================================================ */

/* --- Container --- */
.container { max-width: 1440px; margin: 0 auto; padding: 0 24px; }

/* ============== TOP BAR ============== */
.topbar {
    background: var(--ink);
    color: #d8d2c5;
    font-size: 12px;
    letter-spacing: 0.02em;
}
.topbar__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 24px;
}
.topbar__left { display: flex; align-items: center; gap: 8px; }
.topbar__left svg { vertical-align: -2px; margin-right: 4px; color: var(--accent-2); }
.topbar__sep { opacity: .35; margin: 0 6px; }
.topbar__right { display: flex; align-items: center; gap: 18px; }
.topbar__right a:hover { color: #fff; opacity: 1; }
.topbar__contact { display: inline-flex; align-items: center; gap: 5px; }
.topbar__contact svg { color: var(--accent-2); }
.topbar__wa { display: inline-flex; align-items: center; color: #25d366; margin-left: -10px; } /* -10px niweluje gap topbaru: ikona WA siedzi 8px od numeru, nie jako osobna pozycja */
.topbar__wa:hover { color: #25d366 !important; opacity: .85; }
.lang { position: relative; display: inline-block; }
.lang__btn { display: inline-flex; align-items: center; gap: 6px; color: inherit; font-size: 12px; font-weight: 500; padding: 0; cursor: pointer; }
.lang__flag { width: 20px; height: 14px; border-radius: 2px; display: block; flex: none; }
.lang__code { letter-spacing: .04em; }
.lang__caret { opacity: .75; }
.lang__menu {
    position: absolute; top: calc(100% + 9px); right: 0; min-width: 192px;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px;
    box-shadow: 0 14px 34px rgba(0,0,0,.16); padding: 4px; z-index: 60;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.lang:hover .lang__menu, .lang:focus-within .lang__menu { opacity: 1; visibility: visible; transform: none; }
.lang__menu::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 11px; }
.lang__opt {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 9px 10px; font-size: 14px; color: var(--ink); border-radius: 6px; cursor: pointer; background: none;
}
.lang__opt:hover { background: var(--bg-alt); }
.lang__opt.is-active { background: var(--accent-soft); font-weight: 500; }
.lang__opt > span { flex: 1; }
.lang__check { color: var(--accent-dark); flex: none; }

/* ============== HEADER ============== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}
.header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 40px;
    padding: 22px 24px;
}

.logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo__img {
    height: 60px;
    width: auto;
    display: block;
    mix-blend-mode: multiply;
}
.logo--footer .logo__img { height: 54px; mix-blend-mode: multiply; }

/* --- Header search --- */
.search {
    display: flex;
    align-items: center;
    background: var(--bg-soft);
    border-radius: 999px;
    padding: 0 6px 0 22px;
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
    border: 1px solid transparent;
    transition: all var(--transition);
    position: relative; /* kontekst dla dropdownu podpowiedzi .search-suggest */
}
.search:focus-within { border-color: var(--accent); background: var(--bg-card); }
.search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 12px 8px;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    font-family: var(--sans); /* explicit Inter — inputs don't inherit the page font reliably */
}
.search input::placeholder { color: var(--ink-3); }
.search button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    transition: background var(--transition);
}
.search button:hover { background: var(--accent); }

/* --- Podpowiedzi wyszukiwania (dropdown pod .search) ---
   Markup buduje catalog/view/javascript/figurydeco-livesearch.js */
.search-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 60; /* nad .mega (40); header sam jest sticky z z-index 50 */
    text-align: left;
}
.search-suggest__list { max-height: min(420px, 60vh); overflow-y: auto; }
.search-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background var(--transition);
}
.search-suggest__item:hover,
.search-suggest__item.is-active { background: var(--bg-soft); }
.search-suggest__item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
    border-radius: var(--radius);
    background: #fff; /* wycinanki PNG na białym — czytelne też w dark mode */
    border: 1px solid var(--line);
}
.search-suggest__name { flex: 1; font-size: 14px; line-height: 1.35; color: var(--ink); }
.search-suggest__name mark { background: none; color: inherit; font-weight: 600; }
.search-suggest__price { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.search-suggest__price s { color: var(--ink-3); font-weight: 400; margin-right: 6px; }
.search-suggest__price b.is-special { color: var(--accent-dark); }
.search-suggest__all {
    display: block;
    padding: 11px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--bg-soft);
    border-top: 1px solid var(--line);
}
.search-suggest__all:hover { color: var(--ink); }
.search-suggest__empty { padding: 14px 16px; font-size: 13px; color: var(--ink-3); }

/* --- Header actions (account / wishlist / cart) --- */
.header__actions { display: flex; align-items: center; gap: 8px; }
.iconbtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    transition: background var(--transition);
}
.iconbtn:hover { background: var(--bg-soft); opacity: 1; }
/* wrapper #cart (kontrakt common.js: $('#cart > button') = ukryte ujście liczników)
   — display:contents, żeby nie zmieniał układu flex w .header__actions */
.cartbox { display: contents; }

.iconbtn--cart { background: var(--ink); color: #fff; }
.iconbtn--cart:hover { background: var(--accent); opacity: 1; }
.iconbtn--cart .quantity { /* canonical contract 2.1 */
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 10px;
    font-weight: 600;
    display: grid;
    place-items: center;
}
.iconbtn--cart .quantity:empty { display: none; } /* empty cart → no stray badge circle */
/* licznik pozycji jako wtopiony chip-pigułka OBOK napisu „Koszyk" — zawsze czytelny,
   nie nachodzi na tekst (inaczej niż absolutny .badge na ikonie ulubionych) */
.iconbtn--cart .cart-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}
.iconbtn--cart .cart-count[hidden] { display: none; } /* pusty koszyk → brak chipa */
.iconbtn--cart .formatted_value { /* contract 2.1 — visually hidden by default */
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* --- Generic badge (used by wishlist heart) --- */
.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: grid;
    place-items: center;
}
.badge--accent { background: #fff; color: var(--ink); top: 6px; right: 6px; }

/* ============== NAV ============== */
.nav {
    border-top: 1px solid var(--line);
    background: var(--bg-card);
    position: relative; /* kontekst dla pełnoszerokiego panelu .mega (top:100% = pod paskiem nav) */
}
.nav__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.nav__link {
    display: inline-block;
    padding: 16px 18px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
    position: relative;
    transition: color var(--transition);
}
.nav__link:hover { color: var(--ink); opacity: 1; }
.nav__link::after {
    content: '';
    position: absolute;
    left: 18px; right: 18px;
    bottom: 8px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--transition);
}
.nav__link:hover::after { transform: scaleX(1); }
.nav__link--accent { color: var(--accent); }
.nav__link--accent::after { transform: scaleX(1); }

/* ============== MEGA MENU (podkategorie na hover) ==============
   Markup: views/box_site_menu.inc.php → li.has-mega > .nav__link + .mega.
   Otwierane CZYSTO na CSS (:hover / :focus-within) — bez inline on*= (kontrakt CSP).
   Panel rozpina się na całą szerokość .nav; treść wyśrodkowana w .container. */
.nav__chev {
    vertical-align: -1px;
    margin-left: 5px;
    flex-shrink: 0;
    transition: transform var(--transition);
}
.has-mega:hover > .nav__link .nav__chev,
.has-mega:focus-within > .nav__link .nav__chev { transform: rotate(180deg); }

.mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--transition), transform var(--transition), visibility 0s linear var(--transition);
    z-index: 40;
}
/* niewidzialna „kładka" — domyka mikro-przerwę hover między linkiem a panelem */
.mega::before {
    content: '';
    position: absolute;
    top: -8px; left: 0; right: 0;
    height: 8px;
}
.has-mega:hover > .mega,
.has-mega:focus-within > .mega {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity var(--transition), transform var(--transition), visibility 0s;
}
.mega__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 28px 32px;
    padding: 36px 0 40px;
    align-items: start;
}
.mega__col { min-width: 0; }
.mega__title {
    display: block;
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 14px;
    transition: color var(--transition);
}
.mega__title:hover { color: var(--accent); opacity: 1; }
.mega__links { display: flex; flex-direction: column; gap: 9px; }
.mega__links a {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    transition: color var(--transition), padding-left var(--transition);
}
.mega__links a:hover { color: var(--accent); padding-left: 5px; opacity: 1; }

/* ============== OFFCANVAS (mobile menu) ==============
   Required by app.js: data-toggle="offcanvas" + .offcanvas + data-target.
   Hidden by default on desktop; revealed via .is-open class. */
.offcanvas {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 360px);
    background: var(--bg-card);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .3s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    padding: 20px;
}
.offcanvas.is-open { transform: translateX(0); }
.offcanvas__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.offcanvas.is-open + .offcanvas__backdrop,
body.has-offcanvas-open .offcanvas__backdrop { opacity: 1; visibility: visible; }
[data-toggle="offcanvas"] {
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
    color: var(--ink);
    display: none;             /* shown only on mobile via responsive below */
}

/* --- Scroll-to-top FAB (contract 2.1: #scroll-up) --- */
#scroll-up {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity .25s, visibility .25s, transform .25s, background var(--transition);
    z-index: 90;
    cursor: pointer;
    border: 0;
}
#scroll-up.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
#scroll-up:hover { background: var(--accent); }

/* ============== NEWSLETTER STRIP (sits above footer on home) ============== */
.newsletter {
    background: var(--ink);
    color: #ebe6da;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}
.newsletter::before, .newsletter::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.newsletter::before {
    width: 500px; height: 500px; top: -250px; left: -100px;
    background: radial-gradient(circle, rgba(168,196,77,.18), transparent 70%);
}
.newsletter::after {
    width: 400px; height: 400px; bottom: -200px; right: -50px;
    background: radial-gradient(circle, rgba(147,173,63,.14), transparent 70%);
}
.newsletter__inner {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 2;
}
.newsletter p { margin: 16px 0 0; color: #c9c2b1; font-size: 16px; }
.newsletter strong { color: var(--accent-2); }
.newsletter__form {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: 6px;
}
.newsletter__form input {
    flex: 1;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 14px;
    padding: 12px 22px;
    outline: none;
    font-family: inherit;
}
.newsletter__form input::placeholder { color: #8a8472; }
/* przycisk w pigułce też pigułką: rogi .btn (--radius 4px) sterczały ~2px
   poza zaokrąglony obrys formy (999px) — celowe odejście od makiety */
.newsletter__form .btn { border-radius: 999px; padding: 13px 24px; }

/* ============== FOOTER ============== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--line);
    padding-top: 70px;
    color: var(--ink-2);
    font-size: 14px;
}
.footer__top {
    display: grid;
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 50px;
    padding-bottom: 50px;
}
.footer__brand p { margin: 18px 0 24px; font-size: 14px; line-height: 1.6; color: var(--ink-2); max-width: 320px; }
.footer__contact { display: flex; flex-direction: column; gap: 6px; }
.footer__contact a {
    font-family: var(--serif);
    font-size: 18px;
    color: var(--ink);
    font-weight: 500;
}
.footer__contact a:hover { color: var(--accent); opacity: 1; }
.footer__col h4 {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 18px;
}
.footer__col ul { display: flex; flex-direction: column; gap: 10px; }
.footer__col a { color: var(--ink-2); font-size: 14px; transition: color var(--transition); }
.footer__col a:hover { color: var(--accent); opacity: 1; }
.footer__col address {
    font-style: normal;
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink-2);
}
.footer__social { display: flex; gap: 8px; margin-top: 18px; }
.footer__social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-soft);
    display: grid;
    place-items: center;
    color: var(--ink-2);
    transition: all var(--transition);
}
.footer__social a:hover { background: var(--accent); color: #fff; opacity: 1; }
.footer__bottom {
    border-top: 1px solid var(--line);
    padding: 22px 0;
    font-size: 12px;
    color: var(--ink-3);
}
.footer__bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.footer__pay { display: flex; align-items: center; gap: 10px; }
.pay {
    background: var(--bg-soft);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: 0.04em;
}

/* ============== RESPONSIVE ============== */
@media (max-width: 1024px) {
    .header__inner { grid-template-columns: auto 1fr auto; gap: 20px; padding: 16px 24px; }
    .iconbtn span:not(.badge):not(.quantity):not(.formatted_value) { display: none; }
    .footer__top { grid-template-columns: 1fr 1fr; }
    [data-toggle="offcanvas"] { display: inline-flex; }
    .mega, .nav__chev { display: none; } /* poniżej 1024px nawigację przejmuje offcanvas */
}
@media (max-width: 720px) {
    .topbar__left span:nth-of-type(3),
    .topbar__sep { display: none; }
    .nav__list { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .nav__list::-webkit-scrollbar { display: none; }
    .nav__link { white-space: nowrap; padding: 14px 12px; }
    .footer__top { grid-template-columns: 1fr; gap: 36px; }
    .newsletter { padding: 50px 0; }
    .newsletter__inner { grid-template-columns: 1fr; gap: 30px; }
    .newsletter__form { flex-direction: column; border-radius: var(--radius-lg); padding: 8px; }
    .newsletter__form input { width: 100%; }
    .newsletter__form button { width: 100%; }
    .logo__img { height: 44px; }
    #scroll-up { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}
