/* ============================================================
   Life's Quotes — Public Styles
   Full-viewport scrolling quotes with particle background.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Theme-overridable colors (defaults = midnight-galaxy) */
    --white: var(--theme-text, #f1f1f1);
    --white-soft: var(--theme-text-soft, rgba(241, 241, 241, 0.85));
    --white-muted: var(--theme-text-muted, rgba(241, 241, 241, 0.45));
    --accent: var(--theme-accent, #a78bfa);
    --accent-soft: var(--theme-accent-soft, rgba(167, 139, 250, 0.2));
    --glass-bg: var(--theme-glass-bg, rgba(255, 255, 255, 0.04));
    --glass-border: var(--theme-glass-border, rgba(255, 255, 255, 0.08));
    --radius: 12px;
}

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--theme-bg, #0f0c29);
    color: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Particle Canvas ──────────────────────────────────────── */
.particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ── Navigation Bar ───────────────────────────────────────── */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 0.75rem 1.5rem;
    background: color-mix(in srgb, var(--theme-bg, #0f0c29) 60%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transition: transform 0.4s ease, opacity 0.4s ease;
    transform: translateY(-100%);
    opacity: 0;
}

.top-nav.visible {
    transform: translateY(0);
    opacity: 1;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--white-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    transition: color 0.3s;
    position: relative;
    padding: 0.25rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0; right: 0;
    height: 1px;
    background: var(--accent);
}

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem 0.6rem;
    background: color-mix(in srgb, var(--theme-bg, #0f0c29) 80%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.filter-bar.visible {
    transform: translateY(0);
    opacity: 1;
}

.filter-prompt {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-style: italic;
    color: var(--white-muted);
    letter-spacing: 0.04em;
    opacity: 0.7;
}

.filter-chips {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--white-muted);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--white);
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--white-soft);
}

/* Hidden quote when filtered out */
.quote-slide.filtered-out {
    display: none !important;
}

/* ── Quote Slides ─────────────────────────────────────────── */
.quote-scroll-container {
    position: relative;
    z-index: 1;
}

.quote-slide {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    position: relative;
    padding: 2rem;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.quote-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    animation: fadeInUp 0.8s ease;
}

