/* ════════════════════════════════════════════════════════════════════
   KABEX — hero.css
   Sekcja: HERO BENTO (3 banery: 1 duży + 2 mniejsze)

   Struktura:
   1. Grid layout (bento 60/40)
   2. Item (banner) — wspólne style
   3. Background image + overlay
   4. Content (label, headline, subline, button, badge, countdown)
   5. Warianty: big / small
   6. Responsive
   ════════════════════════════════════════════════════════════════════ */

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ 1. GRID LAYOUT (bento 60/40)                                     ║
   ╚══════════════════════════════════════════════════════════════════╝ */
.hero-bento {
    padding-block: var(--sp-6);
}
.hero-bento__grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--sp-4);
    min-height: 380px;
}
.hero-bento__right {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: var(--sp-4);
    min-height: 380px;
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ 2. ITEM (banner)                                                 ║
   ╚══════════════════════════════════════════════════════════════════╝ */
.hero-bento__item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--r-lg);                 /* 12px */
    text-decoration: none;
    isolation: isolate;
    transition: transform var(--t-base), box-shadow var(--t-base);
}
.hero-bento__item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Wariant big (lewy duży) */
.hero-bento__item--big {
    min-height: 380px;
}

/* Wariant small (prawy stack) — wyższy, żeby grafika nie była zbyt przycięta */
.hero-bento__item--small {
    min-height: 220px;
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ 3. BACKGROUND IMAGE + OVERLAY                                    ║
   ╚══════════════════════════════════════════════════════════════════╝ */
.hero-bento__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.hero-bento__bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;          /* górna część zdjęcia (subject) widoczna */
    display: block;
    transition: transform var(--t-slow);
}

/* Małe banery — pokazujemy więcej środka i lekko wyżej (produkty pionowe) */
.hero-bento__item--small .hero-bento__bg-img {
    object-position: center 40%;
}

/* Placeholder (gdy klient jeszcze nie wgrał zdjęcia) */
.hero-bento__bg--placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    position: relative;
}

/* Gradient per pozycja (każdy banner inny tone) */
.hero-bento__bg--pos-1 {
    background:
        radial-gradient(ellipse at top right, rgba(245, 211, 46, 0.15) 0%, transparent 60%),
        linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 70%, var(--color-primary-light) 100%);
}
.hero-bento__bg--pos-2 {
    background:
        radial-gradient(ellipse at bottom left, rgba(230, 57, 70, 0.2) 0%, transparent 70%),
        linear-gradient(135deg, var(--color-dark) 0%, #2a3a52 100%);
}
.hero-bento__bg--pos-3 {
    background:
        radial-gradient(ellipse at top left, rgba(30, 91, 168, 0.3) 0%, transparent 70%),
        linear-gradient(135deg, #1f2d44 0%, #3a4d6e 100%);
}

/* Subtelne pattern lines (industrial feel) na placeholderach */
.hero-bento__bg--placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(45deg,
            transparent 0,
            transparent 24px,
            rgba(255, 255, 255, 0.03) 24px,
            rgba(255, 255, 255, 0.03) 25px
        );
    pointer-events: none;
}

.hero-bento__bg-icon {
    color: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--t-slow);
}
.hero-bento__bg-icon svg {
    color: inherit;
}
.hero-bento__item:hover .hero-bento__bg-icon {
    transform: scale(1.05);
    color: rgba(255, 255, 255, 0.28);
}

/* ── Admin hint na placeholderze (tylko dla zalogowanych z edit_pages) ── */
.hero-bento__admin-hint {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 1px dashed rgba(255, 255, 255, 0.4);
    border-radius: var(--r-md);
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

/* ── Admin notice pod sekcją (tylko zalogowani) ─────────────────── */
.hero-bento__admin-notice {
    margin-top: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    background: var(--color-accent-tint);
    border: 1px dashed var(--color-accent-dark);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    font-size: var(--fs-sm);
    color: var(--color-dark);
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
}
.hero-bento__admin-notice-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.hero-bento__admin-notice-text {
    flex: 1;
    min-width: 240px;
}
.hero-bento__admin-notice-link {
    display: inline-block;
    padding: var(--sp-2) var(--sp-4);
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
}
.hero-bento__admin-notice-link:hover {
    background: var(--color-primary-dark);
    color: #fff;
}
.hero-bento__item:hover .hero-bento__bg-img {
    transform: scale(1.04);
}

/* Overlay (gradient bottom — czytelność tekstu nawet bez przyciemnienia całego zdjęcia) */
.hero-bento__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(to top, rgba(20, 30, 50, 0.7) 0%, rgba(20, 30, 50, 0) 60%),
        rgba(20, 30, 50, calc(var(--hero-overlay, 25%) / 100));
}

