/* ===========================================================
   HERO SECTION BASE WRAPPER
   - Provides a fixed-height canvas (per breakpoint) for the slider.
   - Foreground/background layers are absolutely positioned inside.
   =========================================================== */

.atx-hero-section {
    position: relative;
    overflow: hidden;
    background: var(--are-black);
    color: #fff;
    isolation: isolate;
    font-family: inherit;

    /* Concrete height prevents collapsing and removes bottom gaps. */
    height: var(--hero-height-mobile, 60vh);
    min-height: var(--hero-height-mobile, 60vh);
}
/* Floor: headline + subhead + call button must fit below the header,
   also in mobile landscape (e.g. 667×375 → 60vh is only 225px).
   --hero-floor-* is set by hero-section.php for the front-page hero
   only; context banners (booking/admin) have no floor (0px). */
@media (max-width: 768px){
    .atx-hero-section {
        height: max(var(--hero-height-mobile, 60vh), var(--hero-floor-mobile, 0px));
        min-height: max(var(--hero-height-mobile, 60vh), var(--hero-floor-mobile, 0px));
    }
}

@media (min-width: 480px) and (max-width: 768px){
    .atx-hero-section {
        height: max(var(--hero-height-tablet, 70vh), var(--hero-floor-mobile, 0px));
        min-height: max(var(--hero-height-tablet, 70vh), var(--hero-floor-mobile, 0px));
    }
}
@media (min-width: 769px){
    .atx-hero-section {
        height: max(var(--hero-height-desktop, 80vh), var(--hero-floor-desktop, 0px));
        min-height: max(var(--hero-height-desktop, 80vh), var(--hero-floor-desktop, 0px));
    }
}

/* Contained layout helper (kept for compatibility) */
.atx-hero-section--contained {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ===========================================================
   TRACK & SLIDES — stacked/fade slider
   - Slides are absolutely stacked and cross-fade via opacity.
   =========================================================== */

.atx-hero-section__track {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.atx-hero-section__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    opacity: 0;
    pointer-events: none;
    z-index: 1;

    color: #fff;
    overflow: hidden; /* clip bg while parallax transforms */
    transition: opacity .4s ease-in-out;
}

.atx-hero-section__slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* ===========================================================
   BACKGROUND LAYER
   - Covers the slide with an overscan to avoid edge gaps on transform.
   =========================================================== */
.atx-hero-section__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    will-change: transform;
    transform-origin: center center;
    height: 110%;   /* overscan to remove bottom black gap */
    width: 100%;
    top: 0%;
    z-index: 1;
}

/* ===========================================================
   FOREGROUND CONTENT LAYER
   - Holds headline/subhead and CTA group; parallax transforms applied.
   =========================================================== */
.atx-hero-section__content {
    position: absolute;
    color: #fff;
    text-shadow: 0 20px 40px rgba(0,0,0,.8);
    will-change: transform, opacity;

    /* Fills the hero to allow opacity fade near exit. */
    width: 100%;
    height: 100%;
    z-index: 2;

    /* Optional max width limiter (config-driven via CSS var). */
    max-width: var(--hero-max-content-width, 100%);
}

/* Alignment helper classes preserved for compatibility (not used by JS path). */
.atx-hero-section__content.align-left {
    left: var(--hero-offset-x, 0%);
    right: auto;
    text-align: left;
    transform: translateX(0);
}
.atx-hero-section__content.align-center {
    left: 50%;
    right: auto;
    text-align: center;
    transform: translateX(calc(-50% + var(--hero-offset-x, 0%)));
}
.atx-hero-section__content.align-right {
    left: auto;
    right: var(--hero-offset-x, 0%);
    text-align: right;
    transform: translateX(0);
}

.atx-hero-section__content.valign-top {
    top: var(--hero-offset-y, 0%);
    bottom: auto;
    transform: translateY(0);
}
.atx-hero-section__content.valign-center {
    top: 50%;
    bottom: auto;
    transform: translateY(calc(-50% + var(--hero-offset-y, 0%)));
}
.atx-hero-section__content.valign-bottom {
    top: auto;
    bottom: var(--hero-offset-y, 0%);
    transform: translateY(0);
}

/* ===========================================================
   TEXT BOX
   - Absolutely positioned container for headline/subhead/CTAs.
   - Width is set inline by the renderer; this file keeps a safety cap.
   =========================================================== */
