@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

.aafe-headline-gallery-wrapper {
    position: relative;
    width: 100%;
    z-index: 1; /* Establish stacking context for behind/overlay */
    /* Hover Variables */
    --aafe-hover-scale: 1.05;
    --aafe-transition: 300ms;
    --aafe-overlay-color: rgba(0,0,0,0.5);
}

.aafe-headline-gallery-wrapper * {
    box-sizing: border-box;
    transition: all var(--aafe-transition, 300ms) ease;
}

/* Typography Standard */
.aafe-headline-gallery__title { 
    font-family: 'Sora', sans-serif; 
    margin: 0;
    color: #0f1111;
    text-transform: uppercase;
    font-weight: 800;
    line-height: 0.9;
    width: 100%;
}

.aafe-headline-gallery__subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.aafe-headline-gallery__desc {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    margin-top: 15px;
    line-height: 1.6;
}

.aafe-headline-gallery-content {
    position: relative;
    width: 100%;
    margin-bottom: 40px;
}

/* Text Placement Positions */
.aafe-headline-gallery-wrapper[data-text-placement="overlay"] .aafe-headline-gallery-content,
.aafe-headline-gallery-wrapper[data-text-placement="behind"] .aafe-headline-gallery-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 0;
    pointer-events: none; /* Allows hovering over images */
}

/* Enable pointer events on just the text so links/selection work if needed, while passing clicks on empty space */
.aafe-headline-gallery-wrapper[data-text-placement="overlay"] .aafe-headline-gallery__title,
.aafe-headline-gallery-wrapper[data-text-placement="overlay"] .aafe-headline-gallery__subtitle,
.aafe-headline-gallery-wrapper[data-text-placement="overlay"] .aafe-headline-gallery__desc {
    pointer-events: auto; 
}

.aafe-headline-gallery-wrapper[data-text-placement="overlay"] .aafe-headline-gallery-content {
    z-index: 10;
}

.aafe-headline-gallery-wrapper[data-text-placement="behind"] .aafe-headline-gallery-content {
    z-index: -1;
}

/* Ensure Gallery sits normally */
.aafe-headline-gallery__grid {
    position: relative;
    z-index: 1;
}

/* Inline Images */
.aafe-inline-img {
    display: inline-block;
    height: 1em;
    width: auto;
    object-fit: cover;
    vertical-align: middle;
    border-radius: 0.2em;
    margin: 0 0.1em;
}

/* Grid vs Masonry */
.aafe-headline-gallery__grid[data-layout="grid"] {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.aafe-headline-gallery__grid[data-layout="masonry"] {
    column-count: 5;
    column-gap: 15px;
    width: 100%;
}

.aafe-headline-gallery__item {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    break-inside: avoid; /* For masonry */
    margin-bottom: 0;
}

.aafe-headline-gallery__grid[data-layout="grid"] .aafe-headline-gallery__item {
    height: 100%;
}
.aafe-headline-gallery__grid[data-layout="masonry"] .aafe-headline-gallery__item {
    height: auto;
}

.aafe-headline-gallery__img {
    display: block;
    width: 100%;
    object-fit: cover;
    object-position: center;
}

.aafe-headline-gallery__grid[data-layout="grid"] .aafe-headline-gallery__img {
    height: 250px; /* Overridden by widget settings */
}
.aafe-headline-gallery__grid[data-layout="masonry"] .aafe-headline-gallery__img {
    height: auto;
}

/* Masks */
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape="circle"] { 
    clip-path: circle(50% at 50% 50%) !important; 
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    border-radius: 50% !important; 
}
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape="ellipse"] { 
    clip-path: ellipse(50% 40% at 50% 50%) !important; 
    -webkit-clip-path: ellipse(50% 40% at 50% 50%) !important;
    border-radius: 50% / 40% !important; 
}
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape="hexagon"] { 
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important; 
    -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important;
}
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape="arch"] { 
    border-top-left-radius: 50% 25% !important; 
    border-top-right-radius: 50% 25% !important; 
    border-bottom-left-radius: 0 !important; 
    border-bottom-right-radius: 0 !important; 
}
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape="blob"] { 
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50% !important; 
}
.aafe-headline-gallery-wrapper .aafe-headline-gallery__item[data-shape]:not([data-shape="none"]) {
    overflow: hidden !important;
}

