@import '../common.css';

/* ============================================
   SCROLL LOCK (used during intro)
   ============================================ */
html.no-scroll,
body.no-scroll {
    overflow: hidden !important;
}

/* ============================================
   INDEX PAGE BODY BACKGROUND
   Loaded via external CSS (not inline critical) so
   the texture never flashes before the intro covers it.
   ============================================ */
body.index-home {
    background-color: #000;
    background-image: linear-gradient(rgba(0,0,0,0.80), rgba(0,0,0,0.80)),
                      url('/assets/concrete-wall-texture.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ============================================
   INTRO SCREEN
   ============================================ */

/* Hero Section - Now part of natural page flow */
#intro-screen {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh; /* svh = stable, won't shift when address bar hides */
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

/* Removed fade-out - hero stays visible and scrollable */

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.intro-content.hidden {
    opacity: 0;
}

.signature-container {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    position: relative;
    width: 100%;
}

/* ============================================
   SVG HANDWRITING / TATTOO STROKE EFFECT
   Text is revealed progressively via an animated
   SVG mask path — a glowing pen tip traces over
   each letter, leaving the filled text visible
   behind it, exactly like real handwriting.
   ============================================ */

.signature-svg {
    width: 96vw; /* Fallback: Safari <13.1, Chrome <79 */
    width: min(96vw, 1200px);
    height: auto;
    max-height: 9rem; /* Fallback */
    max-height: clamp(4rem, 14vw, 9rem);
    overflow: visible;
    display: block;
    max-width: 96vw;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

.signature-svg text,
.signature-svg tspan {
    text-rendering: geometricPrecision;
}

.signature-static {
    font-family: 'Excellent Display', sans-serif !important;
    font-size: 7rem; /* Fallback */
    font-size: clamp(4rem, 14vw, 9rem);
    line-height: 1;
    white-space: nowrap;
    display: inline-block;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

.signature-static .sig-white {
    color: #ffffff;
}

.signature-static .sig-red {
    color: #aa183c;
}

/* After animation: subtle glow on the red portion */
.signature-svg.anim-done .sig-red-glow {
    opacity: 1;
    transition: opacity 0.8s ease;
}

.sig-red-glow {
    opacity: 0;
}

.subtitle-container {
    margin-top: 10px;
}

.intro-subtitle {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    opacity: 0;
}

.intro-subtitle.animate {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Scroll arrow */
.scroll-arrow {
    position: absolute;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
}
/* Flex-gap fallback */
.scroll-arrow > * + * { margin-top: 10px; }
@supports (gap: 1px) { .scroll-arrow > * + * { margin-top: 0; } }

.scroll-arrow.animate {
    animation: fadeInUp 1s ease-out forwards, float 2s ease-in-out 1s infinite;
}

.scroll-arrow:hover {
    color: var(--accent-tertiary-sat);
}

.scroll-arrow span {
    font-size: 0.75rem;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ACCESSIBILITY - SEO RELEVANT
   ============================================ */

/* Skip link - visible on focus only */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--accent-tertiary-sat);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0 0 8px 8px;
    z-index: 100001;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

/* Touch optimizations */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Safe area for notched devices (iPhone X+) */
@supports (padding: env(safe-area-inset-top)) {
    .scroll-arrow {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* Mobile-first media queries */
@media screen and (max-width: 768px) {
    .signature-container {
        font-size: 2.5rem; /* Fallback */
        font-size: clamp(1.6rem, 8vw, 3.5rem);
        padding: 5px 10px;
    }

    .intro-subtitle {
        font-size: 0.7rem;
        letter-spacing: 0.3rem;
    }

    .scroll-arrow {
        bottom: 40px;
    }

    .scroll-arrow span {
        font-size: 0.65rem;
        letter-spacing: 0.2rem;
    }

    .scroll-arrow svg {
        width: 20px;
        height: 20px;
    }
}

@media screen and (max-width: 480px) {
    .signature-container {
        font-size: 2rem; /* Fallback */
        font-size: clamp(1.4rem, 7.5vw, 2.5rem);
    }

    .intro-subtitle {
        font-size: 0.6rem;
        letter-spacing: 0.2rem;
    }

    .scroll-arrow {
        bottom: 30px;
        gap: 6px;
    }
}

/* Large touch targets for mobile (min 44x44px) */
@media (pointer: coarse) {
    .scroll-arrow {
        min-height: 44px;
        padding: 10px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-arrow.animate {
        animation: fadeInUp 0.01ms ease-out forwards;
    }
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    position: relative;
    z-index: 1;
    background: transparent;
    /* Allow particles to show through */
    /* Visible by default - natural page flow */
}

.main-content.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   SECTION BASE STYLES
   ============================================ */

.section {
    position: relative;
    padding: 6rem 0;
    overflow: hidden;
}

/* New Red Gradient Separator */
.section-separator {
    width: 100%;
    max-width: 1000px;
    height: 4px;
    margin: 0 auto;
    background: radial-gradient(ellipse at center, rgba(200, 30, 30, 1) 30%, rgba(200, 30, 30, 0) 80%);
    border-radius: 100%;
    opacity: 0.9;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 0 8px rgba(255, 50, 50, 0.4));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-separator.in-view {
    transform: scaleX(1);
}

/* Section title with script + main combo */
.section-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 2rem;
}
/* Flex-gap fallback */
.section-title > * + * { margin-top: 0.25rem; }
@supports (gap: 1px) { .section-title > * + * { margin-top: 0; } }

.title-script {
    font-family: var(--font-script);
    font-size: 2rem; /* Fallback */
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.title-main {
    font-family: var(--font-heading);
    font-size: 2.5rem; /* Fallback */
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 500;
}

/* ============================================
   ORNAMENTS
   ============================================ */

/* ============================================
   ORNAMENTS
   ============================================ */

.ornament {
    position: absolute;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}

.ornament--top {
    top: 0;
    transform: translateY(-50%);
}

.ornament--bottom {
    bottom: 0;
    transform: translateY(50%);
}

.ornament-svg {
    width: 200px; /* Fallback */
    width: clamp(150px, 40vw, 250px);
    height: 20px;
    color: var(--accent-tertiary);
    /* Burgundy */
    opacity: 0.8;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ============================================
   SECTION: PHILOSOPHY (¿Qué es A2Tintas?)
   ============================================ */

.section--philosophy {
    padding: 2rem 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(10, 10, 10, 0.65) 50%,
            rgba(0, 0, 0, 0.6) 100%);
}

.philosophy-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.philosophy-quote {
    margin: 3rem 0;
    padding: 2rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle border */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    /* Subtle gray tint instead of burgundy */
}

.philosophy-quote p {
    font-family: var(--font-script);
    font-size: 1.8rem; /* Fallback */
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    color: var(--text-primary);
    font-style: italic;
    line-height: 1.4;
}

.philosophy-text {
    text-align: left;
}

.philosophy-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.philosophy-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.philosophy-text em {
    color: var(--text-primary);
    /* White instead of burgundy */
    font-style: italic;
}

/* ============================================
   SECTION: TEAM (Quiénes Somos)
   ============================================ */

.section--team {
    padding: 8rem 0;
    background: rgba(10, 10, 10, 0.65);
    /* More transparent for particles */
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Artist Card */
.artist-card {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Hover only applies AFTER card is revealed */
.artist-card.in-view {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.5s ease;
}

/* Light reflection overlay */
.artist-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.06) 0%,
        transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.artist-card:hover::after {
    opacity: 1;
}

.artist-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 255, 255, 0.03);
}

.artist-image-wrapper {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
}

/* Fallback for browsers without aspect-ratio (older iOS Safari) */
@supports not (aspect-ratio: 3/4) {
    .artist-image-wrapper {
        height: 0;
        padding-bottom: 133.33%; /* 4/3 ratio */
    }
}

.artist-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.artist-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-script);
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg,
            var(--bg-tertiary) 0%,
            rgba(0, 0, 0, 0.4) 100%);
    /* Neutral gradient */
}

.artist-overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: linear-gradient(180deg,
            transparent 40%,
            rgba(0, 0, 0, 0.9) 100%);
    opacity: 0.7;
    transition: opacity 0.4s ease;
}

.artist-card:hover .artist-overlay {
    opacity: 0.5;
}

.artist-info {
    padding: 1.5rem;
    text-align: center;
}

.artist-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0.5rem;
}

.artist-ornament {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0;
}

.artist-ornament svg {
    width: 80px;
    height: 12px;
    color: var(--accent-tertiary-sat);
}

.artist-specialty {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.artist-specialty strong {
    color: var(--text-primary);
}

.artist-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.artist-detail strong {
    color: var(--text-secondary);
}

.artist-social {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.artist-instagram-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.3s ease;
}
/* Flex-gap fallback */
.artist-instagram-link > * + * { margin-left: 8px; }
@supports (gap: 1px) { .artist-instagram-link > * + * { margin-left: 0; } }

.artist-instagram-link:hover {
    color: var(--accent-tertiary-sat);
    border-color: var(--accent-tertiary-sat);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.artist-instagram-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.artist-instagram-link:hover svg {
    transform: scale(1.1);
}

/* ============================================
   SECTION: GALLERY
   ============================================ */

.section--gallery {
    padding: 8rem 0;
    background: rgba(0, 0, 0, 0.6);
    /* More transparent for particles */
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.gallery-item--tall {
    grid-row: span 2;
}

.gallery-item--wide {
    grid-column: span 2;
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-script);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(145deg,
            var(--bg-tertiary) 0%,
            var(--bg-secondary) 100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover .gallery-placeholder {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background: linear-gradient(180deg,
            transparent 50%,
            rgba(0, 0, 0, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-artist {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Old selector styles removed - see selector.css */

/* ============================================
   REVEAL ANIMATIONS (Premium)
   ============================================ */

.reveal-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-text.in-view {
    opacity: 1;
    transform: translateY(0);
}

.reveal-fade {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-fade.in-view {
    opacity: 1;
    transform: translateY(0);
}

.reveal-card {
    opacity: 0;
    transform: perspective(1000px) rotateX(8deg) translateY(40px);
    transform-origin: bottom center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-card.in-view {
    opacity: 1;
    transform: perspective(1000px) rotateX(0deg) translateY(0);
}

.reveal-gallery {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-gallery.in-view {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Stagger delays */
.reveal-card[data-delay="1"],
.reveal-gallery[data-delay="1"] {
    transition-delay: 0.15s;
}

.reveal-card[data-delay="2"],
.reveal-gallery[data-delay="2"] {
    transition-delay: 0.3s;
}

.reveal-gallery[data-delay="3"] {
    transition-delay: 0.45s;
}

.reveal-gallery[data-delay="4"] {
    transition-delay: 0.6s;
}

.reveal-gallery[data-delay="5"] {
    transition-delay: 0.75s;
}

/* ============================================
   RESPONSIVE: TABLET
   ============================================ */

@media screen and (max-width: 900px) {
    .section {
        padding: 5rem 0;
    }

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

    .gallery-item--tall {
        grid-row: span 2;
    }

    .gallery-item--wide {
        grid-column: span 2;
    }
}

/* ============================================
   RESPONSIVE: MOBILE
   ============================================ */

@media screen and (max-width: 600px) {
    .section {
        padding: 4rem 0;
    }

    .philosophy-quote {
        padding: 1.5rem 1rem;
        margin: 2rem 0;
    }

    .philosophy-quote p {
        font-size: 1.3rem;
    }

    .philosophy-text p {
        font-size: 1rem;
    }

    .team-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .artist-image-wrapper {
        aspect-ratio: 1/1;
    }

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

    .gallery-item--tall,
    .gallery-item--wide {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ============================================
   ADAPTIVE PERFORMANCE FALLBACKS
   Triggered by performance-monitor.js
   ============================================ */

/* PERF-REDUCED: Disable expensive effects, keep basic animations */
body.perf-reduced .section-separator {
    filter: none;
}

/* Disable the INFINITE float animation */
body.perf-reduced .scroll-arrow.animate {
    animation: fadeInUp 1s ease-out forwards;
    /* Remove infinite float */
}

/* Simplify char animation */
body.perf-reduced .char {
    filter: none;
    transform: none;
    animation: fadeIn 0.4s ease-out forwards;
}

body.perf-reduced .reveal-text,
body.perf-reduced .reveal-fade,
body.perf-reduced .reveal-card,
body.perf-reduced .reveal-gallery {
    transition-duration: 0.4s;
}

/* PERF-MINIMAL: Kill ALL animations and transitions */
body.perf-minimal *,
body.perf-minimal *::before,
body.perf-minimal *::after {
    animation: none !important;
    transition: none !important;
}

/* Show elements immediately instead of animating */
body.perf-minimal .char {
    filter: none !important;
    transform: none !important;
    opacity: 1 !important;
}

body.perf-minimal .intro-subtitle {
    opacity: 1 !important;
}

body.perf-minimal .scroll-arrow {
    opacity: 1 !important;
    transform: none !important;
}

body.perf-minimal .reveal-text,
body.perf-minimal .reveal-fade,
body.perf-minimal .reveal-card,
body.perf-minimal .reveal-gallery {
    opacity: 1 !important;
    transform: none !important;
}

body.perf-minimal .artist-card:hover,
body.perf-minimal .gallery-item:hover .gallery-placeholder {
    transform: none !important;
}

body.perf-minimal .section-separator {
    filter: none !important;
}

body.perf-minimal .ornament-svg {
    filter: none !important;
}

/* Remove all hover transforms in minimal mode */
body.perf-minimal a:hover,
body.perf-minimal button:hover {
    transf