/* ============================================
   Homepage Stylesheet
   Design tokens, reset, brand hero, shared section
   styles, footer, scroll animations, and responsive
   rules. Mobile-first layout for landing page.

   BRAND: "It's Knotty" — dating app playing on
   "tie the knot" + "naughty." Visual identity:
   warm, romantic, playful with dramatic depth.
   ============================================ */

/* ----------------------------------------
   CSS Custom Properties (Design Tokens)
   ---------------------------------------- */
:root {
    /* Colors — Brand Palette */
    --color-bg-primary: #fdf8f4;
    --color-bg-surface: #ffffff;
    --color-bg-alt: #f7f0e8;
    --color-bg-elevated: #f5efe7;
    --color-bg-dark: #1a1210;

    /* Text Colors */
    --color-text-primary: #1a1210;
    --color-text-secondary: #5c544d;
    --color-text-tertiary: #9a9088;
    --color-text-inverse: #fdf8f4;
    --color-text-on-dark: #ffffff;

    /* Accent — Vietnamese Flower Garden Palette
       Inspired by hoa sen (lotus), hoa lan (orchid),
       chrysanthemum gold, tropical water lilies & jade foliage */
    --color-gold: #d4a940;
    --color-gold-hover: #c99b2e;
    --color-gold-light: rgba(212, 169, 64, 0.1);
    --color-lotus: #9b2d7b;
    --color-lotus-light: rgba(155, 45, 123, 0.08);
    --color-orchid: #7b4bbf;
    --color-orchid-light: rgba(123, 75, 191, 0.08);
    --color-tropical: #2486a5;
    --color-tropical-light: rgba(36, 134, 165, 0.08);
    --color-jade: #2d8659;
    --color-jade-light: rgba(45, 134, 89, 0.08);
    --color-crimson: #c0392b;
    --color-crimson-light: rgba(192, 57, 43, 0.08);

    /* Gradients — Multi-Color Flower Accent */
    --gradient-flower: linear-gradient(135deg, var(--color-lotus), var(--color-orchid), var(--color-tropical), var(--color-jade));
    --gradient-flower-h: linear-gradient(90deg, var(--color-lotus), var(--color-orchid), var(--color-tropical), var(--color-jade));

    /* Gradient — Hero Background (warm romantic tones) */
    --gradient-hero: linear-gradient(
        135deg,
        #fdf8f4 0%,
        #f5e6f0 25%,
        #ede0f5 50%,
        #e0eef5 75%,
        #fdf8f4 100%
    );

    /* Gradient — Brand Wordmark */
    --gradient-wordmark: linear-gradient(
        135deg,
        var(--color-lotus),
        var(--color-orchid) 40%,
        var(--color-gold) 70%,
        var(--color-lotus) 100%
    );

    /* Semantic Colors */
    --color-success: #2d8659;
    --color-success-bg: rgba(45, 134, 89, 0.08);
    --color-success-border: rgba(45, 134, 89, 0.2);
    --color-error: #c0392b;
    --color-error-bg: rgba(192, 57, 43, 0.08);
    --color-error-border: rgba(192, 57, 43, 0.2);

    /* Overlays */
    --color-overlay-dark: rgba(26, 18, 16, 0.75);
    --color-overlay-black: rgba(0, 0, 0, 0.5);

    /* Borders */
    --color-border: rgba(26, 18, 16, 0.08);
    --color-border-hover: rgba(26, 18, 16, 0.15);
    --color-border-gold: rgba(212, 169, 64, 0.3);

    /* Typography */
    --font-heading: 'Playfair Display', 'Georgia', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.75rem;
    --font-size-5xl: 3.5rem;
    --font-size-hero: clamp(3rem, 8vw, 5.5rem);

    /* Font Weights */
    --fw-light: 300;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
    --spacing-4xl: 6rem;
    --spacing-5xl: 8rem;

    /* Border Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(26, 18, 16, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 18, 16, 0.08);
    --shadow-lg: 0 8px 32px rgba(26, 18, 16, 0.12);
    --shadow-glow-lotus: 0 0 80px rgba(155, 45, 123, 0.12);
    --shadow-glow-orchid: 0 0 80px rgba(123, 75, 191, 0.10);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index */
    --z-base: 1;
    --z-fab: 100;

    /* Container */
    --container-max: 1080px;
    --container-padding: 1.5rem;
}

/* ----------------------------------------
   Reset & Base
   ---------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: var(--fw-regular);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-gold-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Touch & Mobile Interaction */
a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

a,
button {
    touch-action: manipulation;
}

*:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

/* ----------------------------------------
   Utilities
   ---------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ----------------------------------------
   Split Layout — Two-panel homepage
   ---------------------------------------- */
.homepage-split {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.homepage-split > .section {
    flex: 1 0 auto;
    min-height: 50vh;
    display: flex;
    align-items: center;
}

.homepage-split > .section-auth {
    padding: 0;
}

.homepage-split > .section-contact {
    padding: var(--spacing-lg) 0;
}

/* ----------------------------------------
   Auth Section — Hero with brand identity
   ---------------------------------------- */
.section-auth {
    position: relative;
    background: var(--gradient-hero);
    text-align: center;
    overflow: hidden;
}

/* ── Animated ambient background orbs ── */
.auth-bg-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orbFloat 20s ease-in-out infinite;
}