/* Dla wariantu jasnego (text-dark) overlay jest delikatniejszy */
.hero-bento__item--text-dark .hero-bento__overlay {
    background:
        linear-gradient(to top, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 60%),
        rgba(255, 255, 255, calc(var(--hero-overlay, 25%) / 100));
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ 4. CONTENT (label, headline, subline, button, badge, countdown)  ║
   ╚══════════════════════════════════════════════════════════════════╝ */
.hero-bento__content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--sp-6);
    gap: var(--sp-3);
}

.hero-bento__item--big .hero-bento__content {
    padding: var(--sp-8);
    gap: var(--sp-4);
}

/* Małe banery (prawy stack) — content u GÓRY z lewej (label + nagłówek na top) */
.hero-bento__item--small .hero-bento__content {
    justify-content: flex-start;
    align-items: flex-start;
}

/* Color modes */
.hero-bento__item--text-light .hero-bento__content {
    color: #fff;
}
.hero-bento__item--text-dark .hero-bento__content {
    color: var(--color-dark);
}

/* ── Label (mała etykieta nad headline) ─────────────────────────── */
.hero-bento__label {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 6px 14px;
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--r-sm);
    line-height: 1;
    color: #fff;
}
.hero-bento__label--red    { background: var(--color-action);  }
.hero-bento__label--yellow { background: var(--color-accent); color: var(--color-dark); }
.hero-bento__label--blue   { background: var(--color-primary); }
.hero-bento__label--green  { background: var(--color-success); }

/* ── Headline (główny napis) ─────────────────────────────────────── */
.hero-bento__headline {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
    letter-spacing: -0.01em;
    margin: 0;
    color: inherit;
}

