/* =========================================================================
   Fragmenty paměti — frontend (jednostránkový eshop)
   ========================================================================= */

/* --- Crabath custom font ------------------------------------------------- */
@font-face {
    font-family: 'Crabath Subhead';
    src: url('/assets/fonts/crabathsubhead-semibold-webfont.woff2') format('woff2'),
         url('/assets/fonts/crabathsubhead-semibold-webfont.woff') format('woff');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Crabath Subhead';
    src: url('/assets/fonts/crabathsubhead-book-webfont.woff2') format('woff2'),
         url('/assets/fonts/crabathsubhead-book-webfont.woff') format('woff');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Crabath Small';
    src: url('/assets/fonts/crabathsmall-book-webfont.woff2') format('woff2'),
         url('/assets/fonts/crabathsmall-book-webfont.woff') format('woff');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Crabath Small';
    src: url('/assets/fonts/crabathsmall-semibold-webfont.woff2') format('woff2'),
         url('/assets/fonts/crabathsmall-semibold-webfont.woff') format('woff');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Crabath Small';
    src: url('/assets/fonts/crabathsmall-bookitalic-webfont.woff2') format('woff2'),
         url('/assets/fonts/crabathsmall-bookitalic-webfont.woff') format('woff');
    font-weight: 400; font-style: italic; font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
    --ink: #14110f;
    --muted: #6b635b;
    --line: #e7e2da;
    --paper: #ffffff;
    --paper-2: #f5f2ed;
    --accent: #1c1a17;
    --gold: #9a7b3f;
    --radius: 14px;
    --maxw: 1320px;
    --serif: 'Crabath Subhead', Georgia, 'Times New Roman', serif;
    --body: 'Crabath Small', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
/* plynulé rolování řeší JS (frontend.js) s delším trváním */
body {
    margin: 0;
    font-family: var(--body);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    transition: opacity .25s ease;
    overflow-x: hidden;
}
/* Skryjeme obsah, dokud se nenačtou vlastní fonty (zabrání probliknutí
   systémového fontu). Reveal řeší skript v <head> přes document.fonts.ready
   + pojistný timeout. */
html.fonts-loading body { opacity: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* --- Top bar ------------------------------------------------------------- */
.fe-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 24px; max-width: var(--maxw); margin: 0 auto;
}
.fe-brand { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: .01em; }
.fe-topcta {
    display: inline-flex; align-items: center; line-height: 1;
    font-family: var(--body); font-size: 15px; text-decoration: none;
    border: 1px solid var(--ink); border-radius: 999px; padding: 11px 20px 9px;
    transition: background .2s, color .2s;
}
.fe-topcta:hover { background: var(--ink); color: #fff; }

/* --- Hero ---------------------------------------------------------------- */
.hero { padding: 84px 0 104px; }
.hero-grid {
    display: grid; grid-template-columns: 1fr 1.5fr; gap: 64px; align-items: center;
}
.hero-copy { max-width: 760px; }
/* grid děti se nesmí roztáhnout přes obsah (jinak vzniká horizontální přetečení) */
.hero-grid > * { min-width: 0; }
/* push slider down so the MAIN image lines up with the centre of the left
   column (compensates for the thumbnail row that hangs below it). */
.slider { margin-top: 52px; }
/* Typografie nadpisu dle letáku — verzálky, serif, široký rozestup; platí pro
   všechny varianty (světlou i tmavé). */
.hero-title {
    font-family: var(--serif); font-weight: 600;
    font-size: clamp(36px, 4.7vw, 60px); line-height: 1.08; margin: 0 0 26px;
    letter-spacing: 0.07em; text-transform: uppercase;
}
.hero-text p { margin: 0 0 16px; color: var(--muted); font-size: 18px; }
.hero-actions { margin-top: 32px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero-price { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.hero-price small { display:block; font-family: var(--body); font-size: 13px; color: var(--muted); font-weight: 400; }

/* --- Hero: tmavá varianta ------------------------------------------------ */
.hero-dark {
    background: var(--ink);
    color: #f3efe9;
}
/* tmavé hero – výchozí bílý nadpis (/inverse) */
.hero-dark .hero-title { color: #fbf8f3; }
/* tmavé hero se zlatým „foil" nadpisem (/inverse-gold, /varianta) */
.hero-gold .hero-title {
    /* zlatý „foil" text jako ražba na obálce knihy — světlo posunuté doleva */
    background: linear-gradient(110deg,
        #ebcc9a 0%, #F0DFC4 24%, #d2b081 60%, #d2b081 80%, #F0DFC4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,.45));
}
.hero-dark .hero-text p { color: #c7c1b4; }
/* tmavé hero v barvách tištěného letáku (/inverse-leaflet) — typografie nadpisu
   je společná v .hero-title, zde jen zlaté barvy nadpisu a textu */
.hero-leaflet .hero-title { color: #E6C98A; }
.hero-leaflet .hero-text p { color: #edd49e; font-style: normal; }
.hero-dark .hero-price { color: #fbf8f3; }
.hero-dark .hero-price small { color: #a89f93; }
.hero-dark .btn-cta { background: #fbf8f3; color: var(--ink); }
.hero-dark .btn-cta:hover { background: #fff; }
/* leták se zlatou cenou i CTA tlačítkem (/inverse-leaflet-gold) */
.hero-leaflet-gold .hero-price { color: #E6C98A; }
.hero-leaflet-gold .hero-price small { color: #c9ab73; }
.hero-leaflet-gold .btn-cta { background: #E6C98A; color: var(--ink); }
.hero-leaflet-gold .btn-cta:hover { background: #efd9a3; }
.hero-dark .slider-main { background: #221f1b; box-shadow: 0 30px 70px -30px rgba(0,0,0,.7); }
.hero-dark .slider-thumb { border-color: transparent; }
.hero-dark .slider-thumb.active { border-color: #fbf8f3; }
.hero-dark .slider-nav { background: rgba(0,0,0,.55); color: #fff; }
.hero-dark .slider-nav:hover { background: rgba(0,0,0,.8); }

/* --- Slider -------------------------------------------------------------- */
.slider { position: relative; }
.slider-main {
    position: relative; border-radius: var(--radius); overflow: hidden;
    background: var(--paper-2); aspect-ratio: 1.3 / 1; box-shadow: 0 30px 60px -30px rgba(20,17,15,.35);
    /* vodorovná gesta patří slideru (ne prohlížeči → žádné „zpět") */
    touch-action: pan-y;
    overscroll-behavior-x: contain;
}
.slider-main img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity .5s ease; cursor: zoom-in; }
.slider-main img.active { opacity: 1; }
/* náhledy v jedné řadě s vlastními šipkami (bez viditelného scrollbaru) */
.slider-thumbs-wrap { position: relative; margin-top: 16px; }
.slider-thumbs {
    display: flex; flex-wrap: nowrap; gap: 12px;
    overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
    cursor: grab;
}
.slider-thumbs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.slider-thumbs.dragging { cursor: grabbing; scroll-behavior: auto; user-select: none; }
.slider-thumbs img { -webkit-user-drag: none; user-select: none; pointer-events: none; }

.thumbs-nav {
    position: absolute; top: 0; bottom: 0; width: 38px; z-index: 2;
    border: none; cursor: pointer; display: grid; place-items: center;
    font-size: 22px; color: var(--ink); opacity: 0; transition: opacity .2s ease;
}
.thumbs-nav.prev { left: 0; background: linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,0)); justify-content: start; padding-left: 4px; }
.thumbs-nav.next { right: 0; background: linear-gradient(270deg, rgba(255,255,255,.96), rgba(255,255,255,0)); justify-content: end; padding-right: 4px; }
/* šipky jen když je co posouvat a při najetí myší na pás náhledů */
.slider-thumbs-wrap.has-overflow:hover .thumbs-nav { opacity: 1; }
/* na kraji, kde už není kam scrollovat, šipku skryjeme */
.slider-thumbs-wrap.at-start .thumbs-nav.prev,
.slider-thumbs-wrap.at-end .thumbs-nav.next { opacity: 0 !important; pointer-events: none; }
.hero-dark .thumbs-nav { color: #fff; }
.hero-dark .thumbs-nav.prev { background: linear-gradient(90deg, rgba(20,17,15,.96), rgba(20,17,15,0)); }
.hero-dark .thumbs-nav.next { background: linear-gradient(270deg, rgba(20,17,15,.96), rgba(20,17,15,0)); }
.slider-thumb {
    width: 76px; aspect-ratio: 1 / 1; height: auto; border-radius: 10px; overflow: hidden; cursor: pointer;
    border: 2px solid transparent; opacity: .38; transition: opacity .2s, border-color .2s; padding: 0; background: none; flex: 0 0 auto;
}
.slider-thumb:hover { opacity: .7; }
.slider-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slider-thumb.active { opacity: 1; border-color: var(--ink); }
.slider-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 999px; border: none; cursor: pointer;
    background: rgba(20,17,15,.55); backdrop-filter: blur(4px);
    display: grid; place-items: center; font-size: 20px; color: #fff;
    opacity: 0; transition: opacity .2s ease, background .2s ease;
}
/* zobrazit šipky jen při najetí myší na fotku */
.slider-main:hover .slider-nav { opacity: 1; }
.slider-nav:hover { background: rgba(20,17,15,.8); }
.slider-nav.prev { left: 12px; } .slider-nav.next { right: 12px; }
/* na dotykových zařízeních (bez hoveru) ať jsou šipky vidět */
@media (hover: none) { .slider-nav { opacity: 1; } }
.slider-placeholder { display:grid; place-items:center; height:100%; color:var(--muted); font-style:italic; }

/* --- Buttons ------------------------------------------------------------- */
.btn-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-family: var(--body); font-size: 17px; font-weight: 600; line-height: 1;
    background: var(--ink); color: #fff; border: none; border-radius: 999px;
    padding: 16px 30px 14px; cursor: pointer; text-decoration: none; transition: transform .15s, background .2s;
}
.btn-cta svg { flex: 0 0 auto; }
.btn-cta:hover { transform: translateY(-1px); background: #000; }
.btn-cta:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* --- Order section ------------------------------------------------------- */
.order-section { background: var(--paper-2); border-top: 1px solid var(--line); padding: 72px 0; }
.order-head { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.order-head h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px,3.4vw,40px); margin: 0 0 12px; }
.order-head p { color: var(--muted); margin: 0; }

.order-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; max-width: 1000px; margin: 0 auto; }
@media (max-width: 880px) { .order-grid { grid-template-columns: 1fr; } }

.order-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.order-card h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 18px; font-weight: 600; }
.fieldset-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 14px; }

.fe-field { margin-bottom: 16px; }
.fe-field label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.fe-field input {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
    font-family: var(--body); font-size: 16px; background: #fff; transition: border-color .2s;
}
.fe-field input:focus { outline: none; border-color: var(--ink); }
.fe-field.invalid input { border-color: #c0392b; }
.fe-error { color: #c0392b; font-size: 13px; margin-top: 5px; display: none; }
.fe-field.invalid .fe-error { display: block; }
.fe-row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.fe-check { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; color: var(--ink); margin: 16px 0; cursor: pointer; }
.fe-check input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; margin: 0; flex: 0 0 auto;
    width: 22px; height: 22px; border: 1.5px solid #cfc7bc; border-radius: 6px;
    background: #fff; cursor: pointer; position: relative; transition: background .15s, border-color .15s;
}
.fe-check input[type="checkbox"]:hover { border-color: var(--ink); }
.fe-check input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
.fe-check input[type="checkbox"]:checked::after {
    content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
    border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.fe-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fe-check span { padding-top: 1px; line-height: 1.5; }
#billingFields { display: none; }
#billingFields.show { display: block; }

/* Během odesílání je formulář neaktivní (vizuálně i interakčně) */
.order-grid.is-submitting { opacity: .6; pointer-events: none; }

/* Summary / sidebar */
.order-summary { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; position: sticky; top: 24px; }
.summary-book { display: flex; gap: 14px; margin-bottom: 20px; align-items: center; }
.summary-book img { width: 92px; aspect-ratio: 1 / 1; height: auto; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.summary-book .t { font-family: var(--serif); font-weight: 600; font-size: 17px; text-transform: uppercase; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 40px; height: 42px; border: none; background: #faf8f4; font-size: 20px; cursor: pointer; }
.qty input {
    width: 72px; height: 42px; border: none; text-align: center; font-size: 16px; font-family: var(--body);
    -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.summary-line { display: flex; justify-content: space-between; padding: 9px 0; color: var(--muted); font-size: 15px; line-height: 1.25; }
.summary-total { display: flex; justify-content: space-between; padding: 16px 0 2px; border-top: 1px solid var(--line); margin-top: 8px; font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--ink); line-height: 1.3; }
.summary-vat { text-align: right; font-size: 13px; color: var(--muted); line-height: 1.5; }
.summary-meta { font-size: 13px; color: var(--muted); margin-top: 14px; }
.summary-meta div { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* --- Payment section ----------------------------------------------------- */
.payment-section { display: none; padding: 72px 0; background: var(--paper-2); border-top: 1px solid var(--line); }
.payment-section.show { display: block; }
.payment-card { max-width: 720px; margin: 0 auto; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 44px; }
.payment-badge { width: 64px; height: 64px; border-radius: 999px; background: #eef6ee; color: #2e7d32; display: grid; place-items: center; margin: 0 auto 18px; }
.payment-card h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 10px; }
.payment-card .lead { color: var(--muted); margin: 0 0 28px; }
.payment-grid { display: grid; grid-template-columns: 1fr auto; gap: 30px; text-align: left; align-items: center; }
@media (max-width: 620px) { .payment-grid { grid-template-columns: 1fr; } }
.pay-rows { list-style: none; margin: 0; padding: 0; }
.pay-rows li { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.pay-rows .k { color: var(--muted); font-size: 14px; }
.pay-rows .v { font-weight: 600; }
.pay-qr { text-align: center; }
.pay-qr img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; margin-left: auto; margin-right: auto; }
.pay-qr span { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
.payment-actions { margin-top: 30px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-ghost { border: 1px solid var(--ink); background: #fff; border-radius: 999px; padding: 13px 26px; font-family: var(--body); font-size: 16px; cursor: pointer; text-decoration: none; }
.payment-note { margin-top: 26px; font-size: 14px; color: var(--muted); }

/* --- Footer -------------------------------------------------------------- */
.fe-footer { border-top: 1px solid var(--line); padding: 34px 0; color: var(--muted); font-size: 14px; }
.fe-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.fe-footer a { text-decoration: none; }
.fe-footer a:hover { text-decoration: underline; }

/* --- Typografie spodních sekcí ve stylu letáku --------------------------
   Verzálkové serif nadpisy se širším prostrkáním (řez, rozestup a velikost
   jako titul na letáku) a zlatým akcentem. Na světlém papíru se používá
   tmavší zlatá var(--gold) (#9a7b3f) — u velkých nadpisů drží dostatečný
   kontrast, drobné popisky zůstávají v inkoustu kvůli čitelnosti. */
.order-head h2,
.payment-card h2 {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.1;
}
.order-card h3 {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 17px;
}
.summary-book .t,
.summary-total { letter-spacing: 0.02em; }
.fe-footer { letter-spacing: 0.03em; }

/* --- Responsive ---------------------------------------------------------- */

/* Tablet a níž */
@media (max-width: 980px) {
    .container { padding: 0 20px; }
    .order-grid { gap: 28px; }
    /* souhrn objednávky už není „sticky", aby na úzkých displejích neujížděl */
    .order-summary { position: static; }
}

@media (max-width: 920px) {
    .hero { padding: 72px 0 64px; }
    /* hero kontejner bez vlastního paddingu — galerie pak může být na celou šířku */
    .hero .container { max-width: none; padding: 0; }
    .hero-grid { grid-template-columns: 1fr; gap: 36px; }
    /* textový obsah hero má větší boční padding */
    .hero-copy { max-width: none; padding: 0 32px; }
    /* galerie na celou šířku obrazovky (full-bleed) */
    .slider { margin: 0; max-width: none; width: 100%; }
    .slider-main { aspect-ratio: 1.3 / 1; border-radius: 0; }
    .slider-thumbs { padding: 0 16px; }
    /* na mobilu se naviguje swipem/tapem — šipky pryč (hlavní foto i náhledy) */
    .slider-nav, .thumbs-nav { display: none !important; }
    .order-section, .payment-section { padding: 52px 0; }
}

/* Menší tablety / velké mobily */
@media (max-width: 680px) {
    body { font-size: 16px; }
    .container { padding: 0 16px; }
    .hero { padding: 60px 0 48px; }
    .hero-copy { padding: 0 24px; }
    .hero-text p { font-size: 16px; }
    .order-card, .order-summary { padding: 22px 18px; }
    .order-head { margin-bottom: 32px; }
    .payment-card { padding: 30px 20px; }
    .payment-grid { gap: 22px; }
    .pay-qr img { width: 180px; height: 180px; }
    /* dvousloupcová pole (Město/PSČ, E-mail/Telefon) na jeden sloupec */
    .fe-row-2 { grid-template-columns: 1fr; gap: 0; }
}

/* Malé mobily */
@media (max-width: 420px) {
    .hero-actions { gap: 14px; }
    .hero-price { font-size: 22px; }
    .btn-cta { width: 100%; }
    .qty { width: 100%; }
    .qty input { flex: 1; width: auto; }
    .payment-actions { flex-direction: column; }
    .payment-actions .btn-cta, .payment-actions .btn-ghost { width: 100%; justify-content: center; }
}

/* --- Lightbox ------------------------------------------------------------ */
.lightbox {
    position: fixed; inset: 0; z-index: 1000; display: none;
    align-items: center; justify-content: center;
    background: rgba(16,14,12,.92); padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox-img {
    max-width: min(96vw, 1600px); max-height: 94vh; object-fit: contain;
    border-radius: 8px; box-shadow: 0 20px 80px rgba(0,0,0,.5);
}
.lightbox-close {
    position: absolute; top: 18px; right: 24px; width: 48px; height: 48px;
    border: none; background: none; color: #fff; font-size: 38px; line-height: 1; cursor: pointer;
}
.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 56px; height: 56px; border-radius: 999px; border: none; cursor: pointer;
    background: rgba(255,255,255,.12); color: #fff; font-size: 28px; display: grid; place-items: center;
    transition: background .2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,.25); }
.lightbox-nav.prev { left: 20px; } .lightbox-nav.next { right: 20px; }
@media (max-width: 620px) { .lightbox-nav { width: 44px; height: 44px; } }

/* --- Static page --------------------------------------------------------- */
.page-wrap { max-width: 760px; margin: 60px auto; padding: 0 24px; }
.page-wrap h1 { font-family: var(--serif); font-weight: 600; }

/* toast for inline form error */
.form-banner { display:none; background:#fdecea; color:#9b2c1f; border:1px solid #f5c6c0; border-radius:10px; padding:12px 16px; margin-bottom:18px; font-size:15px; line-height:1.35; }
.form-banner.show { display:flex; align-items:center; }
