/* ==========================================================================
   ByteLink homepage hero (resources/views/home/sections/hero.blade.php) — loaded on the homepage only.

   Three themes, chosen from the banner's division (never hard-coded per slide):
     .bl-slide--brand    sitewide slides: Midnight -> Graphite, bronze + terracotta fibre light
     .bl-slide--network  ISP & Networking: Midnight Blue #172A46, fibre-optic trails, Champagne Bronze #C6A77A
     .bl-slide--gadgets  Electronics & Gadgets: Warm Ivory #F6F1E8 / Soft Ivory #FFFCF6, Burnt Terracotta
                         #B65E3C accents, Deep Graphite #252B33 CTA
   Colours come from the admin palette variables printed by layouts/app.blade.php (fallbacks = approved values).
   All slides share one grid cell, so the hero is always as tall as its tallest slide: no layout shift while
   cycling. Motion: slow light pulses + a short fade-up on slide change; everything stops for reduced motion.
   ========================================================================== */
.bl-hero {
    --midnight: var(--division-isp-networking, #172A46);
    --midnight-rgb: var(--division-isp-networking-rgb, 23, 42, 70);
    --terracotta: var(--division-electronics-gadgets, #B65E3C);
    --terracotta-rgb: var(--division-electronics-gadgets-rgb, 182, 94, 60);
    --bronze: var(--highlight, #C6A77A);
    --bronze-rgb: var(--highlight-rgb, 198, 167, 122);
    --ivory: var(--card, #FFFCF6);
    --graphite: var(--cta, #252B33);
    --hero-interval: 7s;
    position: relative; isolation: isolate; background: var(--bg, #F6F1E8);
}

/* ---------- Stable height: every slide occupies the same grid cell ---------- */
.bl-hero .carousel-inner { display: grid; overflow: hidden; }
.bl-hero .carousel-item { display: block; grid-area: 1 / 1; visibility: hidden; margin: 0; float: none; }
.bl-hero .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) { visibility: visible; }
.bl-hero.carousel-fade .carousel-item, .bl-hero .carousel-fade .carousel-item { transition-duration: .8s; }

/* ---------- Slide + themes ---------- */
.bl-slide { position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; isolation: isolate; color: var(--slide-text); background: var(--slide-bg); }
.bl-slide--network {
    --slide-text: var(--ivory);
    --slide-muted: rgba(255, 252, 246, .74);
    --slide-bg: radial-gradient(60% 85% at 80% 38%, rgba(58, 92, 140, .45) 0%, transparent 62%),
                radial-gradient(45% 55% at 100% 100%, rgba(var(--bronze-rgb), .16) 0%, transparent 70%),
                linear-gradient(135deg, #0d192c 0%, var(--midnight) 48%, #0b1524 100%);
    --fiber: rgba(var(--bronze-rgb), .17);
    --pulse: #EAD5AE;
    --pulse-2: #9FC2E8;
    --scrim: rgba(13, 25, 44, .9);
}
.bl-slide--brand {
    --slide-text: var(--ivory);
    --slide-muted: rgba(255, 252, 246, .74);
    --slide-bg: radial-gradient(55% 75% at 82% 30%, rgba(var(--bronze-rgb), .2) 0%, transparent 62%),
                radial-gradient(50% 60% at 95% 105%, rgba(var(--terracotta-rgb), .3) 0%, transparent 68%),
                linear-gradient(125deg, #0e1a2d 0%, var(--midnight) 42%, #1d232c 100%);
    --fiber: rgba(var(--bronze-rgb), .15);
    --pulse: #EAD5AE;
    --pulse-2: #E09A78;
    --scrim: rgba(14, 26, 45, .9);
}
.bl-slide--gadgets {
    --slide-text: var(--graphite);
    --slide-muted: rgba(37, 43, 51, .74);
    --slide-bg: radial-gradient(55% 80% at 82% 36%, rgba(var(--terracotta-rgb), .14) 0%, transparent 64%),
                radial-gradient(40% 50% at 0% 100%, rgba(var(--bronze-rgb), .2) 0%, transparent 70%),
                linear-gradient(135deg, var(--ivory) 0%, var(--bg, #F6F1E8) 55%, #EFE4D3 100%);
    --fiber: rgba(var(--terracotta-rgb), .13);
    --pulse: var(--terracotta);
    --pulse-2: #C99A5E;
    --scrim: rgba(255, 252, 246, .92);
}

/* ---------- Background: glow, grid, fibre trails ---------- */
.bl-slide__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.bl-glow { position: absolute; inset: 0; }
.bl-grid { position: absolute; inset: 0; opacity: .5;
    background-image: linear-gradient(rgba(var(--bronze-rgb), .09) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--bronze-rgb), .09) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(70% 80% at 78% 45%, #000 20%, transparent 75%); mask-image: radial-gradient(70% 80% at 78% 45%, #000 20%, transparent 75%); }
.bl-slide--gadgets .bl-grid { opacity: .7; background-image: radial-gradient(rgba(var(--terracotta-rgb), .16) 1px, transparent 1.4px); background-size: 22px 22px; }
.bl-fibers { position: absolute; inset: 0; width: 100%; height: 100%; }
.bl-fibers__cables path { fill: none; stroke: var(--fiber); stroke-width: 1.3; }
.bl-fibers__pulses path { fill: none; stroke: var(--pulse); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 5 95; stroke-dashoffset: 100; opacity: .9;
    animation: blPulse 8s linear infinite; }
.bl-fibers__pulses path:nth-child(2) { stroke: var(--pulse-2); animation-duration: 10s; animation-delay: -3s; }
.bl-fibers__pulses path:nth-child(3) { animation-duration: 9s; animation-delay: -6s; opacity: .7; }
.bl-fibers__pulses path:nth-child(4) { stroke: var(--pulse-2); animation-duration: 11s; animation-delay: -1.5s; opacity: .6; }
.bl-fibers__pulses path:nth-child(5) { animation-duration: 12s; animation-delay: -7s; opacity: .55; }
.bl-fibers__nodes circle { fill: var(--pulse); opacity: .75; stroke: rgba(var(--bronze-rgb), .25); stroke-width: 8; }
.bl-slide--gadgets .bl-fibers__pulses path { stroke-width: 2; opacity: .55; }
.bl-slide--gadgets .bl-fibers__nodes circle { opacity: .45; stroke: rgba(var(--terracotta-rgb), .12); }
@keyframes blPulse { to { stroke-dashoffset: 0; } }
/* Keep the copy on a calm area: soften whatever sits behind the text column. */
.bl-slide__bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--scrim) 0%, transparent 52%); opacity: .75; }

/* ---------- Layout ---------- */
.bl-slide__inner { position: relative; flex: 1 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); align-items: center;
    gap: clamp(2rem, 4.5vw, 4.5rem); min-height: clamp(540px, 42vw, 640px); padding-top: 3.25rem; padding-bottom: 6.5rem; }
.bl-copy { max-width: 590px; min-width: 0; }

.bl-eyebrow { display: inline-flex; align-items: center; gap: .5rem; padding: .42rem .9rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase; color: var(--bronze); background: rgba(255, 252, 246, .06); border: 1px solid rgba(var(--bronze-rgb), .4); }
.bl-eyebrow i { font-size: .95rem; letter-spacing: 0; }
.bl-slide--gadgets .bl-eyebrow { color: var(--terracotta); background: rgba(var(--terracotta-rgb), .07); border-color: rgba(var(--terracotta-rgb), .28); }

.bl-title { color: var(--slide-text); font-size: var(--fs-display, clamp(2.2rem, 1.35rem + 3.1vw, 3.6rem)); font-weight: 800; letter-spacing: -.036em;
    line-height: 1.05; margin: 1rem 0 1.05rem; text-wrap: balance; overflow-wrap: break-word; }
.bl-title em { font-style: normal; background: linear-gradient(100deg, var(--ivory) 0%, #EFDFC3 40%, var(--bronze) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent; }
.bl-slide--gadgets .bl-title em { background: none; color: var(--terracotta); -webkit-text-fill-color: currentColor; }
.bl-desc { color: var(--slide-muted); font-size: clamp(1rem, .95rem + .2vw, 1.1rem); line-height: 1.65; max-width: 46ch; margin: 0 0 2rem; text-wrap: pretty; }

.bl-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .9rem 1.6rem; }
.bl-cta { display: inline-flex; align-items: center; gap: .65rem; border-radius: 999px; padding: .9rem 1.55rem; font-size: 1rem; font-weight: 650; border: 0;
    transition: transform .25s var(--ease, ease), box-shadow .25s var(--ease, ease), background-color .25s; }
.bl-cta i { transition: transform .25s var(--ease, ease); }
.bl-cta:hover i { transform: translateX(3px); }
.bl-cta:hover { transform: translateY(-1px); }
.bl-slide--network .bl-cta { background: var(--bronze); color: var(--graphite); box-shadow: 0 16px 32px -18px rgba(var(--bronze-rgb), .9); }
.bl-slide--network .bl-cta:hover { background: #D6BC94; color: var(--graphite); }
.bl-slide--brand .bl-cta { background: var(--ivory); color: var(--graphite); box-shadow: 0 16px 32px -18px rgba(0, 0, 0, .6); }
.bl-slide--brand .bl-cta:hover { background: #fff; color: var(--graphite); box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .6), inset 0 -2px 0 var(--bronze); }
.bl-slide--gadgets .bl-cta { background: var(--graphite); color: var(--ivory); box-shadow: 0 16px 32px -18px rgba(var(--cta-rgb, 37, 43, 51), .8); }
.bl-slide--gadgets .bl-cta:hover { background: var(--cta-hover, #15191e); color: var(--ivory); box-shadow: 0 18px 34px -16px rgba(var(--cta-rgb, 37, 43, 51), .8), inset 0 -2px 0 var(--terracotta); }
.bl-ghost { position: relative; font-weight: 650; color: var(--slide-text); padding: .3rem 0; }
.bl-ghost::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: currentColor; opacity: .35; transform-origin: left; transition: opacity .25s, transform .35s var(--ease, ease); }
.bl-ghost:hover { color: var(--slide-text); }
.bl-ghost:hover::after { opacity: 1; background: var(--bronze); }
.bl-slide--gadgets .bl-ghost:hover::after { background: var(--terracotta); }

/* Sitewide slide: one quiet link per active division. */
.bl-stores { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.bl-store { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .95rem; border-radius: 999px; font-size: .9rem; font-weight: 600; color: var(--slide-text);
    background: rgba(255, 252, 246, .06); border: 1px solid rgba(255, 252, 246, .18); transition: background .2s, border-color .2s; }
.bl-store i { color: var(--bronze); }
.bl-store:hover { color: var(--slide-text); background: rgba(255, 252, 246, .12); border-color: rgba(var(--bronze-rgb), .6); }

/* ---------- Visual: framed photo + real catalogue products ---------- */
.bl-visual { position: relative; min-width: 0; }
.bl-media { position: relative; margin: 0; aspect-ratio: 5 / 4; border-radius: 28px; overflow: hidden; background: #0f1b2e;
    box-shadow: 0 44px 80px -42px rgba(0, 0, 0, .75), 0 0 0 1px rgba(var(--bronze-rgb), .32); }
.bl-media picture, .bl-media img { display: block; width: 100%; height: 100%; }
.bl-media img { object-fit: cover; }
.bl-media::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(180deg, transparent 55%, rgba(var(--midnight-rgb), .45) 100%); box-shadow: inset 0 0 0 1px rgba(255, 252, 246, .08); }
.bl-slide--brand .bl-media::after { background: linear-gradient(180deg, transparent 50%, rgba(20, 24, 30, .5) 100%); }
.bl-slide--gadgets .bl-media { background: #fff; box-shadow: 0 40px 70px -40px rgba(110, 56, 30, .5), 0 0 0 1px rgba(var(--terracotta-rgb), .16); }
.bl-slide--gadgets .bl-media::after { background: linear-gradient(180deg, transparent 60%, rgba(var(--terracotta-rgb), .1) 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }
/* Soft terracotta arc behind the Electronics frame. */
.bl-slide--gadgets .bl-visual::before { content: ''; position: absolute; width: 62%; aspect-ratio: 1; right: -9%; top: -12%; border-radius: 50%; z-index: -1;
    background: radial-gradient(circle at 30% 30%, rgba(var(--terracotta-rgb), .22), rgba(var(--terracotta-rgb), .05) 60%, transparent 70%); }

.bl-product { position: absolute; z-index: 2; display: flex; align-items: center; gap: .75rem; max-width: 280px; padding: .55rem 1rem .55rem .55rem;
    border-radius: 18px; color: var(--graphite); background: rgba(255, 252, 246, .95); border: 1px solid rgba(var(--bronze-rgb), .4);
    box-shadow: 0 22px 44px -24px rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transition: transform .3s var(--ease, ease), box-shadow .3s var(--ease, ease); }
.bl-product:hover { transform: translateY(-3px); color: var(--graphite); box-shadow: 0 28px 50px -24px rgba(0, 0, 0, .6); }
.bl-product--0 { left: -7%; bottom: 9%; }
.bl-product--1 { right: -4%; top: 8%; }
.bl-product__img { width: 58px; height: 58px; flex-shrink: 0; border-radius: 12px; background: #fff; overflow: hidden; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(37, 43, 51, .06); }
.bl-product__img img { width: 100%; height: 100%; object-fit: contain; }
.bl-product__meta { display: grid; min-width: 0; line-height: 1.25; }
.bl-product__meta small { font-size: .64rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--pdiv, var(--terracotta)); }
.bl-product__meta b { font-size: .84rem; font-weight: 650; letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .1rem 0 .15rem; }
.bl-product__meta span { font-size: .84rem; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- Slide change: short fade-up of the copy, gentle settle of the photo ---------- */
.bl-hero .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-copy > * { animation: blIn .8s var(--ease-out, ease-out) backwards; }
.bl-hero .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-copy > :nth-child(2) { animation-delay: .08s; }
.bl-hero .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-copy > :nth-child(3) { animation-delay: .16s; }
.bl-hero .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-copy > :nth-child(4) { animation-delay: .24s; }
.bl-hero.hero-cycled .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-media img { animation: blSettle 1.4s var(--ease-out, ease-out) backwards; }
.bl-hero.hero-cycled .carousel-item:is(.active, .carousel-item-next, .carousel-item-prev) .bl-product { animation: blIn .9s var(--ease-out, ease-out) .3s backwards; }
/* The first slide's copy is visible immediately on page load (it holds the LCP headline). */
.bl-hero:not(.hero-cycled) .carousel-item.active .bl-copy > * { animation: none; }
@keyframes blIn { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
@keyframes blSettle { from { opacity: .4; transform: scale(1.04); } }

/* ---------- Controls (pause / counter / progress / prev / next) ---------- */
.hero-ui { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none; }
.hero-ui-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.6rem; }
.hero-ui-row > * { pointer-events: auto; }
.hero-pager { display: inline-flex; align-items: center; gap: 1rem; padding: .5rem 1.05rem; border-radius: 999px; background: rgba(255, 252, 246, .9);
    border: 1px solid rgba(var(--bronze-rgb), .45); box-shadow: 0 16px 34px -22px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.hero-counter { display: inline-flex; align-items: baseline; gap: .3rem; font-size: .78rem; color: var(--muted, #66625A); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-counter b { font-size: 1.05rem; color: var(--graphite); font-weight: 800; min-width: 1.5em; }
.bl-hero .carousel-indicators { position: static; margin: 0; justify-content: flex-start; gap: .45rem; }
.bl-hero .carousel-indicators [data-bs-target] { position: relative; overflow: hidden; width: 24px; height: 5px; border-radius: 5px; border: 0; margin: 0; padding: 0; opacity: 1;
    background: rgba(var(--cta-rgb, 37, 43, 51), .16); background-clip: border-box; text-indent: 0; transition: width .45s var(--ease-out, ease), background .3s; }
.bl-hero .carousel-indicators [data-bs-target]:hover { background: rgba(var(--cta-rgb, 37, 43, 51), .3); }
.bl-hero .carousel-indicators .active { width: 58px; background: rgba(var(--cta-rgb, 37, 43, 51), .14); }
.bl-hero .carousel-indicators [data-bs-target] > span { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--bronze), var(--terracotta)); transform: scaleX(0); transform-origin: left; }
.bl-hero .carousel-indicators .active > span { transform: scaleX(1); }
.bl-hero.is-playing .carousel-indicators .active > span { animation: heroProgress var(--hero-interval) linear forwards; }
.bl-hero.is-playing:hover .carousel-indicators .active > span { animation-play-state: paused; }
@keyframes heroProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hero-nav { display: flex; gap: .5rem; }
.hero-btn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.05rem; color: var(--graphite);
    background: rgba(255, 252, 246, .9); border: 1px solid rgba(var(--bronze-rgb), .45); box-shadow: 0 14px 30px -20px rgba(0, 0, 0, .5);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: background .2s, color .2s, transform .2s var(--ease, ease); }
.hero-btn:hover { background: #fff; color: var(--graphite); transform: translateY(-2px); }
.hero-btn:active { transform: scale(.95); }
.hero-btn-next { background: var(--graphite); color: var(--ivory); border-color: var(--graphite); }
.hero-btn-next:hover { background: var(--cta-hover, #15191e); color: var(--ivory); }
.hero-btn i { transition: transform .25s var(--ease, ease); }
.hero-btn[data-bs-slide="next"]:hover i { transform: translateX(3px); }
.hero-btn[data-bs-slide="prev"]:hover i { transform: translateX(-3px); }

/* ---------- Laptop / tablet landscape ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .bl-slide__inner { min-height: clamp(470px, 52vw, 560px); padding-top: 2.5rem; padding-bottom: 6rem; gap: 2rem; }
    .bl-title { font-size: clamp(2rem, 1.1rem + 2.6vw, 2.9rem); }
    .bl-desc { font-size: 1rem; margin-bottom: 1.6rem; }
    .bl-product { max-width: 230px; padding: .45rem .8rem .45rem .45rem; }
    .bl-product__img { width: 46px; height: 46px; }
    .bl-product--0 { left: -4%; bottom: 6%; }
    .bl-product--1 { display: none; }
}

/* ---------- Phones & small tablets: photo on top, copy below, controls under the slide ---------- */
@media (max-width: 767.98px) {
    .bl-slide__inner { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; min-height: 0; padding-top: 1rem; padding-bottom: 1.75rem; align-items: start; }
    .bl-visual { order: -1; }
    .bl-media { aspect-ratio: 16 / 9; border-radius: 20px; }
    .bl-slide__bg::after { background: linear-gradient(180deg, transparent 35%, var(--scrim) 100%); opacity: .55; }
    .bl-eyebrow { font-size: .64rem; padding: .34rem .7rem; }
    .bl-title { font-size: clamp(1.8rem, 1.15rem + 3.4vw, 2.4rem); margin: .7rem 0 .6rem; letter-spacing: -.03em; }
    .bl-desc { font-size: .95rem; line-height: 1.55; margin-bottom: 1.1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .bl-actions { gap: .7rem 1.2rem; }
    .bl-cta { padding: .78rem 1.25rem; font-size: .95rem; }
    .bl-product { max-width: 210px; padding: .4rem .7rem .4rem .4rem; border-radius: 14px; }
    .bl-product__img { width: 42px; height: 42px; border-radius: 10px; }
    .bl-product__meta b { font-size: .78rem; -webkit-line-clamp: 1; }
    .bl-product--0 { left: .6rem; bottom: .6rem; }
    .bl-product--1 { display: none; }
    .hero-ui { position: relative; background: var(--bg, #F6F1E8); }
    .hero-ui-row { padding-top: .75rem; padding-bottom: .9rem; }
    .hero-btn { width: 42px; height: 42px; }
    .hero-btn[data-hero-toggle] { display: none; }
}
@media (max-width: 575.98px) {
    /* Phones: one clear action per slide (the division links live in the "Two stores" section right below). */
    .bl-ghost, .bl-stores { display: none; }
    .bl-slide__inner { padding-bottom: 1.25rem; }
}
@media (max-width: 419.98px) {
    .bl-product { display: none; }
    .hero-counter { display: none; }
    .bl-ghost { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .bl-fibers__pulses { display: none; }
    .bl-hero .carousel-item * { animation: none !important; }
    .bl-cta:hover, .bl-product:hover, .hero-btn:hover { transform: none; }
}
@media print { .bl-hero { display: none; } }
