/**
 * Stránka produktu (návrh docs/design/produkt.html, tokeny docs/design/TOKENY.md).
 * Rozvržení podle šířky obsahu (container queries): široký obsah = text vlevo, galerie vpravo;
 * užší než 780 px = pod sebou a lepicí lišta s cenou dole.
 */

.ed-product-layout {
    display: grid;
    grid-template-columns: var(--ed-sidebar, 248px) minmax(0, 1fr);
    gap: 24px;
    width: 100%;
    max-width: var(--epicdecks-site-width, 1400px);
    margin: 0 auto;
    padding: 4px 20px 48px;
    box-sizing: border-box;
}

.ed-product-layout .epicdecks-archive-sidebar {
    position: sticky;
    top: calc(var(--ed-masthead-h, 121px) + var(--wp-admin--admin-bar--height, 0px) + 20px);
    align-self: start;
}

@media (max-width: 860px) {
    .ed-product-layout { grid-template-columns: minmax(0, 1fr); padding: 4px 14px 32px; }
    .ed-product-layout .epicdecks-archive-sidebar { display: none; }
}

.ed-product-main {
    container: ed-product / inline-size;
    min-width: 0;
}

/* ── Rozvržení článku ─────────────────────────────────────────────────── */
.ed-prod {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "gal" "body";
    gap: 16px;
    color: var(--ed-text, #111827);
    font-family: var(--ed-font, "Segoe UI", system-ui, sans-serif);
}

.ed-prod__head { grid-area: head; min-width: 0; }
.ed-prod__gal { grid-area: gal; min-width: 0; display: grid; gap: 14px; align-content: start; }
.ed-prod__body { grid-area: body; min-width: 0; display: grid; gap: 14px; align-content: start; }

@container ed-product (min-width: 780px) {
    .ed-prod {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 44%);
        grid-template-areas: "head gal" "body gal";
        grid-template-rows: auto 1fr;
        column-gap: 28px;
        row-gap: 16px;
    }
    .ed-prod__gal {
        position: sticky;
        top: calc(var(--ed-masthead-h, 121px) + var(--wp-admin--admin-bar--height, 0px) + 16px);
        align-self: start;
    }
}

