/* ─── Section ─────────────────────────────────────────────── */

.featured-pages-section {
    position: relative;
    isolation: isolate;
}

.featured-pages-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 65% 85% at 28% 58%, color-mix(in srgb, var(--accent-color) 8%, transparent) 0%, transparent 68%);
    pointer-events: none;
    z-index: -1;
}

.featured-pages-section .grid {
    align-items: flex-end;
}

/* Section title blinks an accent cursor to signal "live / important" */
.featured-pages-section .subtitle-name,
.featured-pages-section .subtitle-number {
    color: var(--accent-color);
}

.featured-pages-section .subtitle-name::after {
    content: "_";
    color: var(--accent-color);
    animation: highlights-cursor 1.1s step-end infinite;
    margin-left: 2px;
}

@keyframes highlights-cursor {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ─── Spinning border via @property ──────────────────────── */

@property --hi-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes hi-spin {
    to { --hi-angle: 360deg; }
}

@keyframes hi-glow-pulse {
    0%, 100% {
        box-shadow:
            0 0 22px color-mix(in srgb, var(--accent-color) 26%, transparent),
            0 0  8px color-mix(in srgb, var(--accent-color) 16%, transparent);
    }
    50% {
        box-shadow:
            0 0 46px color-mix(in srgb, var(--accent-color) 48%, transparent),
            0 0 18px color-mix(in srgb, var(--accent-color) 28%, transparent);
    }
}

/* ─── Card shell ──────────────────────────────────────────── */

.featured-page-card {
    display: flex;
    flex-direction: column;

    /* Spinning conic-gradient border */
    border: 2px solid transparent;
    background-image:
        linear-gradient(var(--background-color), var(--background-color)),
        conic-gradient(
            from var(--hi-angle),
            transparent        0deg,
            transparent       55deg,
            var(--accent-color) 90deg,
            transparent      125deg,
            transparent      360deg
        );
    background-origin: border-box;
    background-clip: padding-box, border-box;

    animation:
        hi-spin       4s linear     infinite,
        hi-glow-pulse 3s ease-in-out infinite;

    transition: box-shadow 0.35s ease;
}

/* On hover: full bright glow, spin stays */
.featured-page-card:hover {
    box-shadow:
        0 0 60px color-mix(in srgb, var(--accent-color) 55%, transparent),
        0 0 24px color-mix(in srgb, var(--accent-color) 32%, transparent);
}

/* ─── Link + image wrapper ────────────────────────────────── */

.featured-page-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.featured-page-card-image {
    position: relative;
    overflow: hidden;
}

.featured-page-card-img {
    max-height: calc(var(--horizontal-container-height) - max(117px, calc(8.2vw * var(--scale))));
    aspect-ratio: 1/1;
    width: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.featured-page-card-image figure {
    display: flex;
}

.featured-page-card-image figure img {
    max-height: calc(var(--horizontal-container-height) - max(117px, calc(8.2vw * var(--scale))));
    aspect-ratio: 1/1;
    width: auto;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.featured-page-card:hover .featured-page-card-img,
.featured-page-card:hover figure img {
    transform: scale(1.07);
}

/* ─── Permanent bottom overlay: label + title ─────────────── */

.featured-page-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 0%,
        rgba(0, 0, 0, 0.30) 40%,
        transparent 65%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: max(14px, calc(0.97vw * var(--scale)));
    gap: max(5px, calc(0.35vw * var(--scale)));
    transition: opacity 0.4s ease;
}

.featured-page-card:hover .featured-page-card-overlay {
    opacity: 0;
}

/* Label */
.featured-page-card-label {
    font-size: max(11px, calc(0.76vw * var(--scale)));
    color: var(--accent-color);
    text-transform: var(--text-style, uppercase);
    letter-spacing: 0.06em;
    line-height: 1;
}

html[data-cta-style="Square Bracket"] .featured-page-card-label::before,
html[data-cta-style="Mixed"] .featured-page-card-label::before {
    content: "[ ";
}

html[data-cta-style="Square Bracket"] .featured-page-card-label::after,
html[data-cta-style="Mixed"] .featured-page-card-label::after {
    content: " ]";
}

/* Title */
.featured-page-card-title {
    color: #fff;
}

/* ─── Hover scrim: reveals centred CTA ───────────────────── */

.featured-page-card-scrim {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--background-color) 72%, transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.featured-page-card:hover .featured-page-card-scrim {
    opacity: 1;
}

/* CTA — uses theme's .button class for style (Button / Square Bracket / Mixed).
   We only control the hover-reveal and slide-in; everything else is global.css. */
.featured-page-card-cta {
    opacity: 0;
    transform: translateY(10px);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.featured-page-card:hover .featured-page-card-cta {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Mobile ─────────────────────────────────────────────── */

@media (max-width: 991px) {
    .featured-page-card-img,
    .featured-page-card-image figure img {
        max-height: none;
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }

    .featured-page-card-image figure {
        width: 100%;
    }

    /* Keep overlay visible on touch (no hover) */
    .featured-page-card:hover .featured-page-card-overlay {
        opacity: 1;
    }

    .featured-page-card-scrim {
        display: none;
    }
}
