@import 'tailwindcss';

/* ═══════════════════════════════════════════════════════════════
   El Captain — Public Academy Website
   All colors via CSS variables — supports all 8 templates
   ═══════════════════════════════════════════════════════════════ */

@theme {
    --color-website-primary: var(--site-primary, #1e3a5f);
    --color-website-secondary: var(--site-secondary, #2d5a87);
    --color-website-accent: var(--site-accent, #2563eb);
    --color-website-text: var(--site-text, #1f2937);
    --color-website-muted: var(--site-muted, #6b7280);
    --color-website-surface: var(--site-surface, #f9fafb);
    --color-website-border: var(--site-border, #e5e7eb);
}

@layer base {
    .website-body {
        background: var(--site-bg, #ffffff);
        color: var(--site-text, #1f2937);
        font-family: var(--site-body-font, 'Cairo'), 'Noto Sans Arabic', system-ui, sans-serif;
        font-size: var(--site-text-base, 16px);
        line-height: var(--site-line-height, 1.6);
        letter-spacing: var(--site-letter-spacing, 0);
        /* Direction comes from <html dir>, which follows the request locale.
           Hardcoding rtl here silently overrode it and rendered the English
           site right-to-left. */
        min-height: 100vh;
        overflow-x: hidden;
        scroll-behavior: smooth;
        -webkit-font-smoothing: antialiased;
    }

    .website-body * {
        scroll-margin-top: 80px;
    }
}

@layer components {
    /* ─── Navbar ─── */
    .site-nav {
        position: fixed;
        top: 0;
        inset-inline: 0;
        z-index: 100;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--site-primary);
    }

    .site-nav--transparent {
        background: transparent;
    }

    .site-nav--floating {
        top: 1rem;
        inset-inline: 1rem;
        border-radius: var(--site-radius-lg, 20px);
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(12px);
    }

    .site-nav--scrolled {
        background: var(--site-primary);
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
    }

    .site-nav--floating.site-nav--scrolled {
        background: var(--site-primary);
        backdrop-filter: none;
    }

    /* ─── Hero ─── */
    .hero-section {
        position: relative;
        min-height: 85vh;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        background: linear-gradient(135deg, var(--site-primary) 0%, var(--site-secondary) 100%);
    }

    .hero-section::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 80px;
        background: linear-gradient(to top, var(--site-bg), transparent);
        z-index: 2;
    }

    .hero-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(
            135deg,
            rgba(0, 0, 0, var(--overlay-opacity, 0.4)) 0%,
            rgba(0, 0, 0, calc(var(--overlay-opacity, 0.4) + 0.1)) 100%
        );
        z-index: 1;
    }

    .hero-content {
        position: relative;
        z-index: 3;
        text-align: center;
        padding: 2rem;
    }

    .hero-title {
        font-size: clamp(2.5rem, 6vw, var(--site-h1, 4.5rem));
        font-weight: var(--site-heading-weight, 800);
        line-height: 1.15;
        color: #ffffff;
        letter-spacing: -0.01em;
        font-family: var(--site-heading-font, 'Cairo'), sans-serif;
    }

    .hero-accent-line {
        width: 0;
        height: 4px;
        margin: 1.5rem auto;
        background: var(--site-accent);
        border-radius: 2px;
        animation: accent-expand 1s 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    @keyframes accent-expand {
        to { width: 80px; }
    }

    /* ─── Section Shared ─── */
    .site-section {
        position: relative;
        padding: var(--section-py, 5rem) 0;
        overflow: hidden;
        background: var(--site-bg);
    }

    .site-section--alt {
        background: var(--site-surface);
    }

    .site-section--dark {
        background: var(--site-primary);
        color: #ffffff;
    }

    .section-title {
        font-size: clamp(1.75rem, 3.5vw, var(--site-h2, 2.5rem));
        font-weight: var(--site-heading-weight, 700);
        font-family: var(--site-heading-font, 'Cairo'), sans-serif;
        color: var(--site-text);
        margin-bottom: 0.5rem;
        position: relative;
        display: inline-block;
    }

    .site-section--dark .section-title {
        color: #ffffff;
    }

    .section-title::after {
        content: '';
        position: absolute;
        bottom: -8px;
        inset-inline-start: 0;
        width: 50px;
        height: 3px;
        background: var(--site-accent);
        border-radius: 2px;
    }

    .section-subtitle {
        color: var(--site-muted);
        font-size: 1.1rem;
        margin-top: 1rem;
    }

    /* ─── Cards ─── */
    .site-card {
        position: relative;
        border-radius: var(--site-radius-lg, 1rem);
        overflow: hidden;
        background: var(--site-surface);
        border: 1px solid var(--site-border);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .site-card:hover {
        transform: translateY(-4px);
        border-color: var(--site-accent);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    }

    .site-card__image {
        width: 100%;
        height: auto;
        object-fit: contain;
        transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .site-card:hover .site-card__image {
        transform: scale(1.05);
    }

    .site-card__body {
        padding: var(--card-gap, 1.5rem);
    }

    .site-card__title {
        font-family: var(--site-heading-font, 'Cairo'), sans-serif;
        font-weight: var(--site-heading-weight, 700);
        font-size: var(--site-h3, 1.25rem);
        color: var(--site-text);
    }

    .site-card__overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 60%);
        opacity: 0.8;
        transition: opacity 0.3s;
    }

    /* Card style overrides via data-card attribute */
    [data-card="flat"] .site-card {
        box-shadow: none;
        border: none;
        background: transparent;
    }

    [data-card="raised"] .site-card {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        border: none;
    }

    [data-card="bordered"] .site-card {
        box-shadow: none;
        border: 1px solid var(--site-border);
    }

    [data-card="glass"] .site-card {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.05);
    }

    /* ─── Stats ─── */
    .stats-band {
        position: relative;
        background: var(--site-primary);
        overflow: hidden;
    }

    .stat-number {
        font-size: clamp(2.5rem, 5vw, 3.5rem);
        font-weight: 800;
        font-family: var(--site-heading-font, 'Cairo'), sans-serif;
        color: var(--site-accent);
        line-height: 1;
    }

    .stat-label {
        color: rgba(255, 255, 255, 0.8);
        margin-top: 0.5rem;
    }

    /* ─── Testimonials ─── */
    .testimonial-card {
        background: var(--site-surface);
        border-radius: var(--site-radius-lg, 1rem);
        padding: 2rem;
        border: 1px solid var(--site-border);
        position: relative;
        transition: all 0.3s ease;
    }

    .testimonial-card:hover {
        border-color: var(--site-accent);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    }

    .testimonial-card::before {
        content: '\201C';
        position: absolute;
        top: 0.75rem;
        inset-inline-start: 1.25rem;
        font-size: 4rem;
        line-height: 1;
        color: var(--site-accent);
        opacity: 0.15;
        font-family: serif;
    }

    /* ─── FAQ ─── */
    .faq-item {
        border: 1px solid var(--site-border);
        border-radius: var(--site-radius, 0.75rem);
        overflow: hidden;
        transition: border-color 0.3s, box-shadow 0.3s;
        background: var(--site-surface);
    }

    .faq-item:hover,
    .faq-item[data-open="true"] {
        border-color: var(--site-accent);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }

    /* ─── CTA Section ─── */
    .cta-section {
        position: relative;
        background: linear-gradient(135deg, var(--site-primary), var(--site-secondary));
        overflow: hidden;
    }

    /* ─── Buttons ─── */
    .site-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.875rem 2rem;
        border-radius: var(--site-radius, 0.75rem);
        font-weight: 600;
        font-size: 1rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
        text-decoration: none;
        position: relative;
        overflow: hidden;
    }

    .site-btn--primary {
        background: var(--site-accent);
        color: white;
        box-shadow: 0 4px 14px color-mix(in srgb, var(--site-accent) 30%, transparent);
    }

    .site-btn--primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px color-mix(in srgb, var(--site-accent) 40%, transparent);
        filter: brightness(1.1);
    }

    .site-btn--outline {
        background: transparent;
        color: white;
        border: 2px solid rgba(255, 255, 255, 0.4);
    }

    .site-btn--outline:hover {
        border-color: white;
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
    }

    .site-btn--outline-accent {
        background: transparent;
        color: var(--site-accent);
        border: 2px solid var(--site-accent);
    }

    .site-btn--outline-accent:hover {
        background: var(--site-accent);
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 14px color-mix(in srgb, var(--site-accent) 25%, transparent);
    }

    .scrollbar-hide {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .scrollbar-hide::-webkit-scrollbar {
        display: none;
    }

    /* ─── Footer ─── */
    .site-footer {
        background: var(--site-primary);
        color: #ffffff;
        border-top: none;
    }

    .site-footer a {
        color: rgba(255, 255, 255, 0.7);
        transition: color 0.3s;
    }

    .site-footer a:hover {
        color: var(--site-accent);
    }

    /* ─── WhatsApp Float ─── */
    .whatsapp-float {
        position: fixed;
        bottom: 1.5rem;
        inset-inline-end: 1.5rem;
        z-index: 90;
        width: 56px;
        height: 56px;
        background: #25d366;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
        transition: transform 0.3s, box-shadow 0.3s;
        animation: whatsapp-pulse 2s infinite;
    }

    .whatsapp-float:hover {
        transform: scale(1.12);
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    }

    @keyframes whatsapp-pulse {
        0%, 100% { box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4); }
        50% { box-shadow: 0 4px 24px rgba(37, 211, 102, 0.6), 0 0 0 8px rgba(37, 211, 102, 0.08); }
    }

    /* ─── Section Animations (data-animation system) ─── */
    [data-animation] {
        opacity: 0;
        transition-property: opacity, transform;
        transition-duration: var(--anim-duration, 0.8s);
        transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    }

    [data-animation="fade-up"] { transform: translateY(40px); }
    [data-animation="fade-down"] { transform: translateY(-40px); }
    [data-animation="fade-left"] { transform: translateX(40px); }
    [data-animation="fade-right"] { transform: translateX(-40px); }
    [data-animation="zoom-in"] { transform: scale(0.9); }
    [data-animation="flip"] { transform: perspective(600px) rotateX(15deg); transform-origin: center bottom; }
    [data-animation="bounce"] { transform: translateY(40px); }

    [data-animation].animated {
        opacity: 1;
        transform: none;
    }

    [data-animation="bounce"].animated {
        animation: bounce-in var(--anim-duration, 0.8s) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    @keyframes bounce-in {
        0% { opacity: 0; transform: translateY(40px); }
        60% { opacity: 1; transform: translateY(-8px); }
        100% { opacity: 1; transform: translateY(0); }
    }

    [data-animations="false"] [data-animation] {
        opacity: 1;
        transform: none;
        transition: none;
        animation: none;
    }

    /* Legacy .reveal support */
    .reveal {
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .reveal--visible {
        opacity: 1;
        transform: translateY(0);
    }

    .reveal--delay-1 { transition-delay: 0.1s; }
    .reveal--delay-2 { transition-delay: 0.2s; }
    .reveal--delay-3 { transition-delay: 0.3s; }
    .reveal--delay-4 { transition-delay: 0.4s; }

    /* ─── Map Container ─── */
    .map-container {
        border-radius: var(--site-radius-lg, 1rem);
        overflow: hidden;
        border: 1px solid var(--site-border);
        height: 350px;
    }

    /* ─── Gallery Grid ─── */
    .gallery-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: var(--card-gap, 1rem);
    }

    .gallery-item {
        position: relative;
        border-radius: var(--site-radius, 0.75rem);
        overflow: hidden;
        aspect-ratio: 3/2;
        cursor: pointer;
        border: 1px solid var(--site-border);
        transition: all 0.3s ease;
    }

    .gallery-item:hover {
        border-color: var(--site-accent);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gallery-item:hover img {
        transform: scale(1.08);
    }

    /* ─── Partners Logo Bar ─── */
    .partners-track {
        display: flex;
        gap: 3rem;
        animation: scroll-logos 30s linear infinite;
    }

    .partners-track:hover {
        animation-play-state: paused;
    }

    @keyframes scroll-logos {
        0% { transform: translateX(0); }
        100% { transform: translateX(-50%); }
    }

    /* ─── Contact Form ─── */
    .site-input {
        width: 100%;
        padding: 0.875rem 1rem;
        background: var(--site-surface);
        border: 1px solid var(--site-border);
        border-radius: var(--site-radius, 0.75rem);
        color: var(--site-text);
        font-size: 1rem;
        transition: border-color 0.3s, box-shadow 0.3s;
    }

    .site-input:focus {
        outline: none;
        border-color: var(--site-accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-accent) 15%, transparent);
    }

    .site-input::placeholder {
        color: var(--site-muted);
    }

    .site-section--dark .site-input {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }

    .site-section--dark .site-input::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

    .site-section--dark .site-input:focus {
        border-color: var(--site-accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-accent) 20%, transparent);
    }

    /* ─── Skeleton / Empty States ─── */
    .skeleton-card {
        background: var(--site-surface);
        border: 1px solid var(--site-border);
        border-radius: var(--site-radius-lg, 1rem);
        overflow: hidden;
    }

    .skeleton-block {
        background: linear-gradient(90deg, var(--site-surface) 25%, var(--site-border) 50%, var(--site-surface) 75%);
        background-size: 200% 100%;
        animation: skeleton-shimmer 1.5s infinite;
        border-radius: var(--site-radius, 0.5rem);
    }

    @keyframes skeleton-shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    .empty-state {
        text-align: center;
        padding: 3rem 1rem;
        color: var(--site-muted);
    }

    .empty-state svg {
        margin: 0 auto 1rem;
        opacity: 0.4;
    }

    /* ─── Image Shape via data-attribute ─── */
    .site-img--square { border-radius: 0; }
    .site-img--rounded { border-radius: var(--site-radius-lg, 1rem); }
    .site-img--circle { border-radius: 50%; }
    .site-img--blob { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
    }

    .site-section {
        padding: 3rem 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-nav--floating {
        top: 0.5rem;
        inset-inline: 0.5rem;
    }

    [data-animation] {
        --anim-duration: 0.5s;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
    [data-animation],
    .reveal,
    .hero-accent-line,
    .site-card,
    .whatsapp-float {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================================
   Website Builder v3 — extended motion library
   Adds effects, per-block delay, child stagger and parallax on
   top of the existing [data-animation] observer.
   ============================================================ */
@layer components {
    /* --- additional entrance effects --- */
    [data-animation="slide-up"]     { transform: translateY(60px); }
    [data-animation="slide-down"]   { transform: translateY(-60px); }
    [data-animation="slide-start"]  { transform: translateX(60px); }
    [data-animation="slide-end"]    { transform: translateX(-60px); }
    [data-animation="scale-in"]     { transform: scale(0.85); }
    [data-animation="scale-out"]    { transform: scale(1.15); }
    [data-animation="rotate-in"]    { transform: rotate(-6deg) scale(0.95); }
    [data-animation="blur-in"]      { filter: blur(12px); }
    [data-animation="reveal-up"]    { clip-path: inset(100% 0 0 0); }
    [data-animation="flip-y"]       { transform: perspective(800px) rotateY(20deg); }

    [data-animation="blur-in"].animated   { filter: blur(0); }
    [data-animation="reveal-up"].animated { clip-path: inset(0 0 0 0); }

    /* --- per-block delay --- */
    [data-animation][data-animation-delay="100"] { transition-delay: 0.1s; }
    [data-animation][data-animation-delay="200"] { transition-delay: 0.2s; }
    [data-animation][data-animation-delay="300"] { transition-delay: 0.3s; }
    [data-animation][data-animation-delay="400"] { transition-delay: 0.4s; }
    [data-animation][data-animation-delay="600"] { transition-delay: 0.6s; }
    [data-animation][data-animation-delay="800"] { transition-delay: 0.8s; }

    /* --- staggered children: set by the observer as --stagger-index --- */
    [data-animation-stagger] .ec-stagger-item {
        opacity: 0;
        transform: translateY(24px);
        transition:
            opacity var(--anim-duration, 0.7s) ease-out,
            transform var(--anim-duration, 0.7s) ease-out;
        transition-delay: calc(var(--stagger-index, 0) * var(--stagger-step, 90ms));
    }
    [data-animation-stagger].animated .ec-stagger-item {
        opacity: 1;
        transform: none;
    }

    /* --- continuous/ambient effects (opt-in per element) --- */
    .ec-float  { animation: ec-float 6s ease-in-out infinite; }
    .ec-glow   { animation: ec-glow 3s ease-in-out infinite; }
    .ec-pulse-soft { animation: ec-pulse-soft 2.5s ease-in-out infinite; }
    .ec-bounce-subtle { animation: ec-bounce-subtle 3s ease-in-out infinite; }

    .ec-shimmer {
        position: relative;
        overflow: hidden;
    }
    .ec-shimmer::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(
            110deg,
            transparent 30%,
            rgb(255 255 255 / 0.35) 50%,
            transparent 70%
        );
        transform: translateX(-100%);
        animation: ec-shimmer 2.8s ease-in-out infinite;
    }

    @keyframes ec-float {
        0%, 100% { transform: translateY(0); }
        50%      { transform: translateY(-14px); }
    }
    @keyframes ec-glow {
        0%, 100% { filter: drop-shadow(0 0 6px rgb(255 255 255 / 0.25)); }
        50%      { filter: drop-shadow(0 0 22px rgb(255 255 255 / 0.6)); }
    }
    @keyframes ec-pulse-soft {
        0%, 100% { opacity: 1; transform: scale(1); }
        50%      { opacity: 0.85; transform: scale(1.03); }
    }
    @keyframes ec-bounce-subtle {
        0%, 100% { transform: translateY(0); }
        50%      { transform: translateY(-6px); }
    }
    @keyframes ec-shimmer {
        0%   { transform: translateX(-100%); }
        60%, 100% { transform: translateX(100%); }
    }

    /* --- parallax backgrounds --- */
    [data-parallax="true"] {
        will-change: transform;
        transform: translate3d(0, var(--parallax-offset, 0), 0) scale(1.15);
    }

    /* Motion is a preference, not a decoration: honour the OS setting and the
       academy-level animations toggle for everything added above too. */
    [data-animations="false"] .ec-float,
    [data-animations="false"] .ec-glow,
    [data-animations="false"] .ec-pulse-soft,
    [data-animations="false"] .ec-bounce-subtle,
    [data-animations="false"] .ec-shimmer::after,
    [data-animations="false"] [data-parallax] {
        animation: none !important;
        transform: none !important;
    }
    [data-animations="false"] [data-animation-stagger] .ec-stagger-item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    @media (prefers-reduced-motion: reduce) {
        .ec-float, .ec-glow, .ec-pulse-soft, .ec-bounce-subtle, .ec-shimmer::after {
            animation: none !important;
        }
        [data-parallax] { transform: none !important; }
        [data-animation-stagger] .ec-stagger-item {
            opacity: 1;
            transform: none;
            transition: none;
        }
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Block builder design layer (`ec-*`)

   Every block partial written for the v3 builder styles itself through these
   classes rather than hardcoded colours, so one theme change repaints the
   whole site. They bind to the --site-* variables the layout emits from
   website_settings; nothing here assumes a particular palette.
   ══════════════════════════════════════════════════════════════════════════ */
@layer components {

    /* ─── Surfaces and type ─── */
    .ec-block {
        color: var(--site-text);
        font-family: var(--site-body-font);
    }

    .ec-heading {
        color: var(--site-text);
        font-family: var(--site-heading-font);
        font-weight: var(--site-heading-weight, 800);
        letter-spacing: var(--site-letter-spacing, 0);
    }

    .ec-muted { color: var(--site-muted); }
    .ec-accent { color: var(--site-accent); }
    .ec-accent-text { color: var(--site-accent); }

    /* An emphasised fragment is one phrase; letting it break mid-word turns
       "Welcome to {OC-Sport}" into "Welcome to OC-" / "Sport". */
    .ec-heading .ec-accent-text { white-space: nowrap; }

    /* An eyebrow labels the section above its heading: small, spaced, accent. */
    .ec-eyebrow {
        color: var(--site-accent);
        text-transform: uppercase;
        letter-spacing: 0.22em;
        font-weight: 700;
        font-size: 0.8125rem;
    }

    .ec-surface {
        background: var(--site-surface);
        border: 1px solid var(--site-border);
        border-radius: var(--site-radius-lg, 20px);
        color: var(--site-text);
    }

    /* ─── The rule under a section heading ─── */
    .ec-heading-rule::after {
        content: "";
        display: block;
        width: 4.5rem;
        height: 4px;
        margin-block-start: 0.75rem;
        border-radius: 999px;
        background: var(--site-accent);
    }

    .ec-heading-rule--center::after { margin-inline: auto; }
    .ec-heading-rule--start::after { margin-inline-end: auto; }

    /* A quoted or emphasised passage, marked by a rule on its leading edge. */
    .ec-accent-edge {
        border-inline-start: 3px solid var(--site-accent);
        padding-inline-start: 1.25rem;
    }

    /* ─── Buttons ─── */
    .ec-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border-radius: var(--site-radius, 12px);
        font-weight: 600;
        line-height: 1.2;
        transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
        cursor: pointer;
    }

    .ec-btn:hover { transform: translateY(-1px); }

    .ec-btn--primary {
        background: var(--site-accent);
        color: var(--site-primary);
        box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--site-accent) 70%, transparent);
    }

    .ec-btn--primary:hover {
        box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--site-accent) 85%, transparent);
    }

    .ec-btn--secondary {
        background: var(--site-secondary);
        color: #fff;
    }

    .ec-btn--outline {
        border: 2px solid var(--site-accent);
        color: var(--site-accent);
        background: transparent;
    }

    .ec-btn--outline:hover {
        background: var(--site-accent);
        color: var(--site-primary);
    }

    .ec-btn--ghost {
        background: color-mix(in srgb, currentColor 10%, transparent);
        color: inherit;
    }

    /* ─── Rich text ─── */
    .ec-prose { line-height: var(--site-line-height, 1.7); }
    .ec-prose :is(h1, h2, h3, h4) {
        color: var(--site-text);
        font-family: var(--site-heading-font);
        font-weight: 700;
        margin-block: 1.5em 0.5em;
    }
    .ec-prose h2 { font-size: var(--site-h2); }
    .ec-prose h3 { font-size: var(--site-h3); }
    .ec-prose p { margin-block-end: 1em; }
    .ec-prose :is(ul, ol) { margin-block-end: 1em; padding-inline-start: 1.5em; }
    .ec-prose ul { list-style: disc; }
    .ec-prose ol { list-style: decimal; }
    .ec-prose li { margin-block-end: 0.4em; }
    .ec-prose a { color: var(--site-accent); text-decoration: underline; }
    .ec-prose strong { font-weight: 700; color: var(--site-text); }
    .ec-prose blockquote {
        border-inline-start: 3px solid var(--site-accent);
        padding-inline-start: 1rem;
        font-style: italic;
        color: var(--site-muted);
    }

    /* ─── Navigation ─── */
    .site-nav--glass {
        background: color-mix(in srgb, var(--site-primary) 72%, transparent);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-block-end: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }

    .site-nav--glass.site-nav--scrolled {
        background: color-mix(in srgb, var(--site-primary) 92%, transparent);
    }

    /* A light sweeps across a nav item on hover. */
    .ec-nav-item {
        position: relative;
        overflow: hidden;
    }

    .ec-nav-item::after {
        content: "";
        position: absolute;
        inset: 0;
        transform: translateX(-100%);
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: transform 0.5s ease;
        pointer-events: none;
    }

    .ec-nav-item:hover::after { transform: translateX(100%); }

    .ec-nav-dropdown {
        background: color-mix(in srgb, var(--site-primary) 96%, transparent);
        border: 1px solid rgba(255, 255, 255, 0.12);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        color: #fff;
    }

    /* ─── Marquee ─── */
    .ec-marquee { position: relative; }

    .ec-marquee-track {
        width: max-content;
        animation: ec-marquee-scroll var(--marquee-duration, 30s) linear infinite;
    }

    .ec-marquee:hover .ec-marquee-track { animation-play-state: paused; }

    @keyframes ec-marquee-scroll {
        from { transform: translateX(0); }
        to   { transform: translateX(-50%); }
    }

    [dir="rtl"] .ec-marquee-track {
        animation-name: ec-marquee-scroll-rtl;
    }

    @keyframes ec-marquee-scroll-rtl {
        from { transform: translateX(0); }
        to   { transform: translateX(50%); }
    }

    /* ─── Focus carousel: the centred item is the one in focus ─── */
    .ec-focus-item {
        transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease, filter 0.5s ease;
        opacity: 0.45;
        filter: grayscale(1);
    }

    .ec-focus-item[data-active="true"] {
        opacity: 1;
        filter: none;
        transform: scale(1.35);
    }

    .ec-focus-tile {
        border-radius: var(--site-radius, 12px);
        transition: background 0.5s ease, box-shadow 0.5s ease, border-color 0.5s ease;
        border: 2px solid transparent;
    }

    .ec-focus-item[data-active="true"] .ec-focus-tile {
        background: #f4f4f5;
        border-color: var(--site-accent);
        box-shadow: 0 0 28px -4px color-mix(in srgb, var(--site-accent) 75%, transparent);
    }

    /* ─── Showcase: a design turns on its axis to show its back ─── */
    .ec-jersey-stage { perspective: 1400px; }

    .ec-jersey-card {
        position: absolute;
        inset: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.7s ease;
    }

    .ec-jersey-card.is-active { opacity: 1; }

    .ec-jersey-inner {
        position: relative;
        width: 100%;
        height: 100%;
        transform-style: preserve-3d;
        transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .ec-jersey-inner.is-flipped { transform: rotateY(180deg); }

    /* Each face is hidden while it points away from the reader, so the two
       never show through one another mid-turn. */
    .ec-jersey-face {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .ec-jersey-face--back { transform: rotateY(180deg); }

    /* ─── A card whose subject is out of season ─── */
    .ec-card-dormant {
        opacity: 0.45;
        filter: grayscale(0.7);
    }

    .ec-card-dormant:hover { transform: none; }

    /* ─── Footer accent band ─── */
    .ec-powered-bar { width: 100%; }

    /* ─── Framed media ─── */
    .ec-frame-offset {
        position: relative;
    }

    .ec-frame-offset > img {
        position: relative;
        z-index: 1;
        border-radius: var(--site-radius-lg, 20px);
    }

    /* The outline sits behind and offset, so the photo reads as pinned to it. */
    .ec-frame-offset::before {
        content: "";
        position: absolute;
        inset-block: 1.25rem -1.25rem;
        inset-inline: 1.25rem -1.25rem;
        border: 1px solid color-mix(in srgb, var(--site-accent) 55%, transparent);
        border-radius: var(--site-radius-lg, 20px);
        pointer-events: none;
    }

    .ec-frame-border > img {
        border: 1px solid color-mix(in srgb, var(--site-accent) 55%, transparent);
        border-radius: var(--site-radius-lg, 20px);
    }

    .ec-frame-tilt > img {
        border-radius: var(--site-radius-lg, 20px);
        transform: rotate(-1.5deg);
        transition: transform 0.5s ease;
    }

    .ec-frame-tilt:hover > img { transform: rotate(0deg); }
}

/* Everything above is decoration; none of it should move for a reader who
   asked their system to stop animating things. */
@media (prefers-reduced-motion: reduce) {
    .ec-marquee-track,
    .ec-nav-item::after,
    .ec-focus-item,
    .ec-frame-tilt > img,
    .ec-jersey-card,
    .ec-jersey-inner {
        animation: none !important;
        transition: none !important;
    }
}

[data-animations="false"] .ec-marquee-track {
    animation: none !important;
}
