/* ==========================================================================
   Base - Reset, body, container, animations, accessibility
   ========================================================================== */

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Body & Background --- */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: #1a1a1a;
    background: #ffffff;
    position: relative;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 25%, rgba(240,240,240,0.3) 1px, transparent 1px),
        radial-gradient(circle at 80% 75%, rgba(240,240,240,0.2) 1px, transparent 1px),
        radial-gradient(circle at 45% 50%, rgba(240,240,240,0.15) 1px, transparent 1px);
    background-size: 60px 60px, 80px 80px, 100px 100px;
    z-index: -2;
    opacity: 0.4;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, transparent 0%, transparent 33%, rgba(245,245,245,0.1) 33.1%, rgba(245,245,245,0.1) 66%, transparent 66.1%),
        linear-gradient(45deg, transparent 0%, transparent 25%, rgba(250,250,250,0.1) 25.1%, rgba(250,250,250,0.1) 75%, transparent 75.1%);
    background-size: 120px 120px, 200px 200px;
    z-index: -1;
    opacity: 0.3;
}

/* --- Container --- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, #f0f0f0 10%, #f0f0f0 90%, transparent 100%);
    transform: translateX(-50%);
    z-index: -1;
}

.container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background:
        linear-gradient(90deg, transparent 0%, transparent 15%, rgba(248,248,248,0.3) 15.1%, rgba(248,248,248,0.3) 35%, transparent 35.1%, transparent 65%, rgba(252,252,252,0.2) 65.1%, rgba(252,252,252,0.2) 85%, transparent 85.1%);
    z-index: -1;
    pointer-events: none;
}


/* ==========================================================================
   Keyframe 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 fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

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

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

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

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

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

@keyframes checkmark {
    0%   { transform: scale(0) rotate(45deg); opacity: 0; }
    50%  { transform: scale(1.1) rotate(45deg); opacity: 1; }
    100% { transform: scale(1) rotate(45deg); opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
    50%      { box-shadow: 0 4px 25px rgba(0, 0, 0, 0.35), 0 0 40px rgba(0, 0, 0, 0.15); }
}

@keyframes modalEnter {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); max-height: 0; }
    to   { opacity: 1; transform: translateY(0); max-height: 100px; }
}

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutLeft {
    to { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideOutRight {
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}


/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */

/* --- Triggered animation classes (added by JS) --- */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.animate-in {
    opacity: 1;
}

.fade-in-up   { animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.fade-in-down { animation: fadeInDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.fade-in-left { animation: fadeInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.fade-in-right{ animation: fadeInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.fade-in      { animation: fadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.scale-in     { animation: scaleIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }

/* Initial hidden state for JS-triggered animations */
.fade-in-up,
.fade-in-down,
.fade-in-left,
.fade-in-right,
.fade-in,
.scale-in {
    opacity: 0;
    animation-fill-mode: both;
}

/* --- Stagger delays --- */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* --- Scroll-reveal initial states (visible after IntersectionObserver) --- */
.fade-in-up-scroll,
.fade-in-down-scroll,
.fade-in-left-scroll,
.fade-in-right-scroll,
.fade-in-scroll,
.scale-in-scroll {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-down-scroll  { transform: translateY(-30px); }
.fade-in-left-scroll  { transform: translateX(-30px); }
.fade-in-right-scroll { transform: translateX(30px); }
.scale-in-scroll      { transform: scale(0.9); }

/* --- Slide transition classes (used by auth modal view switching) --- */
.view-slide-out-left  { animation: slideOutLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.view-slide-out-right { animation: slideOutRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.view-slide-in-left   { animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.view-slide-in-right  { animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* --- Text transitions --- */
.text-fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Loading state --- */
.loading {
    opacity: 0.6;
    pointer-events: none;
}


/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus styles */
.action-button:focus-visible,
.feature:focus-visible,
.seeking-item:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* iOS Safari safe area support */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .form-input {
        border-width: 2px;
    }

    .form-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion - disable all animations and transitions */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll,
    .fade-in-up,
    .fade-in-down,
    .fade-in-left,
    .fade-in-right,
    .fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .why-accordion__body {
        transition: none !important;
    }
}
