/* ==========================================================================
   Mobile redesign (2026-11): agenda-style list, menu nav, sponsor strip, skinny
   filter bar, sticky month bar, newsletter card, light + dark.
   Loaded AFTER main.css. Plain CSS (no Tailwind rebuild needed).
   Everything is scoped to phones/tablets; the desktop layout is untouched.
   Per-city colors: edit ONLY the variable block below.
   ========================================================================== */

:root {
    --hec-accent: #B1111D;        /* buttons, today chip */
    --hec-accent-text: #B1111D;   /* accent used as text on white */
    --hec-gold: #F2AF01;          /* date chip outline, active menu item */
    --hec-star: #F2AF01;          /* conference star */
    --hec-navy: #012B63;          /* month title, newsletter card */
    --hec-pill-bg: #E6ECF5;
    --hec-pill-border: #B8C6DD;
    --hec-pill-text: #012B63;
    --hec-news-bg: #B1111D;       /* nav Newsletter button */
    --hec-news-fg: #FFFFFF;
    --hec-prompt-bg: #012B63;     /* newsletter card background */
    --hec-card: #FFFFFF;
    --hec-bar: #FFFFFF;
    --hec-line: #D1D5DB;
    --hec-text: #111827;
    --hec-muted: #6B7280;
    /* category bar colors (same on every hub) */
    --cat-geology: #FFB84D;
    --cat-geophysics: #2E5090;
    --cat-engineering: #C06014;
    --cat-business: #3D6B3D;
    --cat-other: #444455;
}

.dark {
    --hec-card: #111827;
    --hec-bar: #1F2937;
    --hec-line: #374151;
    --hec-text: #F3F4F6;
    --hec-muted: #9CA3AF;
    --hec-navy: #F3F4F6;          /* month title text in dark mode */
    --hec-accent-text: var(--hec-gold);
    --hec-pill-bg: #12386E;
    --hec-pill-border: #3A64A3;
    --hec-pill-text: #EEF3FF;
}

/* Elements that only exist on small screens are hidden by default */
.hec-m-only { display: none; }
.hec-tablet-only { display: none; }

/* --------------------------------------------------------------------------
   Phones and small tablets (below Tailwind's lg = 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .hec-tablet-only { display: block; }

    /* Sponsor strip: logo plate + name + one-line tagline */
    .sponsor-strip.hec-strip {
        display: flex !important;
        align-items: center;
        gap: 12px;
        padding: 10px 14px !important;
        text-align: left;
    }
    .hec-strip .hec-logo-plate {
        background: #fff;
        border-radius: 8px;
        padding: 4px 6px;
        display: flex;
        align-items: center;
        flex: 0 0 auto;
    }
    .hec-strip .hec-logo-plate img { height: 32px; width: auto; max-width: 96px; object-fit: contain; }
    .hec-strip .hec-strip-text { flex: 1; min-width: 0; }
    .hec-strip .sponsor-kicker { display: block; margin: 0; font-size: 10.5px; letter-spacing: .12em; }
    .hec-strip .hec-strip-name { font-size: 14px; font-weight: 700; line-height: 1.2; color: var(--hec-navy); }
    .hec-strip .hec-strip-tag { font-size: 12px; color: var(--hec-muted); line-height: 1.25; }
    .hec-strip .hec-strip-go { color: var(--hec-accent-text); font-weight: 700; font-size: 18px; }

    /* Filter card: skinny bar */
    .hec-filter-card { padding: 0 !important; }
    .hec-filter-card #mobile-filter-toggle { padding: 9px 14px; font-size: 14px !important; font-weight: 600 !important; }
    .hec-filter-card #mobile-filter-toggle svg { width: 16px !important; height: 16px !important; }
    .hec-filter-card #filter-content { padding: 0 14px 14px; margin-top: 0 !important; }

    /* Newsletter card above the calendar */
    .hec-news-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        background: var(--hec-prompt-bg);
        color: #fff;
        border-radius: 12px;
        padding: 12px 16px;
        margin: 0 0 12px;
    }
    .hec-news-card b { display: block; font-size: 14.5px; white-space: nowrap; }
    .hec-news-card span { font-size: 12.5px; opacity: .85; }
    .hec-news-card a {
        background: var(--hec-accent);
        color: #fff;
        font-weight: 700;
        padding: 8px 12px;
        border-radius: 8px;
        white-space: nowrap;
        font-size: 13px;
        text-decoration: none;
    }
}