/* ── Hlavička ─────────────────────────────────────────────────────────── */
.ed-prod__title {
    margin: 0 0 6px;
    font-size: clamp(22px, 4.2cqi, 32px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.015em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.ed-prod__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin: 0;
    font-size: var(--ed-fs-sm, 12.5px);
    color: var(--ed-muted, #6b7280);
}

.ed-stock { font-weight: 700; }
.ed-stock--in { color: var(--ed-success, #059669); }
.ed-stock--backorder { color: var(--ed-warning, #d97706); }
.ed-stock--out { color: var(--ed-danger, #dc2626); }
.ed-prod__code b { color: var(--ed-text-2, #374151); }

/* ── Galerie ─────────────────────────────────────────────────────────── */
.ed-gal {
    background: var(--ed-surface, #fff);
    border-radius: var(--ed-radius-lg, 16px);
    box-shadow: var(--ed-shadow-card, 0 1px 3px rgba(0,0,0,.06));
    padding: 12px;
    display: grid;
    gap: 10px;
}

.ed-gal__main {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: var(--ed-surface-2, #f9fafb);
    border-radius: var(--ed-radius, 12px);
    cursor: zoom-in;
    overflow: hidden;
}

.ed-gal__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.ed-gal__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    padding: 4px 9px;
    border-radius: var(--ed-radius-xs, 6px);
    background: var(--ed-danger, #dc2626);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.ed-gal__thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
}

.ed-gal__thumb {
    padding: 3px;
    border: 2px solid transparent;
    border-radius: var(--ed-radius-sm, 8px);
    background: var(--ed-surface-2, #f9fafb);
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.ed-gal__thumb[aria-pressed="true"] { border-color: var(--ed-brand, #3BC1F4); }
.ed-gal__thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ── Výhody ─────────────────────────────────────────────────────────── */
.ed-perks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.ed-perks__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ed-surface, #fff);
    border: 1px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-radius, 12px);
    font-size: 13px;
    color: var(--ed-text-2, #374151);
}

.ed-perks__item strong { color: var(--ed-text, #111827); }

.ed-perks__icon {
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border-radius: 50%;
    background: var(--ed-brand-soft, #e8f8fe);
}

.ed-perks__icon svg { width: 16px; height: 16px; }

/* ── Boxy (popis, varianty) ─────────────────────────────────────────── */
.ed-box {
    background: var(--ed-surface, #fff);
    border: 1px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-radius, 12px);
    padding: 14px 16px;
    min-width: 0;
}

.ed-box__title {
    margin: 0 0 8px;
    font-size: var(--ed-fs-xs, 11px);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ed-muted, #6b7280);
}

.ed-desc { font-size: 14px; line-height: 1.6; color: var(--ed-text-2, #374151); overflow-wrap: anywhere; }
.ed-desc p { margin: 0 0 .7em; }
.ed-desc p:last-child { margin-bottom: 0; }
.ed-desc img { max-width: 100%; height: auto; }
.ed-desc__long.is-collapsed { display: none; }
.ed-desc__long.is-clamped { max-height: 11em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.ed-desc__long.is-open { display: block; max-height: none; -webkit-mask-image: none; mask-image: none; }

.ed-link-btn {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ed-brand-ink, #0a6a90);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.ed-opts { display: flex; flex-wrap: wrap; gap: 8px; }

.ed-opt {
    min-height: 38px;
    padding: 0 14px;
    border: 1.5px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-pill, 50px);
    background: var(--ed-surface, #fff);
    color: var(--ed-text-2, #374151);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}

.ed-opt:hover:not(:disabled) { border-color: var(--ed-brand, #3BC1F4); }
.ed-opt[aria-pressed="true"] { border-color: var(--ed-brand, #3BC1F4); background: var(--ed-brand-soft, #e8f8fe); color: var(--ed-brand-ink, #0a6a90); }
.ed-opt:disabled { color: var(--ed-faint, #9ca3af); text-decoration: line-through; cursor: not-allowed; background: var(--ed-surface-2, #f9fafb); }

/* ── Nákup ──────────────────────────────────────────────────────────── */
.ed-buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--ed-surface, #fff);
    border: 1px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-radius-lg, 16px);
    box-shadow: var(--ed-shadow-card, 0 1px 3px rgba(0,0,0,.06));
}

.ed-buy__price {
    flex: 0 0 auto;
    margin-right: 4px;
    white-space: nowrap;
    font-size: clamp(24px, 4cqi, 30px);
    font-weight: 800;
    color: var(--ed-text, #111827);
}

.ed-buy__price del { margin-right: 8px; font-size: .55em; font-weight: 500; color: var(--ed-faint, #9ca3af); }
.ed-buy__price ins { text-decoration: none; color: var(--ed-danger, #dc2626); }

.ed-qty {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 50px;
    padding: 4px;
    box-sizing: border-box;
    border: 1px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-radius, 12px);
    background: var(--ed-surface-2, #f9fafb);
}

.ed-qty__btn {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 0;
    height: 40px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--ed-radius-sm, 8px);
    background: var(--ed-surface, #fff);
    box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
    color: var(--ed-text-2, #374151);
    line-height: 0;
    cursor: pointer;
    transition: background-color var(--ed-ease, .18s ease), color var(--ed-ease, .18s ease);
}

.ed-qty__btn:hover { background: var(--ed-brand, #3BC1F4); color: #fff; }
.ed-qty__btn:focus-visible { outline: 2px solid var(--ed-brand, #3BC1F4); outline-offset: 2px; }
.ed-qty__btn svg { display: block; }

.ed-qty__input {
    width: 44px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ed-text, #111827);
    -moz-appearance: textfield;
}

.ed-qty__input:focus { outline: none; }

.ed-qty__input::-webkit-outer-spin-button,
.ed-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 26px;
    border: 0;
    border-radius: var(--ed-pill, 50px);
    background: var(--ed-brand, #3BC1F4);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: transform var(--ed-ease, .18s ease), box-shadow var(--ed-ease, .18s ease);
}

.ed-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--ed-shadow-btn, 0 6px 16px rgba(59,193,244,.35)); }
.ed-btn:disabled { background: var(--ed-disabled, #d1d5db); color: var(--ed-disabled-text, #6b7280); cursor: not-allowed; }
.ed-btn.is-done { background: var(--ed-success-soft, #ecfdf5); color: #047857; box-shadow: none; }
.ed-buy__add { flex: 1 1 150px; }

/* Úzký obsah (mobil): cena vlevo, počet vpravo, tlačítko přes celou šířku pod nimi. */
@container ed-product (max-width: 560px) {
    .ed-buy { flex-wrap: wrap; }
    .ed-buy__price { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.1; }
    .ed-buy__price del { display: block; margin: 0 0 2px; }
    .ed-qty { margin-left: auto; }
    .ed-buy__add { flex: 1 1 100%; }
}

.ed-buy__msg { flex: 1 1 100%; margin: 0; font-size: 13px; color: var(--ed-danger, #dc2626); }

/* ── Sada a série ─────────────────────────────────────────────────── */
.ed-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    background: var(--ed-surface, #fff);
    border: 1px solid var(--ed-line, #e5e7eb);
    border-radius: var(--ed-radius, 12px);
    overflow: hidden;
}

.ed-specs > div { padding: 12px 16px; min-width: 0; }
.ed-specs > div + div { border-left: 1px solid var(--ed-line-soft, #f0f2f5); }
.ed-specs > div:only-child { grid-column: 1 / -1; }
.ed-specs dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ed-muted, #6b7280); }
.ed-specs dd { margin: 2px 0 0; font-weight: 600; color: var(--ed-text, #111827); overflow-wrap: anywhere; }
.ed-specs a { color: inherit; text-decoration: none; }
.ed-specs a:hover { color: var(--ed-brand-ink, #0a6a90); text-decoration: underline; }

/* ── Další z kategorie ──────────────────────────────────────────────── */
.ed-related { margin-top: 32px; }
.ed-related__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 12px;
}

.ed-related__link { color: var(--ed-brand, #3BC1F4); font-weight: 700; font-size: 13.5px; text-decoration: none; }
.ed-related__link:hover { color: var(--ed-brand-hover, #2aa5d1); text-decoration: underline; }

.ed-related__title { margin: 0; font-size: var(--ed-fs-lg, 18px); font-weight: 800; color: var(--ed-text, #111827); }

/* ── Galerie přes celou obrazovku ───────────────────────────────────── */
.ed-zoom {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(8, 11, 16, .94);
    color: #fff;
    box-shadow: none;
    overflow: hidden;
}

.ed-zoom[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.ed-zoom::backdrop { background: transparent; }

.ed-zoom__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.ed-zoom__count { font-size: 14px; opacity: .8; font-variant-numeric: tabular-nums; }

.ed-zoom__btn {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    min-width: 0;
    height: 44px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    line-height: 0;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
}

.ed-zoom__btn:hover { background: rgba(255, 255, 255, .26); }
.ed-zoom__btn svg { display: block; flex: 0 0 auto; }
.ed-zoom__btn:focus-visible { outline: 2px solid var(--ed-brand, #3BC1F4); outline-offset: 2px; }

.ed-zoom__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 72px 24px;
}

.ed-zoom__stage img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--ed-radius, 12px);
    background: #fff;
    user-select: none;
}

.ed-zoom__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.ed-zoom__nav--prev { left: 16px; }
.ed-zoom__nav--next { right: 16px; }
.ed-zoom__nav[hidden] { display: none; }

@media (max-width: 600px) {
    .ed-zoom__stage { padding: 0 8px 76px; }
    .ed-zoom__nav { top: auto; bottom: 16px; transform: none; }
    .ed-zoom__nav--prev { left: calc(50% - 56px); }
    .ed-zoom__nav--next { right: calc(50% - 56px); }
}

@media (prefers-reduced-motion: reduce) {
    .ed-btn, .ed-btn:hover { transition: none; transform: none; }
}

/* Dárkový poukaz – náhled místo galerie a formulář pro obdarovaného */
.ed-voucher-preview { width: 100%; }
.ed-voucher-form { display: grid; gap: 10px; }
.ed-voucher-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ed-text, #111827); }
.ed-voucher-form label small { font-weight: 400; color: var(--ed-muted, #6b7280); }
.ed-voucher-form input, .ed-voucher-form textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--ed-line, #e5e7eb); border-radius: 8px; font: inherit; font-weight: 400; background: #fff; }
.ed-voucher-form input:focus, .ed-voucher-form textarea:focus { outline: 2px solid var(--ed-brand, #3BC1F4); outline-offset: 1px; border-color: var(--ed-brand, #3BC1F4); }
.ed-voucher-form__note { margin: 0; font-size: 13px; color: var(--ed-muted, #6b7280); }
