/* ============================================================
   PRODUCT PAGE — figurydeco.pl mockup detail layout.
   Mockup section: styles.css lines ~1604-2050.
   Page deferred-loaded by layouts/default.inc.php.
   Selectors preserved for SEO/Speakable contracts:
     .pd-title, .pd-subtitle, .pd-price-block__value (sec 2.5 — Speakable)
   ============================================================ */

.product__page { padding: 12px 0 60px; } /* scope to product-detail wrapper only — bare .product also matches listing cards (.product.prod) and was injecting 60px bottom padding into every card */
.product__grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 60px;
    align-items: start;
}

/* =============== GALLERY =============== */
.gallery {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 14px;
    position: sticky;
    top: 100px;
}
/* pionowy nawigator miniatur: strzałki góra/dół + płynne przewijanie, zero pasków, zero scrolla w poziomie */
.gallery__rail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    max-height: 700px;                  /* JS dosynchronizuje do wysokości głównego zdjęcia */
}
.gallery__thumbs {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;                 /* twardo: brak przewijania prawo/lewo */
    scrollbar-width: none;              /* Firefox — bez paska */
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top, 0px), #000 calc(100% - var(--fade-bottom, 0px)), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top, 0px), #000 calc(100% - var(--fade-bottom, 0px)), transparent 100%);
}
.gallery__thumbs::-webkit-scrollbar { width: 0; height: 0; display: none; }  /* Chrome/Safari — bez paska */
.gallery__rail.has-top    { --fade-top: 24px; }       /* miękkie wygaszenie górnej krawędzi gdy jest co przewijać w górę */
.gallery__rail.has-bottom { --fade-bottom: 24px; }    /* ...i dolnej */