.atx-hero-section__textbox {
    position: absolute;
    color: inherit;
    max-width: 90%; /* safety cap (can be effectively bypassed with inline width) */
    /* JS sets:
       - left/right/top/bottom
       - transform-origin / transform
       based on data-anchor-x / data-anchor-y / data-offset-x / data-offset-y
    */
}

/* Anti-flicker: keep the text box hidden until hero-section.js has
   positioned it (JS adds .is-styled to the section). Safety net: if
   JS never runs, the text appears anyway after 2 s. */
.atx-hero-section:not(.is-styled) .atx-hero-section__textbox {
    visibility: hidden;
    animation: atx-hero-textbox-reveal 0s linear 2s forwards;
}
@keyframes atx-hero-textbox-reveal {
    to { visibility: visible; }
}

/* ===========================================================
   TYPE
   - Clamp() provides a sane responsive scale baseline.
   =========================================================== */

.atx-hero-section__headline {
    font-size: clamp(1.8rem, 1.2vw + 1rem, 3rem);
    font-weight: var(--font-heading-weight);
    line-height: 1.15;
    margin: 0; /* top gap to subhead is controlled by gap tokens below */
    color: #fff;
}

/* Subhead defaults; max-width is per-breakpoint via CSS vars (config-driven). */
.atx-hero-section__subhead {
    font-size: clamp(1rem, 0.5vw + 0.9rem, 1.25rem);
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 1em 0; /* bottom margin stays; top gap is controlled below */
    color: #fff;
    max-width: var(--subhead-maxwidth-mobile, 38ch);
}

/* Headline–Subhead GAP (configurable per breakpoint). */
.atx-hero-section__headline + .atx-hero-section__subhead {
    margin-top: var(--gap-hs-mobile, var(--gap-sm));
}

@media (min-width: 480px) and (max-width: 768px){
    .atx-hero-section__subhead {
        max-width: var(--subhead-maxwidth-tablet, none);
    }
    .atx-hero-section__headline + .atx-hero-section__subhead {
        margin-top: var(--gap-hs-tablet, var(--gap-sm));
    }
}

@media (min-width: 769px){
    .atx-hero-section__subhead {
        max-width: var(--subhead-maxwidth-desktop, none);
    }
    .atx-hero-section__headline + .atx-hero-section__subhead {
        margin-top: var(--gap-hs-desktop, var(--gap-sm));
    }
}

/* ===========================================================
   CTA BUTTONS
   - Flex group for relative-mode buttons; also contains absolute buttons.
   =========================================================== */

.atx-hero-section__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
}
.align-center .atx-hero-section__buttons {
    justify-content: center;
}
.align-right .atx-hero-section__buttons {
    justify-content: flex-end;
}

/* Current markup block (used by renderer) */
.atx-hero-section__ctas {
    display: flex;
    position: relative; /* contain absolutely positioned individual buttons */
}

/* Small / short desktops: the per-slide buttonsMarginTop is applied as an
   inline style by hero-section.js, so we need !important to cap it when
   the viewport is short enough that the hero overlaps the next section
   (the short-code-section). 769px is the desktop breakpoint floor;
   max-height 900px catches typical laptops + windowed browsers. */
@media (min-width: 769px) and (max-height: 900px) {
    .atx-hero-section__ctas {
        margin-top: 1rem !important;
    }
}
@media (min-width: 769px) and (max-height: 720px) {
    .atx-hero-section__ctas {
        margin-top: 0 !important;
    }
}

.atx-hero-section__btn {
    /* Visual extension on top of global .atx-btn tokens */
    box-shadow: var(--shadow-medium);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;

    /* Håll labels (t.ex. telefonnummer) på en rad. NBSP i text bevaras ändå. */
    white-space: nowrap;

    transition:
        transform .28s cubic-bezier(.22,.61,.36,1),
        box-shadow .28s cubic-bezier(.22,.61,.36,1);
}

.atx-hero-section__btn:hover,
.atx-hero-section__btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 24px 40px rgba(0,0,0,.4);
}

/* -----------------------------------------------------------
   CTA icon support
   - Buttons may contain an inline SVG icon next to the label.
   - Layout direction follows data-icon-pos.
   - Icon inherits text colour via currentColor unless overridden
     by the per-button --atx-hero-icon-color CSS var.
   ----------------------------------------------------------- */