.quote-text {
    font-family: var(--font-display);
    font-size: var(--quote-size-desktop, clamp(1.6rem, 4vw, 3rem));
    font-weight: 400;
    font-style: var(--quote-font-style, italic);
    line-height: 1.4;
    color: var(--white);
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 40px rgba(0, 0, 0, 0.3);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.quote-text::before { content: '\201C'; }
.quote-text::after { content: '\201D'; }

.quote-author {
    display: block;
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 300;
    font-style: normal;
    color: var(--white-muted);
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.quote-submitter {
    display: block;
    font-family: var(--font-body);
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    font-weight: 300;
    font-style: normal;
    color: var(--white-muted);
    opacity: 0.6;
    letter-spacing: 0.04em;
    margin-top: 0.5rem;
}

.quote-genre {
    display: block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 300;
    font-style: normal;
    color: var(--white-muted);
    opacity: 0.35;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 1.2rem;
}

/* ── Scroll Hint ──────────────────────────────────────────── */
.scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: bounce 2s infinite;
}

.scroll-hint span {
    font-size: 0.75rem;
    color: var(--white-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

.scroll-hint svg {
    color: var(--white-muted);
    opacity: 0.5;
}

.submit-cta {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: color 0.3s;
    border-bottom: 1px solid transparent;
}

.submit-cta:hover {
    color: var(--white);
    border-bottom-color: var(--accent);
}

/* ── Quote Counter ────────────────────────────────────────── */
.quote-counter {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 50;
    font-size: 0.75rem;
    color: var(--white-muted);
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

/* ── Page Layout (About, Submit) ──────────────────────────── */
.page-body {
    background: var(--theme-bg, #0f0c29);
    min-height: 100vh;
}

.page-container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 7rem 2rem 4rem;
}

/* ── Glass Cards ──────────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 3rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ── About Page ───────────────────────────────────────────── */
.about-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.about-lead {
    font-size: 1.15rem;
    color: var(--white-soft);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.about-content p {
    color: var(--white-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.8;
}

.about-content h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 500;
    margin: 2rem 0 0.75rem;
    color: var(--white);
}

.about-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.about-content a:hover {
    border-bottom-color: var(--accent);
}

.about-highlight {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 3px solid var(--accent);
    background: var(--theme-glass-bg, rgba(167, 139, 250, 0.05));
    border-radius: 0 var(--radius) var(--radius) 0;
}

.about-highlight blockquote {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--white-soft);
    margin-bottom: 0.5rem;
}

.about-highlight cite {
    font-size: 0.85rem;
    color: var(--white-muted);
    font-style: normal;
}

.about-cta {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

/* ── Submit Page ──────────────────────────────────────────── */
.submit-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.submit-lead {
    color: var(--white-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.submit-form .form-group {
    margin-bottom: 1.5rem;
}

.submit-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--white-soft);
    margin-bottom: 0.4rem;
}

.required { color: var(--accent); }
.optional { color: var(--white-muted); font-weight: 300; }

.submit-form input,
.submit-form textarea,
.submit-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.submit-form select option {
    background: var(--theme-bg, #0f0c29);
    color: var(--white);
}

.submit-form input:focus,
.submit-form textarea:focus,
.submit-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.submit-form textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-form input::placeholder,
.submit-form textarea::placeholder {
    color: var(--white-muted);
    opacity: 0.6;
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--white-muted);
    margin-top: 0.3rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--white-muted);
    margin-top: 0.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary,
.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn-primary:hover,
.btn-submit:hover {
    background: #8b6cf7;
    transform: translateY(-1px);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 2rem;
    background: transparent;
    color: var(--white-muted);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-decoration: none;
    transition: border-color 0.3s, color 0.3s;
}

.btn-ghost:hover {
    border-color: var(--white-muted);
    color: var(--white);
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert svg { flex-shrink: 0; margin-top: 0.1rem; }

.alert-success {
    background: rgba(63, 185, 80, 0.08);
    border: 1px solid rgba(63, 185, 80, 0.2);
    color: #3fb950;
}

.alert-error {
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.2);
    color: #f85149;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Always show nav on mobile */
    .top-nav {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
        padding: 0.6rem 1rem;
    }

    .filter-bar {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
        position: fixed;
        padding: 0.4rem 0.75rem 0.5rem;
    }

    .filter-prompt {
        font-size: 0.7rem;
    }

    .filter-chips {
        gap: 0.3rem;
    }

    .filter-chip {
        font-size: 0.68rem;
        padding: 0.25rem 0.55rem;
    }

    .nav-inner {
        justify-content: center;
        gap: 0.15rem 0.75rem;
    }

    .nav-brand {
        width: 100%;
        text-align: center;
        font-size: 1.2rem;
    }

    .nav-links {
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 0.5rem 0.75rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-link.active::after {
        bottom: -2px;
    }

    .quote-slide {
        padding: 0.75rem;
    }

    .quote-content {
        padding: 1.5rem 0.75rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        flex: 1;
        max-width: 100%;
        width: 100%;
    }

    .quote-text {
        font-size: var(--quote-size-mobile, clamp(2rem, 9vw, 3.5rem));
        font-weight: 500;
        padding: 0;
        line-height: 1.3;
        margin-bottom: 1.5rem;
        letter-spacing: -0.01em;
    }

    .quote-author {
        font-size: clamp(1rem, 3.5vw, 1.3rem);
        font-weight: 400;
        color: var(--white-soft);
        letter-spacing: 0.08em;
    }

    .scroll-hint {
        bottom: 1.25rem;
    }

    .scroll-hint span {
        font-size: 0.65rem;
        letter-spacing: 0.15em;
    }

    .scroll-hint span::before {
        content: 'swipe up';
    }

    /* Hide the default text on mobile, show "swipe up" */
    .scroll-hint .hint-text { display: none; }

    .scroll-hint svg {
        width: 20px;
        height: 20px;
    }

    .glass-card { padding: 2rem 1.5rem; }

    .page-container { padding: 6rem 1.25rem 3rem; }

    .form-row { grid-template-columns: 1fr; }

    .about-cta { flex-direction: column; }
    .about-cta a { text-align: center; }
}

/* ── Small phones (iPhone SE, etc.) ───────────────────────── */
@media (max-width: 480px) {
    .nav-brand { font-size: 1.2rem; }
    .quote-counter { bottom: 1rem; right: 1rem; }

    .quote-slide {
        padding: 0.5rem;
    }

    .quote-content {
        padding: 1rem 0.5rem;
    }

    .quote-text {
        font-size: var(--quote-size-small, clamp(2.2rem, 10vw, 4rem));
        font-weight: 500;
        line-height: 1.25;
    }

    .quote-author {
        font-size: 1.1rem;
        font-weight: 400;
    }
}

/* ── Adaptive text: shorter quotes get even bigger ────────── */
.quote-text.short-quote {
    font-size: clamp(2rem, 5vw, 3.8rem);
}

@media (max-width: 768px) {
    .quote-text.short-quote {
        font-size: clamp(2.8rem, 12vw, 5rem);
        font-weight: 600;
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    .quote-text.short-quote {
        font-size: clamp(3rem, 14vw, 5.5rem);
        line-height: 1.15;
    }
}

/* ── Swipe transition ─────────────────────────────────────── */
.quote-slide {
    transition: opacity 0.3s ease;
}

.quote-slide.swipe-out {
    opacity: 0.4;
}

/* ── Swipe indicator dots (mobile) ────────────────────────── */
.swipe-dots {
    display: none;
}

@media (max-width: 768px) {
    .swipe-dots {
        display: flex;
        position: fixed;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 50;
        flex-direction: column;
        gap: 6px;
    }

    .swipe-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--white-muted);
        transition: background 0.3s, transform 0.3s;
    }

    .swipe-dot.active {
        background: var(--accent);
        transform: scale(1.4);
    }

    .quote-counter {
        display: none;
    }
}
