/* Carlson Gracie BC - Custom Styles */
/* Tech Stack: Tailwind 4 + HTMX 2 + Alpine.js 3 + AOS */

/* ==================== BASE ==================== */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #dc2626 #f1f1f1;
}

::selection {
    background: #dc2626;
    color: white;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #dc2626; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b91c1c; }

/* ==================== SKIP TO CONTENT ==================== */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: #dc2626;
    color: white;
    padding: 0.75rem 1.5rem;
    z-index: 10000;
    border-radius: 0 0 0.5rem 0.5rem;
    font-weight: 600;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* ==================== NAV UNDERLINE MICROANIMATION ==================== */
.nav-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #dc2626;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover .nav-underline,
.nav-link.active .nav-underline {
    width: 100%;
}

/* ==================== HEADER ==================== */
.header-scrolled {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ==================== BTN PRIMARY SHIMMER ==================== */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Card hover now uses Tailwind utilities in markup */

/* Hero video & overlay now use Tailwind utilities in markup */

/* ==================== GLITCH EFFECT ==================== */
.glitch-container { position: relative; overflow: hidden; }
.glitch-logo { filter: brightness(1.1); transition: all 0.3s ease; }
.glitch-layer-1, .glitch-layer-2 { opacity: 0; pointer-events: none; }

.glitch-container:hover .glitch-logo { animation: glitch 0.5s infinite; }
.glitch-container:hover .glitch-layer-1 { animation: glitch-1 0.5s infinite; opacity: 0.8; filter: hue-rotate(90deg) brightness(1.5); }
.glitch-container:hover .glitch-layer-2 { animation: glitch-2 0.5s infinite; opacity: 0.8; filter: hue-rotate(180deg) brightness(1.2); }

.glitch-container.glitch-active .glitch-logo { animation: glitch 0.5s infinite; }
.glitch-container.glitch-active .glitch-layer-1 { animation: glitch-1 0.5s infinite; opacity: 0.8; filter: hue-rotate(90deg) brightness(1.5); }
.glitch-container.glitch-active .glitch-layer-2 { animation: glitch-2 0.5s infinite; opacity: 0.8; filter: hue-rotate(180deg) brightness(1.2); }

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-2px, 2px); }
    20% { transform: translate(-2px, -2px); }
    30% { transform: translate(2px, 2px); }
    40% { transform: translate(2px, -2px); }
    50% { transform: translate(-2px, 2px); }
    60% { transform: translate(-2px, -2px); }
    70% { transform: translate(2px, 2px); }
    80% { transform: translate(-2px, -2px); }
    90% { transform: translate(2px, 2px); }
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); clip: rect(0,9999px,0,0); }
    10% { transform: translate(-3px, 1px); clip: rect(10px,9999px,20px,0); }
    30% { transform: translate(-1px, 3px); clip: rect(50px,9999px,60px,0); }
    50% { transform: translate(-3px, 1px); clip: rect(90px,9999px,100px,0); }
    70% { transform: translate(-1px, 3px); clip: rect(130px,9999px,140px,0); }
    90% { transform: translate(-3px, 1px); clip: rect(170px,9999px,180px,0); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); clip: rect(0,9999px,0,0); }
    15% { transform: translate(2px, -2px); clip: rect(5px,9999px,15px,0); }
    35% { transform: translate(2px, 2px); clip: rect(45px,9999px,55px,0); }
    55% { transform: translate(2px, -2px); clip: rect(85px,9999px,95px,0); }
    75% { transform: translate(2px, 2px); clip: rect(125px,9999px,135px,0); }
    95% { transform: translate(2px, -2px); clip: rect(165px,9999px,175px,0); }
}

/* Timetable tabs now handled by Alpine.js + Tailwind */

/* Class badges now use Tailwind utilities in markup */

/* Gallery items now use Tailwind utilities in markup */

/* ==================== FORM FOCUS ==================== */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
    border-color: #dc2626 !important;
}

/* ==================== LOADING / SKELETON ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.5rem;
}

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

/* ==================== HTMX INDICATORS ==================== */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* ==================== MICROANIMATIONS ==================== */
/* fadeInUp and pulse-subtle available if needed via Tailwind or AOS */

/* Gradients now use Tailwind bg-gradient-* utilities */

/* sr-only provided by Tailwind */

/* ==================== AOS OVERRIDES ==================== */
[data-aos] {
    pointer-events: auto !important;
}

/* Ensure AOS doesn't hide content on no-JS */
.no-js [data-aos] {
    opacity: 1 !important;
    transform: none !important;
}
