@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    :root {
        /* Escala base (AGENTS.md) */
        --font-size-xs: 10px;
        --font-size-sm: 12px;
        --font-size-md: 14px;
        --font-size-lg: 15px;
        --font-size-xl: 16px;
        --font-size-2xl: 20px;
        --font-size-3xl: 32px;

        /* Roles semánticos — mobile (< 768px) */
        --type-display: 28px;
        --type-display-lh: 1.15;
        --type-display-sub: 15px;
        --type-heading: 22px;
        --type-section: 14px;
        --type-body: 14px;
        --type-body-lg: 14px;
        --type-caption: 11px;
        --type-label: 10px;
        --type-nav: 13px;
        --type-btn: 13px;
        --type-accordion-icon: 18px;
        --font-size-base: 14px;
        --line-height-base: 21px;
    }

    @media (min-width: 768px) {
        :root {
            /* Tablet (768px – 1023px) */
            --type-display: 36px;
            --type-display-sub: 17px;
            --type-heading: 24px;
            --type-section: 15px;
            --type-body-lg: 15px;
            --type-caption: 12px;
            --type-label: 11px;
            --type-nav: 14px;
            --type-btn: 12px;
            --type-accordion-icon: 20px;
            --font-size-base: 15px;
            --line-height-base: 22.5px;
        }
    }

    @media (min-width: 1024px) {
        :root {
            /* Desktop (≥ 1024px) */
            --type-display: 48px;
            --type-display-sub: 20px;
            --type-heading: 26px;
            --type-body-lg: 16px;
        }
    }

    * {
        @apply border-[#1a1a1a];
    }

    html {
        scroll-behavior: smooth;
    }

    body {
        font-family: 'Montserrat', sans-serif;
        font-size: var(--font-size-base);
        font-weight: 700;
        line-height: var(--line-height-base);
        color: #e5e5e5;
        background-color: #0F0F0F;
    }

    /* Custom scrollbar for Chrome, Safari, Edge (Chromium) */
    ::-webkit-scrollbar {
        width: 12px;
        height: 12px;
    }

    ::-webkit-scrollbar-track {
        background: #0F0F0F;
    }

    ::-webkit-scrollbar-thumb {
        background: #3ED410;
        border-radius: 6px;
        border: 2px solid #0F0F0F;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #68ef3f;
    }

    /* Custom scrollbar for Firefox */
    * {
        scrollbar-width: thin;
        scrollbar-color: #3ED410 #0F0F0F;
    }

    /* Custom scrollbar for IE/Edge (legacy) */
    body {
        scrollbar-face-color: #3ED410;
        scrollbar-track-color: #0F0F0F;
        scrollbar-arrow-color: #3ED410;
        scrollbar-shadow-color: #0F0F0F;
    }
}

@layer utilities {
    .text-primary {
        color: #cc3366;
    }

    .text-secondary {
        color: #252525;
    }

    .text-tertiary {
        color: #333333;
    }

    .text-inverse {
        color: #05e172;
    }

    .bg-surface-base {
        background-color: #000000;
    }

    .bg-surface-muted {
        background-color: #68ef3f;
    }

    .bg-surface-raised {
        background-color: #29ef79;
    }

    .bg-surface-strong {
        background-color: #1a1a1a;
    }

    .radius-xs {
        border-radius: 4px;
    }

    .radius-sm {
        border-radius: 100px;
    }

    /* Tipografía responsiva armónica */
    .type-display {
        font-size: var(--type-display);
        line-height: var(--type-display-lh);
    }

    .type-display-sub {
        font-size: var(--type-display-sub);
        line-height: 1.5;
    }

    .type-heading {
        font-size: var(--type-heading);
        line-height: 1.25;
    }

    .type-section {
        font-size: var(--type-section);
        line-height: 1.4;
    }

    .type-body {
        font-size: var(--type-body);
        line-height: 1.5;
    }

    .type-body-lg {
        font-size: var(--type-body-lg);
        line-height: 1.6;
    }

    .type-caption {
        font-size: var(--type-caption);
        line-height: 1.4;
    }

    .type-label {
        font-size: var(--type-label);
        line-height: 1.3;
    }

    .type-nav {
        font-size: var(--type-nav);
        line-height: 1.4;
    }

    .type-accordion-icon {
        font-size: var(--type-accordion-icon);
        line-height: 1;
    }

    .type-btn {
        font-size: var(--type-btn);
        line-height: 1.4;
    }

    /* Accesibilidad: texto solo para lectores de pantalla */
    .visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Skip link — WCAG 2.4.1 */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 100;
    padding: 8px 16px;
    background: #000000;
    color: #68ef3f;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid #68ef3f;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #05e172;
    outline-offset: 2px;
}

