/**
 * Websly Hero Drag Carousel — block styles
 *
 * Pairs with template-parts/websly/hero-drag-carousel.php and the vendored
 * Blossom Carousel web component (assets/vendor/blossom-carousel/).
 *
 * The <blossom-carousel> host is a CSS-grid scroller (grid-auto-flow:column +
 * fixed grid-auto-columns), with mandatory x-snap. Blossom's core engine reads
 * the author's scroll-snap-type at init and drives the physical drag + momentum.
 * `repeat` (template default, "loop") makes it an infinite strip; the template
 * also duplicates the slide set so the strip always fills the viewport (smooth
 * wrap, never a visible teleport). Blossom's core CSS is in @layer
 * blossom-carousel, so these unlayered rules intentionally win over it.
 *
 * The "curve" (cards shrink + tilt away from centre) is JS-driven
 * (assets/js/blocks/hero-drag-carousel.js) because CSS scroll-timelines don't
 * track Blossom's transform-based loop wrapping. JS reads each card's real
 * on-screen position, so it stays correct under the infinite loop.
 */

/* ── Section layout: hero header on top, carousel below ─────────────────── */
.ws-hdc {
    min-height: 100vh;
    justify-content: center;
    padding-block: clamp(6rem, 12vh, 10rem) clamp(3rem, 8vh, 6rem);
    box-sizing: border-box;
}
.ws-hdc-title { font-size: clamp(2.5rem, 6vw, 4.75rem); color: var(--text-base, currentColor); }
.ws-hdc-desc  { color: var(--text-muted, currentColor); }

/* ── Carousel scroller ──────────────────────────────────────────────────── */
.ws-hdc-carousel-wrap {
    --ws-hdc-gap: 0.75rem;
    --ws-hdc-item-width: clamp(14rem, 24vw, 20rem);
    --ws-hdc-aspect: 3 / 4;
    --ws-hdc-radius: 9999px;
    position: relative;
    width: 100%;
}
.ws-hdc-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--ws-hdc-item-width, clamp(14rem, 24vw, 20rem));
    gap: var(--ws-hdc-gap, 0.75rem);
    width: 100%;
    justify-content: safe center;
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    overflow-y: clip;
    scrollbar-width: none;
    /* Horizontal pans scroll the strip; vertical pans pass through to the page
       (smooth, predictable touch behaviour on mobile). */
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    /* Vertical breathing room so the curve's tilt/lift isn't clipped. */
    padding-block: clamp(1rem, 4vh, 2.5rem);
}
.ws-hdc-carousel::-webkit-scrollbar { display: none; }