/* Button */
.aafe-headline-gallery__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}
.aafe-headline-gallery__btn svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}
.aafe-headline-gallery__btn i {
    font-size: 1.1em;
}


/* Overlay Layer for Hover */
.aafe-headline-gallery__overlay {
    position: absolute;
    inset: 0;
    background-color: var(--aafe-overlay-color);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

/* Hover Effects System */
.aafe-headline-gallery-wrapper[data-hover="lift"] .aafe-headline-gallery__item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    z-index: 5;
}

.aafe-headline-gallery-wrapper[data-hover="scale"] .aafe-headline-gallery__item:hover .aafe-headline-gallery__img {
    transform: scale(var(--aafe-hover-scale, 1.05));
}

.aafe-headline-gallery-wrapper[data-hover="glow"] .aafe-headline-gallery__item:hover {
    box-shadow: 0 0 0 3px #4F46E5, 0 8px 30px rgba(79,70,229,0.25);
    z-index: 5;
}

.aafe-headline-gallery-wrapper[data-hover="border-pop"] .aafe-headline-gallery__item {
    border: 2px solid transparent;
}
.aafe-headline-gallery-wrapper[data-hover="border-pop"] .aafe-headline-gallery__item:hover {
    border-color: #4F46E5;
    transform: scale(1.01);
    z-index: 5;
}

.aafe-headline-gallery-wrapper[data-hover="overlay"] .aafe-headline-gallery__item:hover .aafe-headline-gallery__overlay {
    opacity: 1;
}

.aafe-headline-gallery-wrapper[data-hover="shine"] .aafe-headline-gallery__item::after {
    content: '';
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: none;
    z-index: 3;
}
.aafe-headline-gallery-wrapper[data-hover="shine"] .aafe-headline-gallery__item:hover::after {
    left: 125%;
    transition: left var(--aafe-transition, 600ms) ease;
}

/* ==================================================
   INTERACTIVE EFFECTS OVERRIDES
   ================================================== */

/* Marquee Scroll */
.aafe-headline-gallery-wrapper[data-interaction="marquee"] {
    overflow: hidden;
}
.aafe-headline-gallery-wrapper[data-interaction="marquee"] .aafe-headline-gallery__grid {
    display: flex !important; /* Force flex for marquee regardless of layout type */
    flex-wrap: nowrap;
    width: max-content;
}
.aafe-headline-gallery-wrapper[data-interaction="marquee"] .aafe-headline-gallery__item {
    flex: 0 0 auto;
    width: 250px; 
    margin-bottom: 0 !important;
}
@media (max-width: 767px) {
    .aafe-headline-gallery-wrapper[data-interaction="marquee"] .aafe-headline-gallery__item {
        width: 150px;
    }
}

/* 3D Tilt */
.aafe-headline-gallery-wrapper[data-interaction="tilt"] {
    perspective: 1000px;
}
.aafe-headline-gallery-wrapper[data-interaction="tilt"] .aafe-headline-gallery__item {
    transform-style: preserve-3d;
    will-change: transform;
}

/* Scroll Reveal */
.aafe-headline-gallery-wrapper[data-interaction="reveal"] .aafe-headline-gallery__item {
    opacity: 0;
    will-change: transform, opacity;
}
.aafe-headline-gallery-wrapper[data-interaction="reveal"][data-reveal-style="fade"] .aafe-headline-gallery__item {
    transform: none;
}
.aafe-headline-gallery-wrapper[data-interaction="reveal"][data-reveal-style="up"] .aafe-headline-gallery__item {
    transform: translateY(60px);
}
.aafe-headline-gallery-wrapper[data-interaction="reveal"][data-reveal-style="zoom"] .aafe-headline-gallery__item {
    transform: scale(0.8);
}
