/* CSS Variables for consistent theming */
:root {
    --color-primary: #296b6b;
    --color-primary-hover: #1e5454;
    --color-text: #222323;
    --color-text-light: #6b7280;
    --color-background: #f0f6f0;
    --color-background-alt: #f9fafb;
    --color-border: #e5e7eb;
    --color-accent: #baf5bc;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --border-radius: 0.5rem;
    --max-width: 70ch;
}

/* Base styles */
html {
    max-width: var(--max-width);
    padding: var(--spacing-md);
    margin: auto;
    line-height: 1.6;
    font-size: 16px;
}

@media (min-width: 768px) {
    html {
        font-size: 18px;
        padding: var(--spacing-xl);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
    background-color: var(--color-background);
    margin: 0;
}

/* Header & Logo */
header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--color-border);
}

.logo {
    margin: 0 0 var(--spacing-sm) 0;
    font-family: Kenney Mini,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.75rem; /* Smaller default for mobile */
    font-weight: 700;
    letter-spacing: -0.025em;
}

@media (min-width: 768px) {
    .logo {
        font-size: 2.5rem; /* Larger size for tablets and desktop */
    }
}

.logo a {
    color: var(--color-text);
    text-decoration: none;
}

.logo a:hover {
    color: var(--color-primary);
}

header > div > div {
    color: var(--color-text-light);
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
}

/* Typography */
h2 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--color-text);
}

h2.day-heading {
    margin: 0;
    padding: var(--spacing-sm) 0;
    font-size: 0.875rem;
    min-width: 90px;
    text-align: left;
    color: var(--color-text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

h2.day-heading a {
    color: var(--color-text-light);
    text-decoration: none;
}

h2.day-heading a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Visually hides content while keeping it in the accessibility tree and
   readable by search engines. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h3.time-heading {
    margin: 0;
    padding: var(--spacing-xs) 0;
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-weight: 400;
    /* Mobile-first: no float, left-aligned */
    text-align: left;
}

@media (min-width: 768px) {
    h3.time-heading {
        width: 90px;
        text-align: right;
        float: left;
        padding: var(--spacing-md) 0;
    }
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
}

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

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Header call to action — replaced the old header nav (its links moved into
   the sidebar's Browse section; site.css .sidebar-list carries their
   styling now). */
.header-cta {
    margin: var(--spacing-md) 0 0 0;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Fallback for pages with no sidebar (event pages, updates, feeds,
   newsletter) — those lost the header's site navigation, so this is their
   only way back short of the browser's back button. */
.back-home {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.9rem;
}

/* Newsletter Subscribe */
#subscribe {
    background: linear-gradient(135deg, var(--color-accent) 0%, #7fdb8a 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-xl);
    border-left: 4px solid #4caf50;
}

#subscribe a {
    font-weight: 600;
}

/* Day Containers */
.day-container {
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--color-border);
}

.day-container:last-child {
    border-bottom: none;
}

/* Time Slots — ul/li for real list semantics; reset default list styling */
.time-slots-list,
.events-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.time-slot {
    margin-bottom: var(--spacing-md);
    display: flow-root;
}

/* Events */
.event {
    position: relative;
    line-height: 1.5;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: var(--color-background);
    border-radius: calc(var(--border-radius) * 0.75);
    transition: transform 0.2s, box-shadow 0.2s;
    /* Mobile-first: no left margin */
    margin-left: 0;
}

/* Room for the category icon anchored to the card's right edge — only
   cards that have one pay for the reserved space. */
.event.has-category-icon {
    padding-right: calc(64px + var(--spacing-lg));
}

@media (min-width: 768px) {
    .event {
        margin-left: 100px;
    }
}

.event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Category icon — anchored to the card's own right edge, vertically
   centered, rather than tied to the (desktop-only) time column. Shows at
   every width since it now lives entirely inside the card. */
.event-category-icon {
    position: absolute;
    top: 50%;
    right: var(--spacing-md);
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 1px solid #222323;
    border-radius: 4px;
}

.event .p-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-primary);
}

.event .p-name:hover {
    color: var(--color-primary-hover);
}

.event .event-details {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-top: var(--spacing-sm);
}

.event-location,
.p-organizer {
    margin-top: var(--spacing-xs);
}

.also-published-by {
    margin-top: var(--spacing-xs);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--color-text-light);
}

/* Category Badges */
.event-categories {
    margin-top: var(--spacing-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.category-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-primary);
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 9999px;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
}

.category-badge:hover {
    background-color: #dbeafe;
    border-color: var(--color-primary);
    text-decoration: none;
}

/* Listing cards show the time via the shared .time-heading grouping the
   event sits under, so each event's own .dt-start (kept for the h-event
   microformat) is a redundant duplicate there — hide it only in that
   context. event_page.html's "When" field uses the same .dt-start class as
   its *only* visible time, not a duplicate, so it must stay visible; a
   global `.dt-start { display: none }` here previously blanked it. */
.events-list .dt-start {
    display: none;
}

/* Footer */
footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #000;
    color: #fff;
    padding: var(--spacing-sm) var(--spacing-md);
    text-decoration: none;
    z-index: 100;
    border-radius: var(--border-radius);
}

.skip-link:focus {
    top: var(--spacing-sm);
    left: var(--spacing-sm);
}