/* Cień pod nagłówkami i podpisami (jasny tekst na zdjęciu — czytelność) */
.hero-bento__item--text-light .hero-bento__headline,
.hero-bento__item--text-light .hero-bento__subline {
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.55),
        0 1px 2px rgba(0, 0, 0, 0.7);
}
.hero-bento__item--text-light .hero-bento__label {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
/* Wariant ciemny tekstu (na jasnym zdjęciu) — delikatny biały halo */
.hero-bento__item--text-dark .hero-bento__headline,
.hero-bento__item--text-dark .hero-bento__subline {
    text-shadow:
        0 2px 6px rgba(255, 255, 255, 0.7),
        0 1px 2px rgba(255, 255, 255, 0.9);
}
.hero-bento__item--big .hero-bento__headline {
    font-size: clamp(var(--fs-3xl), 4.5vw, var(--fs-5xl));
}
.hero-bento__item--small .hero-bento__headline {
    font-size: clamp(var(--fs-xl), 2.5vw, var(--fs-2xl));
}
/* Accent color dla części tekstu (jeśli klient użyje <span> w textarea — przez nl2br tego nie zrobi,
   ale fallback: 2 linia z różnym kolorem) — pomijam na razie */

/* ── Subline (opcjonalny opis pod headline) ──────────────────────── */
.hero-bento__subline {
    font-size: var(--fs-md);
    font-weight: 500;
    line-height: var(--lh-snug);
    margin: 0;
    max-width: 480px;
    opacity: 0.9;
}

/* ── Button (tylko big) ──────────────────────────────────────────── */
.hero-bento__btn {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--r-md);
    line-height: 1;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.hero-bento__item:hover .hero-bento__btn {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.hero-bento__btn--yellow { background: var(--color-accent);  color: var(--color-dark); }
.hero-bento__btn--blue   { background: var(--color-primary); color: #fff; }
.hero-bento__btn--white  { background: #fff;                 color: var(--color-dark); }
.hero-bento__btn--dark   { background: var(--color-dark);    color: #fff; }

/* ── Countdown (tylko big) ──────────────────────────────────────── */
.hero-bento__countdown {
    display: flex;
    gap: var(--sp-2);
    align-self: flex-start;
    font-variant-numeric: tabular-nums;
}
.hero-bento__countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: var(--sp-2) var(--sp-3);
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-dark);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm);
}
.hero-bento__countdown-value {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 800;
    line-height: 1;
}
.hero-bento__countdown-label {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ── Badge (tylko small — okrągły lub pasek) ─────────────────────── */
.hero-bento__badge {
    position: absolute;
    z-index: 3;
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
}

/* Wariant circle (np. -22%) — okrągły w rogu */
.hero-bento__badge--circle {
    top: var(--sp-4);
    right: var(--sp-4);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-base);
    transform: rotate(-8deg);
    box-shadow: var(--shadow-md);
}

/* Wariant bar (np. "NOWOŚĆ W OFERCIE") — pasek na dole */
.hero-bento__badge--bar {
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--sp-2) var(--sp-4);
    text-align: center;
    font-size: var(--fs-sm);
    letter-spacing: 0.05em;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Kolory badge */
.hero-bento__badge--red    { background: var(--color-action);  }
.hero-bento__badge--yellow { background: var(--color-accent); color: var(--color-dark); }
.hero-bento__badge--blue   { background: var(--color-primary); }
.hero-bento__badge--green  { background: var(--color-success); }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ 5. RESPONSIVE                                                    ║
   ╚══════════════════════════════════════════════════════════════════╝ */
@media (max-width: 991px) {
    /* Tablet — grid 60/40 zachowany ale mniejsze paddingi */
    .hero-bento__grid {
        min-height: 380px;
    }
    .hero-bento__right {
        min-height: 380px;
    }
    .hero-bento__item--big {
        min-height: 380px;
    }
    .hero-bento__item--small {
        min-height: 180px;
    }
    .hero-bento__item--big .hero-bento__content {
        padding: var(--sp-5);
    }
}

@media (max-width: 767px) {
    /* Mobile — stack pionowy: big na górze, 2 small pod sobą */
    .hero-bento__grid {
        grid-template-columns: 1fr;
        min-height: auto;
        gap: var(--sp-3);
    }
    .hero-bento__right {
        grid-template-rows: auto auto;
        min-height: auto;
        gap: var(--sp-3);
    }
    .hero-bento__item--big {
        min-height: 320px;
        aspect-ratio: 16 / 10;
    }
    .hero-bento__item--small {
        min-height: 180px;
        aspect-ratio: 16 / 9;
    }
    .hero-bento__content,
    .hero-bento__item--big .hero-bento__content {
        padding: var(--sp-5);
    }
    .hero-bento__countdown-unit {
        min-width: 56px;
        padding: var(--sp-2);
    }
    .hero-bento__countdown-value {
        font-size: var(--fs-xl);
    }
    .hero-bento__badge--circle {
        width: 52px;
        height: 52px;
        font-size: var(--fs-sm);
    }
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║ HERO CAROUSEL — duży lewy baner jako karuzela slajdów            ║
   ║ Slajdy stacked z opacity crossfade. JS auto-rotate co 6s.        ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.hero-bento__carousel {
    position: relative;
    overflow: hidden;
    min-height: 380px;
    border-radius: var(--r-lg);
    isolation: isolate;
}
.hero-bento__carousel--small {
    min-height: 220px;
}

.hero-bento__carousel--small .hero-bento__slide > .hero-bento__item--small {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
}

/* Kontrolki w mniejszych karuzelach — bez strzałek, sam pasek dots, mniejsze */
.hero-bento__controls--small {
    bottom: var(--sp-2);
    right: var(--sp-2);
    padding: 4px 6px;
}

.hero-bento__controls--small .hero-bento__dot {
    width: 6px;
    height: 6px;
}

.hero-bento__controls--small .hero-bento__dot.is-active {
    width: 18px;
}

.hero-bento__slides {
    position: absolute;
    inset: 0;
}

/* Wszystkie slajdy stacked absolute, opacity decyduje o widoczności */
.hero-bento__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.6s;
    pointer-events: none;
}

.hero-bento__slide.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    pointer-events: auto;
    z-index: 2;
}

/* Każdy slajd wypełnia carousel — szerokość/wysokość 100% (NIE nadpisuje min-height oryginału) */
.hero-bento__slide > .hero-bento__item--big {
    width: 100%;
    height: 100%;
    min-height: 0; /* override żeby nie kolidowało z .hero-bento__item--big { min-height: 480px } */
    border-radius: 0; /* radius już na carousel-wrapper */
}

/* ── Carousel controls (dots + arrows) ─────────────────── */
.hero-bento__controls {
    position: absolute;
    bottom: var(--sp-4);
    right: var(--sp-4);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px;
    background: rgba(15, 25, 40, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 0;
}

.hero-bento__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast);
}

.hero-bento__arrow:hover {
    background: var(--color-accent);
    color: var(--color-dark);
}

.hero-bento__arrow:active {
    transform: scale(0.92);
}

.hero-bento__dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 var(--sp-2);
}

.hero-bento__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast), width var(--t-base);
}

.hero-bento__dot:hover {
    background: rgba(255, 255, 255, 0.65);
}

.hero-bento__dot.is-active {
    width: 24px;
    border-radius: 4px;
    background: var(--color-accent);
}

/* ── Progress bar pod karuzelą (auto-rotacja visual) ───── */
.hero-bento__carousel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--color-accent);
    width: 0;
    z-index: 5;
    transition: width 0.1s linear;
}

.hero-bento__carousel.is-progressing::after {
    width: var(--carousel-progress, 0%);
}

/* Mobile — mniejsze kontrolki */
@media (max-width: 640px) {
    .hero-bento__controls {
        bottom: var(--sp-2);
        right: var(--sp-2);
        padding: 4px;
        gap: 4px;
    }
    .hero-bento__arrow {
        width: 28px;
        height: 28px;
    }
    .hero-bento__dot {
        width: 6px;
        height: 6px;
    }
    .hero-bento__dot.is-active {
        width: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-bento__slide {
        transition: opacity 0s, visibility 0s;
    }
    .hero-bento__carousel::after {
        display: none;
    }
}
