/* =====================================================================
   Pizzeria Toscania — style klienta
   Czysty CSS, mobile-first, bez frameworka.

   DLACZEGO NIE TAILWIND CDN: skrypt z cdn.tailwindcss.com to zewnętrzna
   zależność, która musi być dostępna, żeby strona nie wyglądała jak
   dokument z 1996 roku, i która wymaga rozluźnienia CSP. Ten plik ma
   9 kB, ładuje się z tego samego serwera i nie zepsuje się nigdy.
   ===================================================================== */

:root {
    --brand:        #c1272d;
    --brand-dark:   #96181e;
    --brand-light:  #fdf2f2;
    --green:        #1f7a3f;
    --ink:          #1c1917;
    --ink-soft:     #57534e;
    --ink-faint:    #a8a29e;
    --line:         #e7e5e4;
    --bg:           #faf9f7;
    --card:         #ffffff;
    --radius:       14px;
    --shadow:       0 1px 3px rgba(28,25,23,.08), 0 4px 16px rgba(28,25,23,.05);
    --shadow-lift:  0 4px 12px rgba(28,25,23,.12), 0 12px 32px rgba(28,25,23,.08);
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

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

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

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand); }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------
   NAGŁÓWEK
   --------------------------------------------------------------- */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 40;
}
.site-header__inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 16px; max-width: 760px; margin: 0 auto;
}
.logo {
    font-size: 19px; font-weight: 800; letter-spacing: -.02em;
    color: var(--ink); text-decoration: none;
}
.logo span { color: var(--brand); }
.header-phone {
    font-size: 14px; font-weight: 600; text-decoration: none;
    color: var(--ink-soft); white-space: nowrap;
}

/* ---------------------------------------------------------------
   PASEK STANU LOKALU
   --------------------------------------------------------------- */
