/*
 * Shared styles for every page of avocadoge.com.
 * Rules that only one page needs stay in that page's own <style> block.
 */

:root {
    /* Brand colors from the iOS app */
    --avo-purple: #6F5DFD;
    --avo-purple-muted: #5F5884;
    --avo-green: #C7DD8C;

    /* Dark theme colors from the iOS app */
    --primary-bg-dark: #171429;
    --secondary-bg-dark: #26223E;
    --primary-text-dark: #FFFFFF;

    /* Active theme */
    --bg-primary: var(--primary-bg-dark);
    --bg-secondary: var(--secondary-bg-dark);
    --text-primary: var(--primary-text-dark);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: var(--avo-purple);
    --accent-green: var(--avo-green);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(23, 20, 41, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(111, 93, 253, 0.1);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-logo img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.nav-logo span {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/*
 * The links double as the small-screen menu: the element is a popover that
 * the menu button opens. The declarations after `align-items` undo the
 * browser's popover defaults so that wide screens show the links inline.
 */
.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    border: 0;
    overflow: visible;
    background: none;
    color: inherit;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Menu button, shown only on small screens (see "Responsive" below) */
.nav-toggle {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -2px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.nav-toggle path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.nav-toggle-close {
    display: none;
}

/* Text pages: support, privacy, terms, safety guide */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 140px 24px 80px;
}

.legal-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.legal-content .last-updated {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 3rem;
}

.legal-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.legal-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.legal-content ul,
.legal-content ol {
    color: var(--text-secondary);
    padding-left: 24px;
    margin-bottom: 1rem;
}

.legal-content ul li,
.legal-content ol li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.legal-content a {
    color: var(--accent);
}

/* Footer */
footer {
    padding: 3rem 2rem;
    border-top: 1px solid rgba(111, 93, 253, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 900px) {
    /*
     * Small screens, baseline behaviour: the links move to their own row
     * under the logo and scroll sideways if they do not fit. Browsers that
     * support popovers replace this with the menu button below.
     */
    nav {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .nav-links {
        flex-basis: 100%;
        gap: 1.25rem;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@supports selector(:popover-open) {
    @media (max-width: 900px) {
        nav {
            flex-wrap: nowrap;
        }

        .nav-toggle {
            display: inline-flex;
        }

        .nav-links {
            position: fixed;
            inset: 5rem 1rem auto auto;
            flex-basis: auto;
            flex-direction: column;
            align-items: stretch;
            gap: 0.25rem;
            min-width: 13rem;
            max-width: calc(100vw - 2rem);
            max-height: calc(100vh - 6rem);
            padding: 0.5rem;
            overflow: auto;
            white-space: normal;
            background: var(--bg-secondary);
            border: 1px solid rgba(111, 93, 253, 0.3);
            border-radius: 16px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
        }

        .nav-links:not(:popover-open) {
            display: none;
        }

        .nav-links a {
            display: block;
            padding: 0.75rem 1rem;
            border-radius: 10px;
            font-size: 1rem;
            color: var(--text-primary);
        }

        .nav-links a:hover,
        .nav-links a:focus-visible {
            background: rgba(111, 93, 253, 0.2);
            color: var(--text-primary);
        }

        .nav-links a:focus-visible {
            outline: 2px solid var(--accent-green);
            outline-offset: -2px;
        }

        /* Open state: the button shows a close icon */
        nav:has(.nav-links:popover-open) .nav-toggle {
            border-color: rgba(111, 93, 253, 0.6);
        }

        nav:has(.nav-links:popover-open) .nav-toggle-open {
            display: none;
        }

        nav:has(.nav-links:popover-open) .nav-toggle-close {
            display: inline;
        }
    }

    @media (min-width: 901px) {
        /* Menu left open while the window grew wide: keep the links where the inline ones sit */
        .nav-links:popover-open {
            position: fixed;
            inset: 1rem 2rem auto auto;
            height: 40px;
        }
    }
}

@media (max-width: 600px) {
    .legal-content {
        padding: 120px 16px 60px;
    }

    .legal-content h1 {
        font-size: 2rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}
