/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
    --color-primary: #0f7a5c;
    --color-primary-dark: #0a5c44;
    --color-accent: #ff7a45;
    --color-text: #1a1f1c;
    --color-text-muted: #5c6660;
    --color-bg: #ffffff;
    --color-bg-alt: #f4f8f6;
    --color-border: #e1e8e4;
    --radius: 10px;
    --max-width: 1120px;
    --header-height: 64px;
    --bottom-nav-height: 64px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #eaf2ee;
        --color-text-muted: #a3b0aa;
        --color-bg: #101512;
        --color-bg-alt: #171d1a;
        --color-border: #2a332e;
    }
}

/* ==========================================================================
   2. Base / reset
   ========================================================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.55;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--color-primary); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 10px; top: 10px; }

a { color: var(--color-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================================
   3. Header (top nav — desktop only from 768px down, see bottom nav below)
   ========================================================================== */
.site-header {
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 50;
    background: var(--color-bg);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-height);
}
.logo { font-weight: 800; font-size: 1.3rem; color: var(--color-text); text-decoration: none; }
.logo span { color: var(--color-primary); }

.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav a { color: var(--color-text); font-weight: 500; text-decoration: none; padding: 10px 2px; }
.btn-nav-cta { background: var(--color-primary); color: #fff !important; padding: 10px 16px !important; border-radius: 999px; }

/* ==========================================================================
   4. Bottom nav (mobile app-style tab bar, ≤768px only)
   ========================================================================== */
.bottom-nav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-inner {
    display: flex; justify-content: space-around; align-items: stretch;
    height: var(--bottom-nav-height);
}
.bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: .68rem; font-weight: 600;
}
.bottom-nav-item:hover { text-decoration: none; }
.bottom-nav-icon { font-size: 1.35rem; line-height: 1; }
.bottom-nav-item.is-active { color: var(--color-primary); }

/* ==========================================================================
   5. Hero
   ========================================================================== */