/* ── Slide + card ──────────────────────────────────────────────────────── */
.ws-hdc-slide {
    display: block;
    aspect-ratio: var(--ws-hdc-aspect, 3 / 4);
    scroll-snap-align: center;
}
.ws-hdc-slide__card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border-radius: var(--ws-hdc-radius, 9999px);
    overflow: hidden;
    background: color-mix(in srgb, var(--text-base, #888) 8%, transparent);
    transform-origin: center bottom;
}

/* ── Media (image / video / website screenshot) ─────────────────────────── */
.ws-hdc-media {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.ws-hdc-media__img,
.ws-hdc-media__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
    user-select: none;
}
/* Website screenshot: tall full-page shot cropped to the card; on hover it
   "scrolls" down the page by animating object-position top → bottom. */
.ws-hdc-media__shot {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: object-position 4.5s ease;
    -webkit-user-drag: none;
    user-select: none;
}
.ws-hdc-slide__card:hover .ws-hdc-media__shot { object-position: bottom center; }
.ws-hdc-media__placeholder { display: block; width: 100%; height: 100%; }

/* Click target overlay (link / modal trigger) */
.ws-hdc-slide__hit {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

/* ── Mac browser chrome (browser shape) ─────────────────────────────────── */
/* The realistic macOS titlebar look (gradient bar, glossy traffic-light dots,
   pill URL field) is provided by the shared `.ws-mac-toolbar` styles in
   websly-zoom-card.css — the same toolbar used on Websly Portfolio Cards. We
   only set the bar's height + the flex sizing for our card column here. */
.ws-hdc-chrome {
    flex: 0 0 auto;
    height: 2.25rem;
    font-size: 0.7rem;
}

/* ── Shapes ─────────────────────────────────────────────────────────────── */
.ws-hdc-shape-oval    { --ws-hdc-radius: 9999px;                      --ws-hdc-aspect: 3 / 4; }
.ws-hdc-shape-rounded { --ws-hdc-radius: clamp(1.25rem, 2.5vw, 2rem); --ws-hdc-aspect: 3 / 4; }
.ws-hdc-shape-square  { --ws-hdc-radius: clamp(0.6rem, 1.2vw, 1rem);  --ws-hdc-aspect: 1 / 1; }
.ws-hdc-shape-arch    { --ws-hdc-radius: 9999px 9999px clamp(0.75rem,1.5vw,1.25rem) clamp(0.75rem,1.5vw,1.25rem); --ws-hdc-aspect: 3 / 4; }
/* Browser: website aspect + framed "Mac window" border. */
.ws-hdc-shape-browser {
    --ws-hdc-radius: clamp(0.75rem, 1.5vw, 1.1rem);
    --ws-hdc-aspect: 16 / 10;
    --ws-hdc-item-width: clamp(20rem, 38vw, 34rem);
}
.ws-hdc-shape-browser .ws-hdc-slide__card {
    border: 1px solid color-mix(in srgb, var(--text-base, #888) 16%, transparent);
    box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.5);
    background: var(--surface-bg-color, #1c1c22);
}
.ws-hdc-shape-browser .ws-hdc-carousel-wrap,
.ws-hdc-carousel-wrap.ws-hdc-shape-browser { --ws-hdc-item-width: clamp(20rem, 38vw, 34rem); }

/* ── Progress indicators (5 styles) ─────────────────────────────────────── */
.ws-hdc-progress {
    --ws-hdc-accent: var(--theme-accent, var(--text-base, #888));
    margin: 1.9rem auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 1) Line — slim centred track with a gliding thumb */
.ws-hdc-progress--line {
    position: relative;
    width: min(300px, 46vw);
    height: 3px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text-base, #888) 20%, transparent);
    overflow: hidden;
}
.ws-hdc-progress--line .ws-hdc-progress__bar {
    position: absolute;
    inset-block: 0;
    left: 0;
    width: 34%;
    border-radius: 3px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--ws-hdc-accent) 55%, transparent),
        var(--ws-hdc-accent));
    transform: translateX(0);
    transition: transform 0.35s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
}

/* 2) Full-width — hairline spanning the whole section with a glowing fill */
.ws-hdc-progress--fullbar {
    width: 100%;
    height: 2px;
    margin-top: 2.25rem;
    background: color-mix(in srgb, var(--text-base, #888) 14%, transparent);
    overflow: hidden;
}
.ws-hdc-progress--fullbar .ws-hdc-progress__fill {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(0.02);
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--ws-hdc-accent) 40%, transparent),
        var(--ws-hdc-accent));
    box-shadow: 0 0 10px color-mix(in srgb, var(--ws-hdc-accent) 60%, transparent);
    transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
}

/* 3) Dots — the active one stretches into an accent pill */
.ws-hdc-progress--dots { gap: 0.5rem; }
.ws-hdc-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-base, #888) 28%, transparent);
    transition: width 0.35s cubic-bezier(.4, 0, .2, 1), background 0.35s ease;
}
.ws-hdc-dot.is-active {
    width: 26px;
    background: var(--ws-hdc-accent);
}

/* 4) Orbit — dots on a ring that rotates; the top (focused) dot glows accent */
.ws-hdc-progress--orbit { margin-top: 1.4rem; }
.ws-hdc-orbit {
    --ring-r: 15px;
    position: relative;
    width: calc(var(--ring-r) * 2 + 10px);
    height: calc(var(--ring-r) * 2 + 10px);
    transition: transform 0.5s cubic-bezier(.34, 1.2, .5, 1);
    will-change: transform;
}
.ws-hdc-orbit__dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    margin: -2.5px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--text-base, #888) 30%, transparent);
    transform: rotate(calc(var(--i) / var(--n) * 360deg)) translateY(calc(-1 * var(--ring-r)));
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.ws-hdc-orbit__dot.is-focused {
    background: var(--ws-hdc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ws-hdc-accent) 28%, transparent),
        0 0 12px color-mix(in srgb, var(--ws-hdc-accent) 70%, transparent);
}

/* 5) Counter — monospaced 01 / NN with a short progress hairline between */
.ws-hdc-progress--counter {
    gap: 0.85rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: color-mix(in srgb, var(--text-base, #888) 55%, transparent);
    font-size: 0.85rem;
}
.ws-hdc-counter__cur { color: var(--text-base, currentColor); }
.ws-hdc-counter__track {
    width: clamp(48px, 14vw, 110px);
    height: 2px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--text-base, #888) 20%, transparent);
    overflow: hidden;
}
.ws-hdc-counter__fill {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(0.05);
    background: var(--ws-hdc-accent);
    transition: transform 0.35s cubic-bezier(.4, 0, .2, 1);
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ws-hdc-carousel { scroll-behavior: auto; }
    .ws-hdc-media__shot { transition: none; }
    .ws-hdc-progress__bar,
    .ws-hdc-progress__fill,
    .ws-hdc-dot,
    .ws-hdc-orbit,
    .ws-hdc-orbit__dot,
    .ws-hdc-counter__fill { transition: none; }
    /* JS curve also bails out under reduced-motion (see frontend JS). */
}

/* ── Small screens ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ws-hdc { min-height: auto; padding-block: clamp(5rem, 18vh, 8rem) clamp(2.5rem, 8vh, 4rem); }
    /* Narrower cards on phones so neighbours clearly peek on BOTH sides. */
    .ws-hdc-carousel-wrap { --ws-hdc-item-width: 60vw; }
    .ws-hdc-shape-browser,
    .ws-hdc-carousel-wrap.ws-hdc-shape-browser { --ws-hdc-item-width: 74vw; }
}
