@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: rtl;
        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);
    }

    /* ─── 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;
    }
}
