/* ============================================
   FACES OF FRIENDSHIP - ENHANCED STYLES
   Warm Modernism Aesthetic
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* ============================================
   GRAIN TEXTURE & ATMOSPHERIC EFFECTS
   ============================================ */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

.blob-bg {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(242, 142, 142, 0.4) 0%, rgba(242, 142, 142, 0) 50%),
        radial-gradient(circle at 90% 80%, rgba(30, 113, 122, 0.3) 0%, rgba(30, 113, 122, 0) 50%),
        radial-gradient(circle at 50% 50%, rgba(249, 242, 235, 0.1) 0%, rgba(249, 242, 235, 0) 100%);
}

/* Enhanced gradient for hero sections */
.hero-gradient {
    background:
        radial-gradient(ellipse at top left, rgba(242, 142, 142, 0.15), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(30, 113, 122, 0.15), transparent 50%);
}

/* ============================================
   SOPHISTICATED ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(242, 142, 142, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(242, 142, 142, 0.5);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Animation utility classes —
   Use animation-fill-mode inside the keyframes (start at 0 opacity)
   so the element is hidden only while the animation is pending/running,
   not via a separate opacity rule that can flash before CSS is parsed. */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out both;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out both;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out both;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out both;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Elements that will be stagger-animated by JS start hidden */
[data-stagger] {
    opacity: 0;
}

/* Stagger delays for sequential animations */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.animate-delay-1000 { animation-delay: 1s; }

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   ENHANCED CARD INTERACTIONS
   ============================================ */

.card-hover {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.card-hover::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: linear-gradient(135deg, rgba(242, 142, 142, 0.1), rgba(30, 113, 122, 0.1));
    pointer-events: none;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.2);
}

.card-hover:hover::before {
    opacity: 1;
}

/* Event card specific enhancements */
.event-card {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.event-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.event-card:hover::after {
    left: 100%;
}

.event-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 70px -15px rgba(30, 113, 122, 0.4);
}

/* ============================================
   ENHANCED BUTTONS
   ============================================ */

.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* Magnetic button effect */
.btn-magnetic {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   DECORATIVE ELEMENTS
   ============================================ */

.decorative-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.decorative-circle-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(242, 142, 142, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.decorative-circle-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(30, 113, 122, 0.12), transparent 70%);
    bottom: -50px;
    left: -50px;
    animation: float 10s ease-in-out infinite reverse;
}