/* --------------------------------------------------------------------------
   Phones (below Tailwind's md = 768px; same cutoff as isMobile in calendar.js)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .hec-m-only { display: flex; }

    /* ---- Navigation: Menu button + Newsletter button + theme toggle ---- */
    nav[role="navigation"] { flex-wrap: wrap; padding: 8px 0; }
    .hec-m-bar { order: 1; flex: 1; align-items: center; justify-content: space-between; gap: 10px; }
    #theme-toggle { order: 2; margin-left: 10px !important; }
    .hec-links { order: 3; width: 100%; flex: 0 0 100%; display: none; }
    nav.hec-open .hec-links { display: block; }
    .hec-links > div.absolute { display: none; }              /* scroll-hint fade is not needed */
    .hec-links > div.flex { flex-direction: column; overflow: visible !important; gap: 0; }
    .hec-links > div.flex > a {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin: 0 !important;
        padding: 13px 8px !important;
        font-size: 16px !important;
        border-bottom: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, .14);
    }
    .hec-links > div.flex > a::after { content: "›"; opacity: .7; }
    .hec-links > div.flex > a.border-astros-orange { color: var(--hec-gold) !important; }
    .hec-menu-btn {
        display: flex; align-items: center; gap: 8px;
        background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700;
        border: 0; border-radius: 10px; height: 38px; padding: 0 14px; font-size: 14px;
    }
    .hec-news-btn {
        background: var(--hec-news-bg); color: var(--hec-news-fg); font-weight: 800;
        border-radius: 10px; height: 38px; padding: 0 16px; display: flex; align-items: center;
        font-size: 14px; text-decoration: none; margin-left: auto;
    }

    /* ---- Calendar card: tighter, and no clipping so the month bar can stick ---- */
    .hec-cal-card { padding: 12px !important; overflow: visible !important; }

    /* ---- Month bar: arrows | month | today, pinned while scrolling ---- */
    .hec-cal-card .fc-header-toolbar {
        position: sticky; top: 0; z-index: 30;
        background: var(--hec-bar);
        padding: 8px 0; margin: 0 0 6px !important;
        box-shadow: 0 6px 8px -8px rgba(0, 0, 0, .35);
        flex-direction: row !important; flex-wrap: nowrap !important;
        align-items: center !important; justify-content: space-between !important; gap: 8px !important;
    }
    .hec-cal-card .fc-header-toolbar .fc-toolbar-chunk { display: flex; align-items: center; }
    .hec-cal-card .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) { flex: 1; justify-content: center; }
    .fc-toolbar-scroll-hint { display: none !important; }   /* toolbar no longer scrolls sideways */
    .hec-cal-card .fc-toolbar-title { font-size: 17px !important; font-weight: 800; color: var(--hec-navy) !important; white-space: nowrap; margin: 0 !important; }
    /* month arrows use this city's accent color */
    .hec-cal-card .fc-prev-button, .hec-cal-card .fc-next-button {
        background: var(--hec-accent) !important; border-color: var(--hec-accent) !important; color: #fff !important;
    }
    .hec-cal-card .fc-prev-button:hover, .hec-cal-card .fc-next-button:hover { filter: brightness(.92); }
    .hec-cal-card .fc-today-button {
        background: color-mix(in srgb, var(--hec-accent) 18%, var(--hec-bar)) !important;
        border: 0 !important; color: var(--hec-accent-text) !important;
        font-weight: 800; font-size: 12px !important; text-transform: uppercase;
    }
    .hec-cal-card .fc-today-button:disabled { opacity: .6; }

    /* ---- Past-events button ---- */
    .hec-past {
        display: block; width: 100%; text-align: center; padding: 11px;
        font-weight: 700; font-size: 14px; color: var(--hec-accent-text);
        background: color-mix(in srgb, var(--hec-accent) 8%, var(--hec-bar));
        border: 1px dashed var(--hec-accent); border-radius: 10px; margin: 6px 0 4px;
    }

    .dark .hec-past { border-color: var(--hec-gold); }

    /* ---- List view -> day-grouped agenda ---- */
    .hec-cal-card .fc-list { border: 0 !important; background: transparent !important; }
    .hec-cal-card .fc-list-table { border-collapse: separate; border-spacing: 0; width: 100%; }
    .hec-cal-card .fc-list-table tbody { display: block; }
    .hec-cal-card .fc-list-empty { background: transparent !important; }

    .hec-cal-card tr.fc-list-day { display: block; padding: 10px 0 6px; background: transparent !important; }
    .hec-cal-card tr.fc-list-day > th { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; position: static !important; }
    .hec-cal-card tr.fc-list-day .fc-list-day-cushion { display: block; padding: 0 !important; background: transparent !important; float: none !important; position: static !important; }
    .hec-cal-card .fc-list-day-text {
        display: inline-block; border: 2px solid var(--hec-gold); border-radius: 10px;
        color: var(--hec-accent-text) !important; padding: 3px 12px; font-weight: 800; font-size: 15px;
        text-transform: uppercase; letter-spacing: .04em; text-decoration: none !important; line-height: 1.2;
    }
    /* today's header row must not get FullCalendar's tinted "today" box */
    .hec-cal-card tr.fc-list-day.fc-day-today,
    .dark .hec-cal-card tr.fc-list-day.fc-day-today,
    .hec-cal-card tr.fc-list-day.fc-day-today > th,
    .dark .hec-cal-card tr.fc-list-day.fc-day-today > th { background: transparent !important; border: 0 !important; box-shadow: none !important; }
    .hec-cal-card tr.fc-list-day.fc-day-today .fc-list-day-text { background: var(--hec-accent); border-color: var(--hec-accent); color: #fff !important; }

    .fc .fc-list-table tr.fc-list-event,
    .dark .fc .fc-list-table tr.fc-list-event {
        display: flex; align-items: stretch;
        background: var(--hec-card) !important; color: var(--hec-text) !important;
        border: 1px solid var(--hec-line); border-top-width: 0;
        padding: 9px 10px 9px 23px !important; min-height: 0 !important;
        box-shadow: inset 12px 0 0 0 var(--cat, var(--cat-other));
    }
    .fc .fc-list-table tr.fc-list-day + tr.fc-list-event { border-top-width: 1px; border-top-left-radius: 10px; border-top-right-radius: 10px; }
    .fc .fc-list-table tr.fc-list-event:last-child,
    .fc .fc-list-table tr.fc-list-event:has(+ tr.fc-list-day) { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
    .fc .fc-list-table tr.fc-list-event.event-geology { --cat: var(--cat-geology); }
    .fc .fc-list-table tr.fc-list-event.event-geophysics { --cat: var(--cat-geophysics); }
    .fc .fc-list-table tr.fc-list-event.event-engineering { --cat: var(--cat-engineering); }
    .fc .fc-list-table tr.fc-list-event.event-business,
    .fc .fc-list-table tr.fc-list-event.event-production { --cat: var(--cat-business); }
    .fc .fc-list-table tr.fc-list-event.event-other { --cat: var(--cat-other); }
    .fc .fc-list-table tr.fc-list-event.event-selected { outline: 2px solid var(--hec-accent); outline-offset: -2px; }

    .hec-cal-card td.fc-list-event-graphic,
    .hec-cal-card td.fc-list-event-time { display: none !important; }
    .hec-cal-card td.fc-list-event-title { display: block; flex: 1; min-width: 0; padding: 0 !important; border: 0 !important; background: transparent !important; color: inherit !important; }

    .hec-ev { display: flex; gap: 8px; align-items: center; justify-content: space-between; width: 100%; }
    .hec-ev-main { min-width: 0; }
    .hec-ev-title {
        font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--hec-text) !important;
        display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: normal;
    }
    .hec-ev-star { color: var(--hec-star); margin-right: 4px; }
    .hec-ev-time { font-size: 11.5px; color: var(--hec-muted); margin-top: 2px; font-weight: 500; }
    .hec-ev .fc-sponsor-badge { margin-top: 4px; }
    .hec-pill {
        flex: 0 0 auto; font-size: 12px; font-weight: 800; color: var(--hec-pill-text);
        background: var(--hec-pill-bg); border: 1px solid var(--hec-pill-border); border-radius: 9999px;
        padding: 3px 10px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
    }
}