.gallery__nav {
    flex: 0 0 auto;
    width: 100%;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
}
.gallery__nav svg { display: block; }
.gallery__nav:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.gallery__nav:active { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.gallery__nav:disabled { opacity: .3; cursor: default; background: var(--bg-soft); color: var(--muted); border-color: var(--line); }
.gallery__nav[hidden] { display: none; }

/* komunikat „dodano do koszyka" — pod przyciskiem (zamiast banera na górze) */
.pd-cart-msg {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    animation: pdCartMsgIn .28s ease;
}
.pd-cart-msg:empty { display: none; }                  /* niewidoczny dopóki brak komunikatu */
.pd-cart-msg--ok { background: var(--accent-soft); color: var(--accent-dark); border-left: 3px solid var(--accent); }
.pd-cart-msg--err { background: #fcebea; color: #b3261e; border-left: 3px solid #d93025; }
.pd-cart-msg a { color: var(--accent-dark); font-weight: 600; text-decoration: underline; }
.pd-cart-msg--err a { color: #b3261e; }
@keyframes pdCartMsgIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.pd-btn-cart.is-loading { opacity: .7; pointer-events: none; }

.thumb,
.pd-thumb {
    width: 88px;
    height: 88px;
    flex-shrink: 0; /* nie ściskaj miniatur w kolumnie flex — trzymaj kwadrat 88x88, nadmiar idzie w scroll */
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    background: var(--bg-soft);
    transition: border-color var(--transition);
    display: block;
}
.thumb img,
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover,
.pd-thumb:hover { border-color: var(--ink-3); }
.thumb.is-active,
.pd-thumb.is-active { border-color: var(--ink); border-width: 2px; }

.gallery__main,
.pd-main-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: zoom-in;
    display: block;
}
.gallery__main img,
.pd-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s, opacity .2s;
}

.gallery__badges {
    position: absolute;
    top: 18px;
    left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}
.gallery__zoom {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    color: var(--ink);
    display: grid;
    place-items: center;
    z-index: 2;
    transition: all var(--transition);
    border: 0;
    cursor: zoom-in;
}
.gallery__zoom:hover { background: #fff; transform: scale(1.05); }

/* =============== PRODUCT INFO =============== */
.prodx { padding: 4px 0; }

.prodx__cat {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-dark);
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

/* .prodx__title carries .pd-title — Speakable contract */
.prodx__title,
.pd-title {
    font-family: var(--serif);
    font-size: clamp(28px, 3.4vw, 42px);
    font-weight: 500;
    line-height: 1.1;
    color: var(--ink);
    margin: 0 0 16px;
}

.prodx__rating {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-2);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.prodx__rating-num { font-weight: 600; color: var(--ink); }
.prodx__rating-count {
    text-decoration: underline;
    text-underline-offset: 3px;
    color: var(--ink-2);
}
.prodx__rating-count:hover { color: var(--accent-dark); opacity: 1; }
.prodx__sku { color: var(--ink-3); margin-left: auto; font-size: 12px; letter-spacing: 0.08em; }

/* Price block — preserves .pd-price-block__value (Speakable contract) */
.prodx__price,
.pd-price-block {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.pd-price-block__value {
    display: inline-flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.prodx__price-old,
.pd-price-block__old {
    font-size: 18px;
    color: var(--ink-3);
    text-decoration: line-through;
}
.prodx__price-old del { text-decoration: none; } /* outer span carries line-through */

.prodx__price-now {
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 600;
    color: var(--ink);
}
.prodx__price-save {
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
.pd-price-block__tax {
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    align-self: flex-end;
    padding-bottom: 4px;
}

.prodx__price-meta {
    font-size: 13px;
    color: var(--ink-2);
    margin: 8px 0 24px;
}
.prodx__price-meta strong { color: var(--ink); font-weight: 600; }

/* .prodx__lead carries .pd-subtitle — Speakable contract */
.prodx__lead,
.pd-subtitle {
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink-2);
    margin: 0 0 28px;
}

/* =============== OPTIONS (LiteCart server-rendered, mockup-styled) =============== */
.prodx__options { margin: 0 0 24px; }
.opt { margin-bottom: 22px; }
.opt__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.opt__label {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    font-weight: 600;
}
.opt__list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.opt__values label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition);
    margin: 0 6px 6px 0;
}
.opt__values label:hover { border-color: var(--ink); }
.opt__values input[type="radio"],
.opt__values input[type="checkbox"] { margin-right: 4px; accent-color: var(--accent); }
.opt__values select {
    padding: 12px 36px 12px 16px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: var(--ink);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none' stroke='%23333' stroke-width='2'><path d='M2 4l4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.opt__values select:hover { border-color: var(--ink); }
.opt__values input[type="text"],
.opt__values input[type="number"],
.opt__values textarea {
    padding: 10px 14px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    font-size: 14px;
    color: var(--ink);
    font-family: inherit;
    width: 100%;
    max-width: 320px;
}

/* =============== AVAILABILITY =============== */
.prodx__avail {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--accent-soft);
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink);
    margin: 22px 0 24px;
    flex-wrap: wrap;
}
.prodx__avail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(147,173,63,.2);
}
.prodx__avail--ok .prodx__avail-dot { animation: pulse 2s ease-in-out infinite; }
.prodx__avail--low .prodx__avail-dot { background: var(--terracotta); box-shadow: 0 0 0 4px rgba(176,138,74,.2); }
.prodx__avail--oos { background: rgba(208,72,72,.08); }
.prodx__avail--oos .prodx__avail-dot { background: #d04848; box-shadow: 0 0 0 4px rgba(208,72,72,.2); animation: none; }
.prodx__avail-meta { color: var(--ink-3); }
@keyframes pulse {
    0%,100% { box-shadow: 0 0 0 4px rgba(147,173,63,.15); }
    50%     { box-shadow: 0 0 0 8px rgba(147,173,63,.05); }
}

/* =============== BUY ROW (qty + add to cart) =============== */
.prodx__buy-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    margin-bottom: 14px;
    align-items: stretch;
}
.qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    height: 56px;
    overflow: hidden;
}
.qty__btn {
    width: 44px;
    height: 100%;
    font-size: 18px;
    color: var(--ink);
    transition: background var(--transition);
    border: 0;
    background: none;
    cursor: pointer;
}
.qty__btn:hover { background: var(--bg-soft); }
.qty__input {
    width: 44px;
    height: 100%;
    border: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
    outline: none;
    color: var(--ink);
    appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty__unit { padding: 0 14px; color: var(--ink-3); font-size: 13px; }

.prodx__add-cart {
    height: 56px;
    padding: 0 28px;
    justify-content: center;
}

/* =============== WISHLIST (w wierszu zakupu, za przyciskiem koszyka) =============== */
.prodx__wishlist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    padding: 0 20px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.prodx__wishlist:hover { border-color: var(--ink); }
/* w wierszu zakupu: kształt jak „Dodaj do koszyka" (prostokąt), nie pigułka */
.prodx__buy-row .prodx__wishlist { border-radius: var(--radius); }
.prodx__wishlist.is-active,
.prodx__wishlist[data-in-wishlist="1"] {
    color: var(--terracotta);
    border-color: var(--terracotta);
}
.prodx__wishlist svg { transition: fill var(--transition); }
.prodx__wishlist.is-active svg,
.prodx__wishlist[data-in-wishlist="1"] svg { fill: var(--terracotta); }

/* =============== DOSTAWA + PŁATNOŚCI (sekcje serwisowe na karcie) =============== */
.prodx__service {
    display: grid;
    gap: 14px;
    padding: 20px 0 4px;
    margin: 14px 0 4px;
    border-top: 1px solid var(--line);
}
.pservice {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px 18px;
    align-items: start;
}
.pservice__head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    padding-top: 3px;
}
.pservice__head svg { color: var(--accent-dark, var(--accent)); flex-shrink: 0; }
.pservice__list { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.pservice__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    font-size: 14px;
    color: var(--ink-2);
    padding-bottom: 7px;
    border-bottom: 1px dashed var(--line);
}
.pservice__item:last-child { border-bottom: 0; padding-bottom: 0; }
.pservice__name { color: var(--ink); }
.pservice__cost { font-weight: 600; color: var(--ink); white-space: nowrap; }
.pservice__item--free .pservice__name,
.pservice__cost--free { color: var(--accent-dark, var(--accent)); }