/* Groups Page */
.groups-container ul {
    list-style: none;
    padding: 0;
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.group-card {
    padding: var(--spacing-md);
    background: var(--color-background-alt);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.group-card a {
    font-weight: 500;
    display: block;
}

.suggest-group {
    background: var(--color-background-alt);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
}

/* Week Page */
.week-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-border);
}

.week-header h1 {
    margin-bottom: var(--spacing-sm);
}

.week-header p {
    margin: 0;
    font-size: 0.95rem;
}

/* Browse sidebar (cross-filter by category and month) */
.layout-with-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    align-items: flex-start;
}

.layout-with-sidebar main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.event-sidebar {
    width: 100%;
}

/* Widen the page and place the sidebar alongside content on desktop. */
@media (min-width: 1024px) {
    html:has(.layout-with-sidebar) {
        max-width: 96ch;
    }

    .layout-with-sidebar {
        flex-direction: row;
    }

    .event-sidebar {
        width: 16rem;
        flex-shrink: 0;
        position: sticky;
        top: var(--spacing-md);
        /* When the filter list is taller than the viewport, let the sidebar
           scroll on its own so the Month section stays reachable instead of
           being pinned off-screen below the fold. */
        max-height: calc(100vh - 2 * var(--spacing-md));
        overflow-y: auto;
    }
}

.sidebar-section {
    margin-bottom: var(--spacing-lg);
}

/* Match the day-heading treatment so the page has one small-caps style.
   h2, not h3: the sidebar is a sibling section to main, not nested under
   it, and a category/location page with zero results has no h2 of its own
   in main content — an h3 here would then follow h1 directly and skip a
   level. */
.sidebar-section h2 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-sm) 0;
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem; /* same scale as nav and footer */
}

.sidebar-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
}

.sidebar-list li.active {
    background-color: var(--color-accent);
}

.sidebar-list li.active a {
    color: var(--color-text);
    font-weight: 600;
}

.sidebar-list .count {
    color: var(--color-text-light);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* DC/VA/MD share one row (one "DC / VA / MD" span, not three separate
   flex items — see the template's own comment) instead of three li.active
   rows — the active state highlights the link itself, not the whole row. */
.sidebar-list li.locations-row a.active {
    color: var(--color-text);
    font-weight: 600;
}

/* Recurring Event Badge */
.recurring-badge {
    display: inline-block;
    background-color: #e8f5e9;
    color: #2e7d32;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    border: 1px solid #4caf50;
}

/* The organizer-confirmation caveat used to live only in this badge's
   title="" tooltip, which never fires on touch and is inconsistently
   exposed to screen readers. Always-visible text instead. */
.recurring-note {
    display: block;
    color: var(--color-text-light);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.15rem;
}

/* Updates — the weekly blog at /updates */
.updates-header {
    margin-bottom: var(--spacing-xl);
}

.updates-header p {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

.updates-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.update-entry {
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.update-entry:last-child {
    border-bottom: none;
}

.update-entry h2 {
    margin-bottom: var(--spacing-xs);
    font-size: 1.25rem;
}

.update-meta {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
}

.update-summary {
    color: var(--color-text-light);
    margin: 0;
}

.update-header {
    margin-bottom: var(--spacing-lg);
}

.update-week-link {
    display: inline-block;
    background-color: var(--color-background-alt);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    font-weight: 500;
    text-decoration: none;
}

.update-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
}

.update-badge {
    display: inline-block;
    background-color: var(--color-accent);
    color: var(--color-text);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: var(--spacing-sm);
    vertical-align: middle;
}

.update-body h2,
.update-body h3 {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-sm);
}

.update-body p,
.update-body ul,
.update-body ol {
    margin-bottom: var(--spacing-md);
}

.update-body ul,
.update-body ol {
    padding-left: var(--spacing-lg);
}

.update-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.update-body pre {
    background-color: var(--color-background-alt);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.update-body blockquote {
    border-left: 4px solid var(--color-border);
    padding-left: var(--spacing-md);
    margin-left: 0;
    color: var(--color-text-light);
}

/* ── Per-event pages ────────────────────────────────────────────────
   The permalink is deliberately quiet. In a listing the event title is the
   outbound link to the organizer; this '#' is a crawlable route to our own
   page for the event, sized so that a reader looking for the event never
   mistakes it for the thing to click. Do not make it louder. */
.event-permalink {
    margin-left: 0.4em;
    font-size: 0.8em;
    color: var(--color-text-light);
    opacity: 0.35;
    text-decoration: none;
}

.event-permalink:hover,
.event-permalink:focus {
    opacity: 1;
    color: var(--color-primary);
}

.event-page {
    max-width: 44rem;
}

.event-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-xs) var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.event-facts dt {
    font-weight: 700;
    color: var(--color-text-light);
}

.event-facts dd {
    margin: 0;
}

/* The primary action on the page: out to the organizer. */
.event-source-cta {
    margin: var(--spacing-lg) 0 var(--spacing-xs) 0;
}

.event-source-link {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-primary);
    color: #fff;
    border-radius: 4px;
    font-size: 1.125rem;
    font-weight: 700;
    text-decoration: none;
}

.event-source-link:hover,
.event-source-link:focus {
    background: var(--color-text);
    color: #fff;
}

.event-source-note {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-top: 0;
}

.event-page h2 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-xs);
}

.event-actions {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-light);
}

/* Shown on week and month pages whose events are already in the past. */
.archive-notice {
    background: var(--color-background-alt);
    border-left: 4px solid var(--color-border);
    padding: var(--spacing-md);
    color: var(--color-text-light);
}