.atx-hero-section__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--atx-hero-icon-gap, 0.5em);
}
.atx-hero-section__btn[data-icon-pos="right"] { flex-direction: row-reverse; }
.atx-hero-section__btn[data-icon-pos="top"]   { flex-direction: column; }

.atx-hero-section__btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width:  var(--atx-hero-icon-size, 1em);
    height: var(--atx-hero-icon-size, 1em);
    color:  var(--atx-hero-icon-color, currentColor);
    flex: 0 0 auto;
    line-height: 0;
}
.atx-hero-section__btn-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: currentColor;
}

.atx-hero-section__btn-label { display: inline-block; }

/* Icon-only modifier: square button, no label spacing. */
.atx-hero-section__btn--icon-only {
    gap: 0;
    aspect-ratio: 1 / 1;
    padding-left: 0.6em;
    padding-right: 0.6em;
}

/* Per-button shape override (pill <-> square).
   Only takes effect when the button explicitly sets --atx-hero-btn-radius
   via its inline style, so default styling is untouched. */
.atx-hero-section__btn[style*="--atx-hero-btn-radius"] {
    border-radius: var(--atx-hero-btn-radius);
}

/* ===========================================================
   DOT NAV
   - Centered at bottom; active dot slightly enlarged.
   =========================================================== */

.atx-hero-section__dots {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
}
.atx-hero-section__dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.4);
    border: 0;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,.5);
    transition: background-color .2s ease, transform .2s ease;
}
.atx-hero-section__dot.is-active {
    background: #fff;
    transform: scale(1.15);
}
.atx-hero-section__dot:focus-visible {
    outline: 2px solid #fff;
}

/* ===========================================================
   ARROWS
   - Base reset; JS handles visual tokens (size/bg/colors/offsets).
   =========================================================== */

.atx-hero-section__arrow {
    background: transparent;
    border: none;
    color: inherit;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    /* JS styles:
        width/height
        font-size
        background circle
        border-radius
        left/right offset
        hover color (var(--are-color) via data-arrow-hover-color)
    */
}

/* ===========================================================
   FLOATING PANEL
   - Optional overlay; dimensions/offsets via CSS vars from renderer.
   =========================================================== */

.atx-hero-section__panel {
    position: absolute;
    z-index: 30;
    background: var(--panel-bg, var(--are-panel-color-1));
    color: var(--panel-text, var(--text-main));
    border-radius: var(--panel-radius, 16px);
    box-shadow: var(--panel-shadow, var(--shadow-medium));
    width: var(--panel-width-desktop, 380px);
    min-height: var(--panel-height-desktop, 260px);
    padding: 1rem 1.25rem 1.25rem;
    box-sizing: border-box;
    font-size: 0.95rem;
    line-height: 1.4;
    font-family: var(--font-body-family);
}

/* Corner anchoring utilities for the panel. */
.panel-pos-bottom-right {
    right: var(--panel-offset-x-desktop, 2rem);
    bottom: var(--panel-offset-y-desktop, 2rem);
}
.panel-pos-bottom-left {
    left: var(--panel-offset-x-desktop, 2rem);
    bottom: var(--panel-offset-y-desktop, 2rem);
}
.panel-pos-top-right {
    right: var(--panel-offset-x-desktop, 2rem);
    top: var(--panel-offset-y-desktop, 2rem);
}
.panel-pos-top-left {
    left: var(--panel-offset-x-desktop, 2rem);
    top: var(--panel-offset-y-desktop, 2rem);
}

.atx-hero-section__panel-inner {
    width: 100%;
    height: 100%;
    color: inherit;
}

/* Mobile-friendly adjustments for the panel container. */
@media (max-width: 768px){
    .atx-hero-section__panel {
        width: 80vw;
        max-width: 90vw;
        min-height: auto;
        font-size: 0.9rem;
    }
}

/* ===========================================================
   ACCESSIBILITY / REDUCED MOTION
   - Disables animated transitions when the user prefers less motion.
   =========================================================== */
@media (prefers-reduced-motion: reduce){
    .atx-hero-section__btn,
    .atx-hero-section__dot {
        transition: none !important;
        transform: none !important;
    }
}