.hero { background: linear-gradient(135deg, var(--color-bg-alt), var(--color-bg)); padding: 64px 0 48px; text-align: center; }
.hero-compact { padding: 40px 0 32px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 12px; }
.hero h1 span { color: var(--color-primary); }
.hero-sub { color: var(--color-text-muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto 28px; }

.hero-search { display: flex; max-width: 520px; margin: 0 auto 20px; gap: 8px; }
.hero-search input {
    flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px;
    border: 1px solid var(--color-border); font-size: 16px;
    background: var(--color-bg); color: var(--color-text);
}
.hero-search button {
    padding: 12px 24px; border-radius: 999px; border: none;
    background: var(--color-primary); color: #fff; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.hero-links { display: flex; gap: 24px; justify-content: center; font-weight: 600; flex-wrap: wrap; }

/* ==========================================================================
   6. Section layout
   ========================================================================== */
.section { padding: 48px 0; }
.section-alt { background: var(--color-bg-alt); border-radius: var(--radius); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-subhead { margin-top: 40px; }
.page-lead { color: var(--color-text-muted); margin-top: -8px; }
.narrow { max-width: 720px; }
.about-section { max-width: 720px; }
.about-section p { color: var(--color-text-muted); }

/* ==========================================================================
   7. Cards (events, communities, category/vertical tiles)
   ========================================================================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.event-card, .community-card, .vertical-card {
    display: block; padding: 20px; border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-bg); text-decoration: none; color: var(--color-text);
    transition: box-shadow .15s, transform .15s;
}
.event-card:hover, .community-card:hover, .vertical-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); text-decoration: none;
}
.event-card h3, .community-card h3, .vertical-card h3 { margin: 8px 0 6px; font-size: 1.1rem; }
.event-meta { color: var(--color-text-muted); font-size: .9rem; margin: 2px 0; }
.event-meta-large { color: var(--color-text-muted); font-size: 1rem; margin: 6px 0; }

.vertical-card { padding: 24px; }
.vertical-card-disabled { opacity: .6; cursor: default; }
.vertical-card-static { cursor: default; }
.vertical-card-static:hover { box-shadow: none; transform: none; }
.vertical-icon { font-size: 2rem; display: block; margin-bottom: 8px; }

.empty-state { color: var(--color-text-muted); padding: 24px; text-align: center; border: 1px dashed var(--color-border); border-radius: var(--radius); }

/* Badges */
.badge {
    display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .03em; padding: 4px 10px; border-radius: 999px; margin: 0 6px 6px 0;
    background: var(--color-bg-alt); color: var(--color-primary-dark);
}
.badge-cafe { background: #fff1e8; color: #b4522a; }
.badge-live { background: #e8f7ef; color: #0a5c44; }
.badge-soon { background: #f1f1f1; color: #7a7a7a; }

/* ==========================================================================
   8. Filter bar (events/communities listing)
   ========================================================================== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 28px; }
.filter-bar input, .filter-bar select {
    padding: 12px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-bg); color: var(--color-text); font-size: 16px; min-height: 44px;
}
.filter-bar button {
    padding: 12px 18px; border-radius: 8px; border: none;
    background: var(--color-primary); color: #fff; font-weight: 600; cursor: pointer; min-height: 44px;
}

/* ==========================================================================
   9. Forms (submit event, interest/RSVP, AI auto-fill)
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.form input, .form select, .form textarea {
    font-family: inherit; font-size: 16px; padding: 12px; border-radius: 8px;
    border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text);
    font-weight: 400; min-height: 44px;
}
.form textarea { min-height: 120px; }
.form-row { display: flex; gap: 16px; }
.form-row label { flex: 1; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.honeypot { position: absolute; left: -9999px; top: -9999px; }

.ai-fill-box { margin: 20px 0 28px; padding: 20px; border: 1px dashed var(--color-primary); border-radius: var(--radius); background: var(--color-bg-alt); }
.ai-fill-box h2 { margin: 0 0 4px; font-size: 1.05rem; }
.ai-fill-box textarea {
    width: 100%; margin: 10px 0; padding: 12px; border-radius: 8px;
    border: 1px solid var(--color-border); font-family: inherit; font-size: 16px;
    background: var(--color-bg); color: var(--color-text);
}
.ai-fill-box button { min-height: 44px; padding: 10px 20px; }
#aiFillStatus { margin-top: 8px; min-height: 1.2em; }

.interest-box { margin-top: 32px; padding: 24px; background: var(--color-bg-alt); border-radius: var(--radius); }
.interest-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.interest-form input { flex: 1; min-width: 200px; padding: 12px; border-radius: 8px; border: 1px solid var(--color-border); font-size: 16px; min-height: 44px; }
.interest-form button { padding: 12px 20px; border-radius: 8px; border: none; background: var(--color-primary); color: #fff; font-weight: 600; cursor: pointer; min-height: 44px; }

/* ==========================================================================
   10. Buttons & alerts
   ========================================================================== */
.btn-primary, .btn-secondary {
    display: inline-block; padding: 12px 24px; border-radius: 999px; font-weight: 600;
    text-decoration: none; border: none; cursor: pointer; font-size: 1rem; min-height: 44px; text-align: center;
}
.btn-primary { background: var(--color-primary); color: #fff !important; }
.btn-secondary { background: var(--color-bg-alt); color: var(--color-text) !important; border: 1px solid var(--color-border); }
.event-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0; }

.alert-success { background: #e8f7ef; color: #0a5c44; padding: 14px 18px; border-radius: 8px; }
.alert-error { background: #fdeceb; color: #a3261a; padding: 14px 18px; border-radius: 8px; }
.alert-error ul { margin: 0; padding-left: 18px; }

/* ==========================================================================
   11. Detail pages (event, community)
   ========================================================================== */
.breadcrumb { color: var(--color-text-muted); font-size: .9rem; margin-bottom: 16px; }
.event-description { margin: 20px 0; }

.calendar-box { margin-top: 20px; padding: 20px 24px; background: var(--color-bg-alt); border-radius: var(--radius); }
.calendar-box h2 { margin: 0 0 4px; font-size: 1.1rem; }
.calendar-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ==========================================================================
   12. FAQ
   ========================================================================== */
.faq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.faq-item { border: 1px solid var(--color-border); border-radius: 8px; padding: 14px 18px; }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { color: var(--color-text-muted); margin: 10px 0 2px; }

/* ==========================================================================
   13. 404 page
   ========================================================================== */
.not-found { text-align: center; padding: 64px 20px; }
.not-found-code { font-size: clamp(3rem, 12vw, 6rem); font-weight: 800; color: var(--color-primary); margin: 0; line-height: 1; }
.not-found .event-actions { justify-content: center; }
.not-found-suggestions { margin-top: 48px; text-align: left; max-width: 480px; margin-left: auto; margin-right: auto; }
.not-found-suggestions ul { list-style: none; padding: 0; }
.not-found-suggestions li { padding: 10px 0; border-bottom: 1px solid var(--color-border); }

/* ==========================================================================
   14. Search page
   ========================================================================== */
.search-form { display: flex; max-width: 560px; gap: 8px; margin: 20px 0 32px; }
.search-form input {
    flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px;
    border: 1px solid var(--color-border); font-size: 16px;
    background: var(--color-bg); color: var(--color-text);
}
.search-form button { padding: 12px 24px; border-radius: 999px; border: none; background: var(--color-primary); color: #fff; font-weight: 600; cursor: pointer; }
.search-group-title { font-size: 1rem; color: var(--color-text-muted); margin: 32px 0 14px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }

/* ==========================================================================
   15. Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--color-border); margin-top: 40px; background: var(--color-bg-alt); }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 40px 20px; }
.footer-col h3 { font-size: .95rem; margin-bottom: 10px; }
.footer-col a { display: block; color: var(--color-text-muted); margin-bottom: 6px; text-decoration: none; }
.footer-col p { color: var(--color-text-muted); font-size: .9rem; }
.footer-bottom { padding: 16px 20px; border-top: 1px solid var(--color-border); font-size: .82rem; color: var(--color-text-muted); }

/* ==========================================================================
   16. Mobile (≤768px) — bottom nav replaces top nav entirely
   ========================================================================== */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .bottom-nav { display: block; }
    /* keep content clear of the fixed bottom nav */
    body { padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0)); }

    .hero { padding: 40px 0 36px; }
    .hero-search { flex-direction: column; }
    .hero-search button { width: 100%; padding: 14px 24px; }

    .search-form { flex-direction: column; }
    .search-form button { width: 100%; }

    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar input, .filter-bar select, .filter-bar button { width: 100%; }

    .section { padding: 32px 0; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }

    .card-grid { grid-template-columns: 1fr; }

    .event-actions, .calendar-actions { flex-direction: column; }
    .event-actions .btn-primary, .event-actions .btn-secondary,
    .calendar-actions .btn-secondary { width: 100%; }

    .interest-form { flex-direction: column; }
    .interest-form input, .interest-form button { width: 100%; }

    .footer-inner { grid-template-columns: 1fr; gap: 24px; }
    .form-row { flex-direction: column; }
}