/* Geometric decorative patterns */
.pattern-dots {
    background-image: radial-gradient(circle, rgba(30, 113, 122, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.pattern-grid {
    background-image:
        linear-gradient(rgba(30, 113, 122, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 113, 122, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* ============================================
   ENHANCED SHADOWS & DEPTH
   ============================================ */

.shadow-lifted {
    box-shadow:
        0 10px 40px -10px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.02);
}

.shadow-dreamy {
    box-shadow:
        0 20px 60px -20px rgba(30, 113, 122, 0.3),
        0 10px 30px -10px rgba(242, 142, 142, 0.2);
}

.shadow-intense {
    box-shadow:
        0 30px 90px -30px rgba(0, 0, 0, 0.4),
        0 10px 40px -10px rgba(30, 113, 122, 0.3);
}

/* ============================================
   IMAGE EFFECTS
   ============================================ */

.image-parallax {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-container:hover .image-parallax {
    transform: scale(1.05);
}

.image-glow {
    position: relative;
}

.image-glow::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: inherit;
    filter: blur(40px);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.image-glow:hover::after {
    opacity: 0.6;
}

/* ============================================
   HEADER ENHANCEMENTS
   ============================================ */

.header-blur {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* ============================================
   DARK MODE SPECIFIC ENHANCEMENTS
   ============================================ */

html.dark .blob-bg {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(242, 142, 142, 0.2) 0%, rgba(242, 142, 142, 0) 50%),
        radial-gradient(circle at 90% 80%, rgba(30, 113, 122, 0.25) 0%, rgba(30, 113, 122, 0) 50%);
}

html.dark body::before {
    opacity: 0.05;
    mix-blend-mode: soft-light;
}

/* Dark mode icon toggling */
html.dark .dark-icon {
    display: none;
}

html.dark .light-icon {
    display: inline;
}

html:not(.dark) .light-icon {
    display: none;
}

html:not(.dark) .dark-icon {
    display: inline;
}

/* ============================================
   LOADING STATES
   ============================================ */

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

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(249, 242, 235, 0.1) 0%,
        rgba(249, 242, 235, 0.3) 50%,
        rgba(249, 242, 235, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background-light);
}

::-webkit-scrollbar-thumb {
    background: rgba(30, 113, 122, 0.3);
    border-radius: 6px;
    border: 2px solid var(--background-light);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(30, 113, 122, 0.5);
}

html.dark ::-webkit-scrollbar-track {
    background: var(--background-dark);
}

html.dark ::-webkit-scrollbar-thumb {
    border-color: var(--background-dark);
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */

.text-gradient {
    background: linear-gradient(135deg, #1E717A 0%, #F28E8E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow-soft {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.backdrop-blur-glass {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.transition-smooth {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.transform-gpu {
    transform: translateZ(0);
    will-change: transform;
}

.access-denied-debug {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f8f8;
    border: 1px solid #ccc;
    font-family: monospace;
    font-size: 0.85rem;
}

/* ============================================
   FORM VALIDATION STATES
   jQuery unobtrusive validation applies
   .input-validation-error to invalid inputs and
   .field-validation-error to the <span> messages.
   ============================================ */

input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    border-color: #dc2626;
    border-width: 2px;
    background-color: rgba(254, 226, 226, 0.4);
}

input.input-validation-error:focus,
select.input-validation-error:focus,
textarea.input-validation-error:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

html.dark input.input-validation-error,
html.dark select.input-validation-error,
html.dark textarea.input-validation-error {
    border-color: #f87171;
    background-color: rgba(127, 29, 29, 0.25);
}

html.dark input.input-validation-error:focus,
html.dark select.input-validation-error:focus,
html.dark textarea.input-validation-error:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.field-validation-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: #dc2626;
}

html.dark .field-validation-error {
    color: #f87171;
}

.field-validation-valid {
    display: none;
}

/* Prevent animation jank */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   REDUCED MOTION ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .animate-float,
    .decorative-circle-1,
    .decorative-circle-2 {
        animation: none !important;
    }
}

/* ============================================
   LEGAL DOCUMENTS (/terms, /privacy, /community-guidelines)
   ============================================ */

.legal-document a {
    color: #1E717A;
}

.dark .legal-document a {
    color: #7fc4cb;
}

.legal-document a:focus-visible {
    outline: 2px solid #1E717A;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Clear the fixed header when jumping to a section anchor. */
.legal-document [id] {
    scroll-margin-top: 6rem;
}

/* Wide tables scroll inside the card instead of widening the page on phones. */
.legal-document table {
    display: block;
    overflow-x: auto;
}

/* ============================================
   CAPACITY BAR (admin events)
   A <progress> element instead of an inline style="width: …%", which the CSP
   (style-src 'self') blocks.
   ============================================ */

progress.capacity-bar {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 6rem;
    height: 0.5rem;
    border: 0;
    border-radius: 9999px;
    overflow: hidden;
    background-color: #e5e7eb;
    color: #1E717A;
}

progress.capacity-bar::-webkit-progress-bar {
    background-color: #e5e7eb;
    border-radius: 9999px;
}

progress.capacity-bar::-webkit-progress-value {
    background-color: #1E717A;
    border-radius: 9999px;
}

progress.capacity-bar::-moz-progress-bar {
    background-color: #1E717A;
    border-radius: 9999px;
}

.dark progress.capacity-bar,
.dark progress.capacity-bar::-webkit-progress-bar {
    background-color: #374151;
}