.shop-status {
    padding: 10px 16px; font-size: 14px; font-weight: 600; text-align: center;
}
.shop-status--open   { background: #ecfdf3; color: var(--green); }
.shop-status--closed { background: #fef2f2; color: var(--brand-dark); }

/* ---------------------------------------------------------------
   NAGŁÓWEK STRONY (H1 + fakty o dostawie)
   --------------------------------------------------------------- */
.hero {
    position: relative; overflow: hidden;
    padding: 26px 0 22px; background: #1a1008;
}
/* Zdjęcie pieca jako tło. Jako <img>, nie background-image —
   przeglądarka wczyta je z priorytetem i nie zablokuje renderowania. */
.hero__bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: center 62%;
    opacity: .55; z-index: 0;
}
.hero::after {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(180deg, rgba(20,12,6,.72) 0%, rgba(20,12,6,.82) 100%);
}
.hero__content { position: relative; z-index: 2; }

.hero__logo {
    width: 72px; height: 72px; border-radius: 50%;
    display: block; margin-bottom: 12px;
    box-shadow: 0 2px 14px rgba(0,0,0,.45);
}
.hero__title {
    font-size: 27px; font-weight: 800; letter-spacing: -.03em;
    margin: 0 0 12px; line-height: 1.12; color: #fff;
    text-shadow: 0 1px 12px rgba(0,0,0,.4);
}
.hero__sub {
    display: block; font-size: 14.5px; font-weight: 500;
    color: rgba(255,255,255,.82); letter-spacing: 0; margin-top: 6px;
    text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.hero__facts {
    display: flex; flex-wrap: wrap; gap: 8px;
    list-style: none; margin: 0; padding: 0;
}
.hero__facts li {
    font-size: 13px; padding: 6px 11px; border-radius: 999px;
    background: rgba(255,255,255,.14); color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.22);
    backdrop-filter: blur(4px);
}
.hero__facts strong { color: #fff; font-weight: 700; }

/* ---------------------------------------------------------------
   NAWIGACJA KATEGORII
   --------------------------------------------------------------- */
.categories {
    padding: 12px 0;
    scrollbar-width: none; -ms-overflow-style: none;
    /* Wysokosc naglowka mierzy JS i zapisuje w --header-h.
       Sztywne 57px rozjezdzalo sie, gdy numer telefonu zawijal sie
       na waskich ekranach i naglowek rosl. */
    position: sticky; top: var(--header-h, 57px); background: var(--bg); z-index: 30;
    border-bottom: 1px solid var(--line);
}
.categories::-webkit-scrollbar { display: none; }
.categories__inner {
    display: flex; gap: 8px; overflow-x: auto; padding: 0 16px;
    max-width: 760px; margin: 0 auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.categories__inner::-webkit-scrollbar { display: none; }
.category-chip {
    flex: 0 0 auto; padding: 8px 16px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card);
    font-size: 14px; font-weight: 600; color: var(--ink-soft);
    text-decoration: none; white-space: nowrap;
}
.category-chip--active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------------------------------------------------------
   KARTA PRODUKTU
   --------------------------------------------------------------- */
.section-title {
    font-size: 22px; font-weight: 800; letter-spacing: -.02em;
    margin: 28px 0 4px;
}
.section-desc { color: var(--ink-soft); font-size: 14px; margin: 0 0 14px; }

.product {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
    box-shadow: var(--shadow); width: 100%; text-align: left;
}
.product:active { transform: scale(.995); }
.product__photo {
    flex: 0 0 auto; width: 84px; height: 84px; border-radius: 10px;
    object-fit: cover; background: var(--bg);
}
.product__photo--empty {
    display: grid; place-items: center; font-size: 30px;
    border: 1px dashed var(--line); opacity: .35;
}
.product__body { flex: 1; min-width: 0; }
.product__name {
    font-size: 16px; font-weight: 700; margin: 0 0 3px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.product__desc {
    font-size: 13.5px; color: var(--ink-soft); margin: 0 0 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-clamp: 2; overflow: hidden;
}
.product__price { font-size: 15px; font-weight: 700; color: var(--brand); }
.product__price small { font-weight: 500; color: var(--ink-faint); }

.badge {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 2px 7px; border-radius: 5px; letter-spacing: .02em;
}
.badge--veg   { background: #ecfdf3; color: var(--green); }
.badge--spicy { background: var(--brand-light); color: var(--brand); }

.product__add {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
    border: none; background: var(--brand); color: #fff;
    font-size: 24px; line-height: 1; display: grid; place-items: center;
}

/* ---------------------------------------------------------------
   KONFIGURATOR (modal)
   --------------------------------------------------------------- */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(28,25,23,.5);
    z-index: 50; display: none;
}
.sheet-backdrop[data-open="1"] { display: block; }

.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
    background: var(--card); border-radius: 20px 20px 0 0;
    max-height: 92vh; display: none; flex-direction: column;
    box-shadow: var(--shadow-lift);
}
.sheet[data-open="1"] { display: flex; }
@media (min-width: 640px) {
    .sheet {
        left: 50%; transform: translateX(-50%); bottom: 24px;
        width: 560px; border-radius: 20px; max-height: 86vh;
    }
}

.sheet__head {
    padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.sheet__title { font-size: 20px; font-weight: 800; margin: 0; }
.sheet__close {
    background: var(--bg); border: none; border-radius: 50%;
    width: 34px; height: 34px; font-size: 20px; color: var(--ink-soft);
    flex: 0 0 auto;
}
.sheet__body { padding: 4px 20px 20px; overflow-y: auto; flex: 1; }
.sheet__foot {
    padding: 14px 20px calc(14px + var(--safe-bottom));
    border-top: 1px solid var(--line); background: var(--card);
}

.opt-group { margin: 20px 0 0; }
.opt-group__title {
    font-size: 14px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 10px;
}
.opt-group__hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-faint); }

/* Wybór rozmiaru — duże, wyraźne kafle */
/* Rozmiary: tyle kolumn, ile się zmieści. Przy trzech wariantach
   sztywne 1fr 1fr dawało układ 2+1 z osieroconym kafelkiem na dole. */
.size-row {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.size-opt {
    border: 2px solid var(--line); border-radius: 12px; background: var(--card);
    padding: 14px 10px; text-align: center;
}
.size-opt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-light); }
.size-opt__label { font-size: 15px; font-weight: 700; display: block; }
.size-opt__price { font-size: 14px; color: var(--brand); font-weight: 700; }