/* Foco no oculto por nav fija — WCAG 2.4.11 */
:target,
:focus {
    scroll-margin-top: 100px;
    scroll-margin-bottom: 24px;
}

/* Respeta preferencia de movimiento reducido — WCAG 2.3 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .carousel-slide {
        transition: none;
    }

    .neon-border::before,
    .neon-border::after {
        animation: none;
    }

    .entrance-animate {
        opacity: 1;
        animation: none;
    }
}

/* Objetivo táctil mínimo — WCAG 2.5.8 */
.icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.carousel-slide {
    position: absolute;
    inset: 0;
    transition: opacity 300ms ease-in-out;
}

.carousel-slide.opacity-0 {
    opacity: 0;
}

.carousel-slide.opacity-100 {
    opacity: 1;
}

#carousel-slides {
    position: relative;
    width: 100%;
    height: 75dvh;
    overflow: hidden;
    min-height: 660px;
}

#hero-carousel {
    width: 100%;
    height: 75dvh;
    min-height: 660px;
}

/* Focus visible styles */
*:focus-visible {
    outline: 3px solid #05e172;
    outline-offset: 2px;
}

/* Remove default outline but keep focus-visible */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Text truncation for game cards */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hero image styling */
.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Button active state scale */
button:active,
a:active {
    transform: scale(0.98);
    transition: transform 0.3s ease;
}

/* Smooth transitions for all links and buttons */
a,
button {
    transition: all 0.3s ease;
}

/* Animated Neon Border */
@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

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

.neon-border {
    position: relative;
    border-radius: 8px;
    background: #0A0F08;
    padding: 1px;
    overflow: hidden;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from var(--angle),
            transparent 0deg,
            transparent 280deg,
            #3ED410 320deg,
            #7FFF4A 340deg,
            #3ED410 360deg);
    border-radius: 8px;
    z-index: 0;
    animation: spin-border 6s linear infinite;
}

.neon-border::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from var(--angle),
            transparent 0deg,
            transparent 280deg,
            #3ED410 320deg,
            #7FFF4A 340deg,
            #3ED410 360deg);
    border-radius: 8px;
    z-index: -1;
    filter: blur(20px);
    opacity: 0.5;
    animation: spin-border 6s linear infinite;
}

.neon-border .content {
    position: relative;
    z-index: 1;
    background: #061800;
    border-radius: 6px;
    padding: 5px;
}


.neon-border:hover::after {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Details/summary animation */
details>summary {
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

/* Neon button effect */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.neon-btn {
    position: relative;
    padding: 9px 34px;
    border: none;
    border-radius: 5px;
    background: #061800;
    color: #68ef3f;
    border: 1px solid #68ef3f;
    font-weight: 600;
    font-size: var(--type-btn);
    line-height: 1.4;
    cursor: pointer;
    overflow: hidden;
    z-index: 1;
    transition: all 0.3s ease;
}

@media (max-width: 1023px) {
    .neon-btn {
        padding: 8px 16px;
    }
}

.neon-btn-lg {
    display: inline-block;
    position: relative;
    padding: 5px 24px;
    border: none;
    border-radius: 5px;
    background: #68ef3f;
    color: #061800;
    border: 1px solid #68ef3f;
    font-weight: 600;
    font-size: var(--type-btn);
    line-height: 1.4;
    cursor: pointer;
    overflow: hidden;
    z-index: 2;
    transition: all 0.3s ease;
    width: fit-content;
}

@media (max-width: 1023px) {
    .neon-btn-lg {
        padding: 10px 16px;
        text-align: center;
        width: 100%;
    }
}
.neon-btn-lg:hover {

    background: #061800;
    color: #68ef3f;

}

.neon-btn:hover {
    background: #68ef3f;
    color: #061800;

}

/* Premium Entrance Animations */
@keyframes slide-up-fade-in {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.entrance-animate {
    opacity: 0;
    animation: slide-up-fade-in 0.8s cubic-bezier(0.2, 1.0, 0.3, 1.0) forwards;
}

.entrance-animate-delay-1 {
    animation-delay: 0ms;
}

.entrance-animate-delay-2 {
    animation-delay: 100ms;
}

.entrance-animate-delay-3 {
    animation-delay: 200ms;
}

.entrance-animate-delay-4 {
    animation-delay: 300ms;
}

.entrance-animate-delay-5 {
    animation-delay: 400ms;
}

.entrance-animate-delay-6 {
    animation-delay: 500ms;
}

.entrance-animate-delay-7 {
    animation-delay: 600ms;
}

.entrance-animate-delay-8 {
    animation-delay: 700ms;
}