.paylogos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paylogo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.02em;
}
.paylogo svg { display: block; }
.paylogo--payu .paylogo__u { color: #5aa700; }
.paylogo--blik { text-transform: lowercase; letter-spacing: 0.06em; color: #111; }
.paylogo--visa { color: #1a1f71; font-style: italic; letter-spacing: 0.08em; }
.paylogo--mc { padding: 0 9px; }
.paylogo--cod { font-weight: 600; color: var(--ink-2); }
.paylogo--cod svg { color: var(--accent-dark, var(--accent)); }

/* =============== OOS NOTICE + back-in-stock subscribe =============== */
.out-of-stock-notice,
.prodx__oos {
    background: rgba(208,72,72,.06);
    border: 1px solid rgba(208,72,72,.2);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin: 18px 0;
}
.out-of-stock-notice p { margin: 0 0 12px; color: var(--ink); font-size: 14px; line-height: 1.5; }

/* =============== STOCK NOTICE (options-driven) =============== */
.stock-notice:empty { display: none; }
.stock-notice {
    margin: 8px 0;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink-2);
    background: var(--bg-soft);
}
.stock-notice.warning { background: rgba(208,72,72,.08); color: #b53b3b; }
.stock-notice.notice  { background: var(--accent-soft); color: var(--accent-dark); }

/* =============== TABS (description / spec / shipping) =============== */
.prod-tabs { padding: 60px 0; background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tabs--full {
    display: flex;
    gap: 4px;
    background: #fff;
    padding: 4px;
    border-radius: 999px;
    margin: 0 auto 32px;
    width: fit-content;
    flex-wrap: wrap;
    justify-content: center;
}
.tabs--full .tabs__btn { font-size: 12px; padding: 10px 22px; }
.tabs__panel { display: none; max-width: 880px; margin: 0 auto; }
.tabs__panel.is-active { display: block; animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.prod-tabs__content { font-size: 16px; line-height: 1.75; color: var(--ink-2); }
.prod-tabs__content p { margin: 0 0 18px; }
.prod-tabs__content p strong { color: var(--ink); font-weight: 600; }
.prod-tabs__content h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--ink); margin: 28px 0 12px; }
.prod-tabs__content ul { margin: 0 0 18px; padding-left: 0; }
.prod-tabs__content ul li { padding: 8px 0 8px 24px; position: relative; font-size: 15px; line-height: 1.5; color: var(--ink-2); list-style: none; }
.prod-tabs__content ul li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.spec-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.spec-table th, .spec-table td {
    padding: 14px 22px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
}
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table th {
    font-weight: 600;
    color: var(--ink);
    background: var(--bg-soft);
    width: 240px;
}
.spec-table td { color: var(--ink-2); }

/* =============== Description body (legacy class) =============== */
.description { font-size: 16px; line-height: 1.75; color: var(--ink-2); }
.description p { margin: 0 0 18px; }
.description h2, .description h3 { font-family: var(--serif); color: var(--ink); margin: 24px 0 12px; }

/* =============== RESPONSIVE =============== */
@media (max-width: 1024px) {
    .product__grid { grid-template-columns: 1fr; gap: 36px; }
    .gallery { position: static; grid-template-columns: 1fr; }
    .gallery__rail { order: 2; flex-direction: row; gap: 0; max-height: none; min-height: 0; }
    .gallery__nav { display: none; }                    /* mobile: poziomy rząd + swipe, bez strzałek */
    .gallery__thumbs {
        flex-direction: row;
        max-height: none;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-mask-image: none;
                mask-image: none;
    }
    .pd-thumb, .thumb { width: 72px; height: 72px; flex-shrink: 0; }
    .gallery__main, .pd-main-image { order: 1; }
}
@media (max-width: 720px) {
    .product__page { padding: 0 0 40px; }
    .prodx__title, .pd-title { font-size: 26px; }
    .prodx__price-now { font-size: 28px; }
    .prodx__buy-row { grid-template-columns: 1fr; }
    .qty { width: fit-content; }
    .prodx__add-cart { width: 100%; }
    .prodx__wishlist { width: 100%; }
    .pservice { grid-template-columns: 1fr; gap: 6px; }
    .tabs--full { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .tabs--full::-webkit-scrollbar { display: none; }
    .tabs--full .tabs__btn { flex-shrink: 0; }
    .spec-table th { width: auto; }
}

/* ============== RELATED / RECENT sections (mockup `produkt.html`) ============== */
.related, .recent { padding: 80px 0; }
.recent { background: var(--bg-soft); border-top: 1px solid var(--line); }

/* ============== RELATED CAROUSEL (mockup `produkt.html` .related .carousel) ============== */
.section-head--row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    text-align: left;
    flex-wrap: wrap;
    gap: 20px;
}
.section-head--row .eyebrow { margin-bottom: 8px; }

.carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    scrollbar-width: thin;
}
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-track { background: var(--line); border-radius: 999px; }
.carousel::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 999px; }
.carousel > .prod {
    flex: 0 0 calc((100% - 80px) / 5);
    scroll-snap-align: start;
}
@media (max-width: 1280px) { .carousel > .prod { flex-basis: calc((100% - 60px) / 4); } }
@media (max-width: 1024px) { .carousel > .prod { flex-basis: calc((100% - 40px) / 3); } }
@media (max-width: 720px)  { .carousel > .prod { flex-basis: calc((100% - 20px) / 2); } }

.carousel__nav { display: flex; gap: 8px; }
.carousel__btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: #fff;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all .2s;
}
.carousel__btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