/* Lista opcji z checkboxami */
.opt {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 2px; border-bottom: 1px solid var(--line);
    width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0;
    text-align: left;
}
.opt:last-child { border-bottom: none; }
.opt__box {
    flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px;
    border: 2px solid var(--line); display: grid; place-items: center;
    font-size: 15px; color: transparent; background: var(--card);
}
.opt[aria-pressed="true"] .opt__box { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt__label { flex: 1; font-size: 15px; }
.opt__price { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* SKŁADNIKI BAZOWE — logika odwrotna niż przy dodatkach.
   Składnik JEST w pizzy, dopóki klient go nie odznaczy, więc domyślnie
   musi wyglądać na zaznaczony. Pusty kwadracik sugerował, że pizza
   przyjdzie bez niczego, dopóki się czegoś nie dokliknie. */
.opt--remove .opt__box {
    background: var(--ink); border-color: var(--ink); color: #fff;
}
.opt--remove[aria-pressed="true"] .opt__box {
    background: transparent; border-color: var(--line); color: transparent;
}
.opt--remove[aria-pressed="true"] .opt__label {
    text-decoration: line-through; color: var(--ink-faint);
}

/* Składnik nieusuwalny (sos, ser) — zaznaczony, wygaszony, nieklikalny */
.opt--locked { opacity: .5; cursor: default; }
.opt--locked .opt__box {
    background: var(--ink-faint); border-color: var(--ink-faint); color: #fff;
}

/* ---------------------------------------------------------------
   PRZYCISKI
   --------------------------------------------------------------- */
.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 15px 20px; border: none; border-radius: 12px;
    font-size: 16px; font-weight: 700; text-decoration: none;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:active { background: var(--brand-dark); }
.btn--ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn__price { margin-left: auto; font-variant-numeric: tabular-nums; }

.qty { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 18px 0 4px; }
.qty button {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
    background: var(--card); font-size: 22px; line-height: 1;
}
.qty output { font-size: 20px; font-weight: 800; min-width: 32px; text-align: center; }
.qty--inline { justify-content: flex-start; margin: 8px 0 0; gap: 10px; }
.qty--inline button { width: 34px; height: 34px; font-size: 18px; }
.qty--inline output { font-size: 16px; min-width: 24px; }

/* Powiadomienie „dodano do koszyka" — klasa zamiast stylu inline,
   żeby CSP nie musiała dopuszczać atrybutów style. */
#toast {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px;
    background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
    font-size: 14px; font-weight: 600; z-index: 60; opacity: 0;
    transition: opacity .2s; pointer-events: none;
}
#toast[data-show="1"] { opacity: 1; }

/* ---------------------------------------------------------------
   PASEK KOSZYKA
   --------------------------------------------------------------- */
.cart-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 12px 16px calc(12px + var(--safe-bottom));
    background: var(--card); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(28,25,23,.08);
    transform: translateY(120%); transition: transform .22s ease;
}
.cart-bar[data-visible="1"] { transform: translateY(0); }
.cart-bar__inner { max-width: 760px; margin: 0 auto; }

/* ---------------------------------------------------------------
   KOSZYK I FORMULARZ
   --------------------------------------------------------------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.card__title { font-size: 17px; font-weight: 800; margin: 0 0 14px; }

.cart-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: none; }
.cart-item__body { flex: 1; min-width: 0; }
.cart-item__name { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.cart-item__opts { font-size: 13px; color: var(--ink-soft); margin: 0; }
.cart-item__opts .removed { color: var(--brand); }
.cart-item__price { font-weight: 700; white-space: nowrap; }
.cart-item__remove {
    background: none; border: none; color: var(--ink-faint);
    font-size: 13px; padding: 4px 0; text-decoration: underline;
}

.summary-row {
    display: flex; justify-content: space-between; padding: 7px 0; font-size: 15px;
}
.summary-row--total {
    border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px;
    font-size: 19px; font-weight: 800;
}
.summary-row--free { color: var(--green); font-weight: 600; }

/* Formularz */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 13px 14px; font-size: 16px; /* 16px = iOS nie zoomuje */
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--card); color: var(--ink); font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}
.field--error input, .field--error select { border-color: var(--brand); }
.field__error { color: var(--brand); font-size: 13px; margin-top: 4px; }
.field__hint { color: var(--ink-faint); font-size: 13px; margin-top: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Pole-pułapka na boty — niewidoczne dla ludzi, wypełniane przez skrypty */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Przełączniki dostawa/odbiór, metoda płatności */
.choice-row { display: grid; gap: 10px; }
.choice-row--2 { grid-template-columns: 1fr 1fr; }
.choice {
    border: 2px solid var(--line); border-radius: 12px; background: var(--card);
    padding: 14px; text-align: left; display: flex; align-items: center; gap: 12px;
}
.choice[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-light); }
.choice__icon { font-size: 22px; }
.choice__label { font-weight: 700; font-size: 15px; }
.choice__note { font-size: 13px; color: var(--ink-soft); }

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-soft); }
.consent input { margin-top: 3px; width: 20px; height: 20px; flex: 0 0 auto; }