.auth-bg-orb--1 {
    width: clamp(200px, 40vw, 500px);
    height: clamp(200px, 40vw, 500px);
    background: radial-gradient(circle, rgba(155, 45, 123, 0.3), transparent 70%);
    top: -10%;
    right: -5%;
    animation-duration: 22s;
}

.auth-bg-orb--2 {
    width: clamp(150px, 30vw, 400px);
    height: clamp(150px, 30vw, 400px);
    background: radial-gradient(circle, rgba(123, 75, 191, 0.25), transparent 70%);
    bottom: -5%;
    left: -5%;
    animation-duration: 18s;
    animation-delay: -7s;
}

.auth-bg-orb--3 {
    width: clamp(100px, 20vw, 300px);
    height: clamp(100px, 20vw, 300px);
    background: radial-gradient(circle, rgba(212, 169, 64, 0.2), transparent 70%);
    top: 40%;
    left: 50%;
    animation-duration: 25s;
    animation-delay: -12s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 15px) scale(0.95); }
    75% { transform: translate(15px, 25px) scale(1.03); }
}

/* ── Hero content layout ── */
.section-auth .container {
    position: relative;
    z-index: var(--z-base);
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xl);
    width: 100%;
    max-width: 480px;
}

/* ── Brand Wordmark ── */
.brand-wordmark {
    font-family: var(--font-heading);
    font-size: var(--font-size-hero);
    font-weight: var(--fw-bold);
    font-style: italic;
    line-height: 1;
    letter-spacing: -0.03em;
    background: var(--gradient-wordmark);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: wordmarkShimmer 8s ease-in-out infinite;
}

@keyframes wordmarkShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ── Tagline ── */
.brand-tagline {
    font-family: var(--font-body);
    font-size: clamp(var(--font-size-sm), 2.5vw, var(--font-size-lg));
    font-weight: var(--fw-light);
    color: var(--color-text-secondary);
    letter-spacing: 0.04em;
    max-width: 360px;
}

/* ── Decorative divider below tagline ── */
.brand-divider {
    width: 48px;
    height: 2px;
    border: none;
    background: var(--gradient-flower-h);
    border-radius: var(--radius-full);
    opacity: 0.6;
}

/* ── Auth content (JS-injected buttons) ── */
.auth-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    width: 100%;
    max-width: 320px;
}

/* ----------------------------------------
   Shared Section Styles
   ---------------------------------------- */
.section {
    padding: var(--spacing-5xl) 0;
}

.section-label {
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--spacing-md);
    background: var(--gradient-flower-h);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-heading {
    font-family: var(--font-heading);
    font-size: var(--font-size-3xl);
    font-weight: var(--fw-medium);
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-lg);
}

.section-intro {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-width: 680px;
    margin-bottom: var(--spacing-3xl);
}

/* ============================================
   APPLE-STYLE SCROLL ANIMATIONS
   Reveal-on-scroll with staggered delays
   and cinematic transitions.
   All driven by IntersectionObserver via JS.
   ============================================ */

/* ── Base hidden state for all reveal elements ── */
[data-reveal] {
    opacity: 0;
    will-change: opacity, transform;
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Delay tiers — set by data-delay or data-stagger */
[data-reveal][data-delay="1"],
[data-reveal][data-stagger="1"] { transition-delay: 0.1s; }
[data-reveal][data-delay="2"],
[data-reveal][data-stagger="2"] { transition-delay: 0.2s; }
[data-reveal][data-delay="3"],
[data-reveal][data-stagger="3"] { transition-delay: 0.3s; }
[data-reveal][data-delay="4"],
[data-reveal][data-stagger="4"] { transition-delay: 0.4s; }
[data-reveal][data-delay="5"],
[data-reveal][data-stagger="5"] { transition-delay: 0.5s; }

/* ── Fade Up — default reveal: slide up 40px ── */
[data-reveal="fade-up"] {
    transform: translateY(40px);
}

/* ── Fade — opacity only ── */
[data-reveal="fade"] {
    transform: none;
}

/* ── Scale — divider / decorative elements ── */
[data-reveal="scale"] {
    transform: scaleX(0);
}

/* ── Visible state — applied by JS ── */
[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0) scaleX(1);
}

/* ----------------------------------------
   Mobile Responsive (max-width: 768px)
   ---------------------------------------- */
@media (max-width: 768px) {
    .section-heading {
        font-size: var(--font-size-2xl);
    }

    .homepage-split > .section-contact {
        padding: var(--spacing-xl) 0;
    }
}

/* ----------------------------------------
   Small Mobile (max-width: 480px)
   ---------------------------------------- */
@media (max-width: 480px) {
    :root {
        --container-padding: 1.25rem;
    }

    .section {
        padding: var(--spacing-4xl) 0;
    }
}

/* ----------------------------------------
   Safe Area Insets (Notched Phones)
   ---------------------------------------- */
@supports (padding: env(safe-area-inset-bottom)) {
    .section-contact {
        padding-bottom: calc(var(--spacing-2xl) + env(safe-area-inset-bottom));
    }
}

/* ----------------------------------------
   Reduced Motion
   ---------------------------------------- */
@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;
    }

    [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .auth-bg-orb {
        animation: none !important;
        opacity: 0.2 !important;
    }

    .brand-wordmark {
        animation: none !important;
    }
}