.alert { padding: 13px 15px; border-radius: 10px; font-size: 14.5px; margin-bottom: 14px; }
.alert--error { background: #fef2f2; color: var(--brand-dark); border: 1px solid #fecaca; }
.alert--info  { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert--ok    { background: #ecfdf3; color: var(--green); border: 1px solid #bbf7d0; }

/* ---------------------------------------------------------------
   STATUS ZAMÓWIENIA
   --------------------------------------------------------------- */
.status-hero { text-align: center; padding: 32px 20px 24px; }
.status-hero__code {
    font-size: 13px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--ink-faint);
}
.status-hero__label { font-size: 27px; font-weight: 800; margin: 6px 0 8px; }
.status-hero__note { color: var(--ink-soft); font-size: 15px; margin: 0; }

.steps { display: flex; gap: 6px; margin: 24px 0; }
.step { flex: 1; text-align: center; }
.step__bar { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 7px; }
.step--done .step__bar { background: var(--green); }
.step--current .step__bar { background: var(--brand); }
.step__label { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); }
.step--done .step__label, .step--current .step__label { color: var(--ink); }

/* ---------------------------------------------------------------
   STOPKA
   --------------------------------------------------------------- */
.site-footer {
    margin-top: 40px; padding: 26px 16px calc(90px + var(--safe-bottom));
    border-top: 1px solid var(--line); text-align: center;
    font-size: 13.5px; color: var(--ink-soft); background: var(--card);
}
.site-footer a { color: var(--ink-soft); }

.footer-grid {
    display: grid; gap: 26px; text-align: left;
    max-width: 760px; margin: 0 auto 22px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.footer-col__title {
    font-size: 12px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .08em; color: var(--ink); margin: 0 0 10px;
}
.hours, .facts-list { list-style: none; margin: 0; padding: 0; font-style: normal; }
.hours__row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.hours__row--today { color: var(--ink); font-weight: 700; }
.facts-list li { padding: 2px 0; }
.footer-legal {
    max-width: 640px; margin: 0 auto; font-size: 12.5px;
    color: var(--ink-faint); line-height: 1.55;
}

.empty { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty__icon { font-size: 44px; margin-bottom: 10px; }

/* Baner symulatora płatności — ma krzyczeć, że to nie jest prawdziwa płatność */
.sim-banner {
    display: flex; flex-direction: column; gap: 4px;
    margin: 16px 0; padding: 14px 16px; border-radius: 10px;
    background: repeating-linear-gradient(45deg, #fef3c7, #fef3c7 10px, #fde68a 10px, #fde68a 20px);
    border: 2px solid #d97706; color: #78350f;
}
.sim-banner strong { font-size: 15px; letter-spacing: .04em; }
.sim-banner span { font-size: 13.5px; }

.center { text-align: center; }
.mt-2 { margin-top: 14px; }

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

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}


/* =====================================================================
   DESKTOP
   Do tej pory projekt był wyłącznie mobile-first — na szerokim ekranie
   wszystko zostawało w kolumnie 760 px i wyglądało na zagubione.
   Poniżej: szerszy kontener, menu w dwóch kolumnach, większe zdjęcia.
   ===================================================================== */

@media (min-width: 900px) {

    .wrap, .categories__inner, .footer-grid,
    .site-header__inner { max-width: 1080px; }

    /* --- Nagłówek strony --- */
    .hero { padding: 54px 0 44px; }
    .hero__logo { width: 96px; height: 96px; margin-bottom: 18px; }
    .hero__title { font-size: 42px; max-width: 20ch; }
    .hero__sub { font-size: 17px; margin-top: 8px; }
    .hero__facts { gap: 10px; margin-top: 18px; }
    .hero__facts li { font-size: 14px; padding: 8px 14px; }

    /* --- Menu w dwóch kolumnach --- */
    .section-title { font-size: 28px; margin-top: 44px; }
    .menu-grid {
        display: grid; gap: 14px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
    .product { margin-bottom: 0; height: 100%; padding: 16px; }
    .product:hover { border-color: var(--brand); box-shadow: var(--shadow-lift); }
    .product__photo { width: 104px; height: 104px; }
    .product__name { font-size: 17px; }

    /* --- Koszyk i checkout nie potrzebują całej szerokości --- */
    .checkout-col { max-width: 640px; margin: 0 auto; }

    /* --- Pasek koszyka wyśrodkowany --- */
    .cart-bar__inner { max-width: 640px; }
}

@media (min-width: 1320px) {
    .wrap, .categories__inner, .footer-grid,
    .site-header__inner { max-width: 1240px; }
    .menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero__title { font-size: 46px; }
}

/* Płynne przewijanie do kategorii z uwzględnieniem przyklejonych pasków */
html { scroll-behavior: smooth; }
[data-category-section] { scroll-margin-top: calc(var(--header-h, 57px) + 64px); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
