/* ========================================================================
   PUBLIC SITE STYLESHEET (CENTRAL)
   Location: /css/blog.css
   Description: Single stylesheet for the whole public site — header/nav,
   home feed, sidebar, footer, static pages, and the article/blog engine.
   Replaces the old three-file split (tokens.css + home.css + blog.css).
   Load this ONE file; nothing else is required on public pages.
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700;800;900&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* ------------------------------------------------------------------------
   0. Design Tokens — single source of truth for color, type, spacing specs
   ------------------------------------------------------------------------ */
:root {
    /* Type */
    --font-sans: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --font-serif: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* body/reading text uses JetBrains Mono */
    --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; /* editorial titles, subtitles, headings */
    --line-height-base: 1.6;
    --line-height-reading: 1.75;

    /* Color Palette — restrained monochrome, single accent */
    --bg-main: #FAFAFA;
    --bg-alt: #ECECEC;
    --bg-card: #FFFFFF;
    --text-dark: #1F2328;
    --text-main: #4B5563;
    --text-muted: #6B7280;
    --text-light: #6B7280; /* folded into text-muted — two weights, not three */
    --border-color: #DDE1E6;
    --input-border: #DDE1E6;

    /* Action / Brand — one muted slate-blue accent used consistently */
    --primary: #4C6FA0;
    --primary-hover: #3D5980;
    --primary-light: #4C6FA0;
    --link: #4C6FA0;
    --danger: #C0392B;
    --danger-bg: #F5F5F5;
    --danger-hover: #ECECEC;
    --success: #1A7F37;

    /* Footer — dark, inverted from the rest of the (light) site */
    --footer-bg: #14171C;
    --footer-border: rgba(255, 255, 255, 0.1);
    --footer-text: #B4BAC2;
    --footer-text-strong: #FFFFFF;

    /* Status / callout backgrounds — desaturated toward the gray system */
    --info-bg: #ECECEC;
    --warning-bg: #F5F5F5;
    --warning-border: #DDE1E6;
    --warning-text: #252525;
    --overlay: rgba(0, 0, 0, 0.55);

    /* Specs */
    --radius-sm: 0px;
    --radius-md: 2px;
    --radius-lg: 2px;
    --transition-speed: 0.15s;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ------------------------------------------------------------------------
   1. Global Reset & Base
   ------------------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    line-height: var(--line-height-base);
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden; /* guards against the #main-footer full-bleed breakout (100vw) adding a horizontal scrollbar */
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    height: 36px;
    border: 1px solid var(--text-dark);
    border-radius: var(--radius-md);
    background: var(--text-dark);
    color: var(--bg-card);
    font-size: 14px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

input[type="email"],
input[type="text"] {
    height: 36px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0 10px;
    font-size: 14px;
}

/* ========================================================================
   2. SITE FRAME — header, nav, footer, page wrapper
   ======================================================================== */
#page-wrapper {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Desktop only: widen the page wrapper to 70% of the viewport, capped so it
   doesn't get absurdly wide on large monitors. Tablet/mobile keep the
   1080px rule above. */
@media (min-width: 901px) {
    #page-wrapper {
        width: 70%;
        max-width: 1400px;
    }

    /* Most Popular: bigger, more magazine-style rank numbers on desktop */
    .popular-post-item {
        grid-template-columns: auto 124px 1fr;
        padding: 14px 6px;
        gap: 16px;
    }

    .popular-post-item::before {
        font-size: 28px;
    }

    .popular-post-link {
        font-size: 16px;
    }

    .popular-post-thumb-link {
        height: 72px;
        max-width: 124px;
    }

    .sidebar-title:has(+ #popular-posts-list) {
        font-size: 18px;
    }

    /* Upcoming Events: slightly larger on desktop now that it's a
       full-width section rather than a narrow sidebar box */
    .event-name {
        font-size: 19px;
    }

    .event-date-day {
        font-size: 38px;
    }
}

/* ---------- Header / Nav ----------
   Full-bleed dark background, mirroring #main-footer's treatment below:
   same breakout technique and edge-alignment math, plus the same dark
   surface + light text + bordered-pill controls as the footer. */
#main-header {
    margin: 0 calc(-50vw + 50%) 0;
    width: 100vw;
    padding: 16px calc(50vw - 50% + 32px);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

#nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
}

/* Logo lockup: mark + vertical divider + category tagline */
#site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#site-logo-img {
    height: 64px;
    width: auto;
    display: block;
}

#site-logo-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
}

#site-logo-categories {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

#nav-links {
    display: flex;
    flex: 1;
    justify-content: center;
    gap: 28px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 600;
}

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

#header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

#menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
}

/* Header search */
#site-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

#site-search-input {
    height: 32px;
    width: 0;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0;
    font-family: var(--font-sans);
    font-size: 13px;
    background-color: var(--bg-card);
    color: var(--text-dark);
    opacity: 0;
    transition: width 0.25s ease, opacity 0.2s ease, padding 0.25s ease, border-color 0.2s ease;
}

#site-search-form:hover #site-search-input,
#site-search-form.expanded #site-search-input {
    width: 160px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    opacity: 1;
}

#site-search-input::placeholder {
    color: var(--text-muted);
}

#site-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

#site-search-btn {
    height: 32px;
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-dark);
    cursor: pointer;
    flex-shrink: 0;
}

#site-search-btn:hover {
    color: var(--primary);
}

#lang-switch {
    display: flex;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.lang-switch-link:hover,
.lang-switch-link.active {
    color: var(--primary);
}

#site-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

#site-tagline {
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */
/* Full-bleed dark background: breaks out of #page-wrapper's centered,
   width-limited box to span the full viewport width, while the padding
   keeps the footer's content (columns, links, copyright) aligned exactly
   where it sat before the breakout. Height is untouched — only the
   horizontal extent changes. */
#main-footer {
    margin: 48px calc(-50vw + 50%) 0;
    width: 100vw;
    padding: 40px calc(50vw - 50% + 32px) 0;
    background-color: var(--footer-bg);
    color: var(--footer-text);
    border-top: 1px solid var(--footer-border);
}

#footer-top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 28px;
}

.footer-col-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--footer-text-strong);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.footer-about-text {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--footer-text);
    max-width: 320px;
}

#footer-social-links {
    display: flex;
    flex-direction: row;
    gap: 14px;
}

#footer-social-links li {
    margin-bottom: 0;
}

.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--footer-text);
    border: none;
    padding: 0;
}

.footer-social-link svg {
    width: 22px;
    height: 22px;
}

.footer-social-link:hover {
    color: var(--footer-text-strong);
}

.footer-link-list {
    list-style: none;
}

.footer-link-list li {
    margin-bottom: 8px;
}

.footer-link-list a {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--footer-text);
}

.footer-link-list a:hover {
    color: var(--footer-text-strong);
    text-decoration: underline;
}

#footer-bottom-bar {
    padding: 16px 0 24px;
    border-top: 1px solid var(--footer-border);
}

#footer-copyright {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--footer-text);
}

#admin-login-link {
    text-decoration: underline;
}

/* ========================================================================
   3. HOME FEED — featured post, content grid, sidebar, pagination
   ======================================================================== */
#featured-post-container {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 480px;
    margin: 24px 0;
}

/* Dark gradient behind the text so it stays readable over any photo —
   strongest at the left where the text sits, fading out toward the
   right so the photo itself stays visible. */
#featured-post-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.5) 38%, rgba(0, 0, 0, 0.1) 68%, rgba(0, 0, 0, 0) 85%);
    z-index: 1;
}

.featured-text {
    position: relative;
    z-index: 2;
    padding: 56px 48px;
    color: #fff;
    max-width: 560px;
}

.featured-title a {
    color: #fff;
}

.featured-text .post-meta {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-top: 14px;
}

.featured-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    border: none;
    padding: 0;
    border-radius: 0;
    margin-bottom: 16px;
}

.featured-badge::before {
    content: "";
    width: 22px;
    height: 1px;
    background: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.featured-title {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
}

.featured-teaser {
    font-size: 16px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
}

.featured-readmore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    padding-bottom: 3px;
}

.featured-readmore:hover {
    border-color: #fff;
}

.featured-readmore span {
    display: inline-block;
    transition: transform var(--transition-speed) ease;
}

.featured-readmore:hover span {
    transform: translateX(3px);
}

.featured-image-container img,
.post-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.featured-image-container {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    z-index: 0;
}

/* Fallback for featured posts with no image: flat card instead of a hero
   overlay, since white text + dark gradient would be unreadable without
   a photo behind them. */
#featured-post-container.no-image {
    background: var(--bg-main);
    align-items: stretch;
}

#featured-post-container.no-image::before {
    display: none;
}

#featured-post-container.no-image .featured-text {
    color: var(--text-main);
    max-width: none;
}

#featured-post-container.no-image .featured-title a {
    color: inherit;
}

#featured-post-container.no-image .featured-teaser {
    color: var(--text-muted);
}

#featured-post-container.no-image .post-meta {
    color: var(--text-light);
}

#featured-post-container.no-image .featured-badge {
    color: var(--primary);
}

#featured-post-container.no-image .featured-badge::before {
    background: var(--primary);
}

#featured-post-container.no-image .featured-readmore {
    color: var(--text-dark);
    border-color: var(--text-dark);
}

/* Content grid (articles + sidebar) */
#content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start;
    margin-top: 8px;
}

/* Grid/flex items shrink to their content's natural size by default —
   an <img> with width:100% still contributes its intrinsic natural
   width as the item's automatic minimum size, which can force the
   whole shared grid column wider than the viewport. min-width: 0
   lets these items actually respect the layout instead. */
#latest-posts-section,
#sidebar {
    min-width: 0;
}

.blog-post-card,
.post-card-content,
.post-image-container,
.featured-image-container {
    min-width: 0;
}

.nav-section-posts > * {
    min-width: 0;
}

/* Category filters */
#category-filters {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.filter-link.active {
    color: var(--text-dark);
    font-weight: 600;
}

/* Latest posts title.
   Height + gap are variables so the sidebar can be pushed down by exactly
   the same amount on desktop, lining the "Most Popular" box up with the
   first row of post cards. */
#content-grid {
    --latest-title-height: 28px;
    --latest-title-gap: 16px;
}

/* Top rule above Latest: same line as .nav-section-row below (1px solid
   --border-color, 20px of space before the title), full width of the
   page wrapper so it also runs over the sidebar. */
#content-grid:has(.latest-posts-title) {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.latest-posts-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: var(--latest-title-height);
    color: var(--text-dark);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--latest-title-gap);
}

/* Two-column layout only (single column at <=900px): drop the sidebar by the
   title's height so its top edge matches the top of the first post cards. */
@media (min-width: 901px) {
    #content-grid:has(.latest-posts-title) #sidebar {
        margin-top: calc(var(--latest-title-height) + var(--latest-title-gap));
    }
}

/* Post grid */
#latest-posts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}

#nav-sections {
    margin-top: 32px;
}

.nav-section-row {
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.nav-section-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.nav-section-posts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.blog-post-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    padding: 12px;
}

.post-image-container {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    aspect-ratio: 16 / 9;
    margin-bottom: 12px;
    overflow: hidden;
}

.post-card-content {
    display: flex;
    flex-direction: column;
}

.post-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.post-title a {
    color: var(--text-dark);
}

.post-title a:hover {
    text-decoration: underline;
}

.post-card-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
    order: -1;
}

.post-card-eyebrow {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    text-decoration: none;
}

.post-card-eyebrow:hover {
    text-decoration: underline;
}

.post-card-excerpt {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    font-size: 12px;
    color: var(--text-light);
}

/* Compact (horizontal) card: thumbnail + text side-by-side, no excerpt.
   Used for the secondary story stacked under a column's lead story. */
.blog-post-card--compact {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.blog-post-card--compact .post-image-container {
    flex: 0 0 88px;
    width: 88px;
    aspect-ratio: 1 / 1;
    margin-bottom: 0;
}

.blog-post-card--compact .post-card-content {
    min-width: 0;
}

.blog-post-card--compact .post-title {
    font-size: 14px;
}

#no-posts-message {
    font-size: 14px;
    color: var(--text-light);
}

#archive-link-container {
    margin-top: 20px;
    text-align: center;
}

#view-all-btn {
    display: inline-block;
    font-size: 14px;
    border: 1px solid var(--text-dark);
    padding: 8px 20px;
    border-radius: var(--radius-md);
}

/* Pagination */
#pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
}

.pagination-link {
    display: inline-block;
    font-size: 14px;
    border: 1px solid var(--text-dark);
    padding: 8px 20px;
    border-radius: var(--radius-md);
}

.pagination-link:hover {
    background: var(--text-dark);
    color: var(--bg-card);
}

#pagination-status {
    font-size: 13px;
    color: var(--text-light);
}

/* Sidebar */
#sidebar > div {
    margin-bottom: 24px;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 10px;
}

/* Make the "Most Popular" heading stand out from the other sidebar titles,
   without touching #popular-posts-list (the box). Scoped with :has() to the
   .sidebar-title that sits right before #popular-posts-list, so Tags and
   any other sidebar widgets keep their plain style. */
.sidebar-title:has(+ #popular-posts-list) {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.sidebar-title:has(+ #popular-posts-list)::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 36px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

#tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.tag-pill {
    font-size: 12px;
    border: 1px solid var(--input-border);
    padding: 4px 10px;
    border-radius: 0;
}

/* Most Popular */
.sidebar-box {
    padding: 8px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

#popular-posts-list {
    list-style: none;
    margin: 0;
    counter-reset: popular-rank;
}

.popular-post-item {
    display: grid;
    grid-template-columns: auto 110px 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 4px;
    transition: background-color 0.15s ease;
    counter-increment: popular-rank;
}

.popular-post-item:hover {
    background-color: var(--bg-main);
}

.popular-post-item:last-child {
    border-bottom: none;
}

.popular-post-item::before {
    content: counter(popular-rank);
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-dark);
    align-self: start;
    padding: 2px 3px 0 0;
}

.popular-post-item:hover::before {
    color: var(--primary);
}

.popular-post-thumb-link {
    display: block;
    height: 64px;
    max-width: 110px;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.popular-post-thumb {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.popular-post-content {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    align-self: start;
}

.popular-post-topic {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
}

.popular-post-link {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
    min-width: 0;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-post-link:hover {
    text-decoration: underline;
}

.popular-post-date {
    font-size: 12px;
    color: var(--text-light);
}

/* ========================================================================
   4. EVENTS
   ======================================================================== */
#event-image-container {
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 20px;
    max-height: 320px;
}

#event-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.event-badge {
    font-size: 12px;
    border: 1px solid var(--input-border);
    padding: 4px 10px;
    border-radius: 0;
    color: var(--text-muted);
}

#event-description {
    font-size: 15px;
    color: var(--text-main);
    margin-top: 16px;
    white-space: pre-wrap;
}

#event-virtual-link {
    margin-top: 12px;
    font-size: 14px;
}

#event-virtual-link a {
    color: var(--link);
    text-decoration: underline;
}

#events-section {
    margin-top: 32px;
    margin-bottom: 24px;
    padding: 20px 18px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.events-section-header {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 16px;
}

.events-section-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#events-list {
    list-style: none;
    margin: 0;
}

.event-item {
    border-bottom: 1px solid var(--border-color);
}

.event-item:last-child {
    border-bottom: none;
}

.event-item-link {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 16px 4px;
}

.event-date-badge {
    flex: 0 0 auto;
    width: 60px;
    text-align: center;
    font-family: var(--font-heading);
    border-right: 1px solid var(--border-color);
    padding-right: 18px;
    box-sizing: content-box;
}

.event-date-month {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.event-date-day {
    display: block;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-dark);
}

.event-item-content {
    min-width: 0;
}

.event-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--primary);
}

.event-item-link:hover .event-name {
    text-decoration: underline;
}

.event-description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.event-presented-by {
    display: block;
    margin-top: 4px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
}

/* Registration block heading on event-detail.ejs — this is main-content,
   not the sidebar, so it gets the same heading treatment as other
   main-content section titles (e.g. .recommendations-heading) instead of
   the small muted .sidebar-title label. */
.event-registration-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

/* ========================================================================
   5. FORMS — newsletter, exit modal, contact
   ======================================================================== */
#newsletter-form,
#exit-modal-form,
#event-register-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Newsletter form: same font/color language as the post-card —
   font-sans body text, primary-blue accent for the call-to-action
   instead of the generic dark button. */
#newsletter-form input[type="text"],
#newsletter-form input[type="email"] {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--text-dark);
}

#newsletter-form input[type="text"]::placeholder,
#newsletter-form input[type="email"]::placeholder {
    color: var(--text-muted);
}

#newsletter-form input[type="text"]:focus,
#newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary);
}

#newsletter-form button {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    margin-top: 4px;
}

#newsletter-form button:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    opacity: 1;
}

/* Sidebar newsletter box — same card treatment as the Most Popular box
   (#popular-posts-list): bg-card panel, thin border, 6px radius, plus the
   centered/underlined title style used for that box's heading. */
#newsletter-box {
    margin: 0 0 24px;
    padding: 20px 18px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

#newsletter-box .sidebar-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

#newsletter-box .sidebar-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 36px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.newsletter-intro {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: left;
    margin-bottom: 14px;
}

/* Footer newsletter strip — same card treatment as the Most Popular box
   (#popular-posts-list): bg-card panel, thin border, 6px radius. Sits
   inside the dark #main-footer, so it reads as a light callout card.
   Heading/text selectors cover a plain heading tag or a
   .footer-newsletter-title/-text class — adjust to match the real
   markup if the class names differ. */
#footer-newsletter-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px 24px;
    margin-bottom: 28px;
}

#footer-newsletter-strip h3,
#footer-newsletter-strip .footer-newsletter-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    padding-bottom: 10px;
    margin: 0 0 4px;
}

#footer-newsletter-strip h3::after,
#footer-newsletter-strip .footer-newsletter-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 36px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

#footer-newsletter-strip p,
#footer-newsletter-strip .footer-newsletter-text {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

#footer-newsletter-strip #newsletter-form,
#footer-newsletter-strip #footer-newsletter-form {
    flex-direction: row;
    flex-shrink: 0;
    gap: 10px;
}

.newsletter-status {
    font-size: 12px;
    margin-bottom: 8px;
}

.newsletter-status-success {
    color: var(--success);
}

.newsletter-status-error {
    color: var(--danger);
}

.register-status {
    font-size: 12px;
    margin-bottom: 8px;
}

.register-status-success {
    color: var(--success);
}

.register-status-error {
    color: var(--danger);
}

/* ---------- Exit-intent modal ---------- */
#exit-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

#exit-modal-overlay[hidden] {
    display: none;
}

#exit-modal {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); /* modal sits above an overlay, so a slightly stronger lift than the card default is warranted */
    max-width: 360px;
    width: 100%;
    padding: 28px 24px;
    text-align: center;
}

#exit-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-light);
    cursor: pointer;
    height: auto;
}

#exit-modal-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

#exit-modal-body {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

#exit-modal-dismiss {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 12px;
    margin-top: 10px;
    cursor: pointer;
    text-decoration: underline;
    height: auto;
}

/* ---------- Privacy notice banner ---------- */
#privacy-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--text-dark);
    color: var(--bg-card);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    z-index: 900;
}

#privacy-banner[hidden] {
    display: none;
}

#privacy-banner-text {
    font-size: 13px;
    color: var(--bg-main);
    max-width: 720px;
}

#privacy-banner-text a {
    color: var(--bg-card);
    text-decoration: underline;
}

#privacy-banner-accept {
    height: 32px;
    padding: 0 16px;
    border: 1px solid var(--bg-card);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-dark);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ========================================================================
   6. STATIC PAGES (About, Contact, Privacy, Terms, Cookies)
   ======================================================================== */
/* Full-width to match .article-container on post.ejs — spans the whole
   #page-wrapper (responsive: 100% up to 1080px on mobile/tablet, 70% capped
   at 1400px on desktop). Previously capped at 720px as a narrow "reading
   width" for these pages; removed per request so About/Contact/Privacy/
   Terms/Cookies match the post page width. */
.static-page-content {
    margin: 24px auto 0; /* auto left/right centers the capped-width block within #page-wrapper */
    font-size: 15px;
    color: var(--text-main);
    max-width: 70ch; /* caps line length for readability, matching .article-content */
}

.static-page-content h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 10px;
}

.static-page-content p {
    margin-bottom: 14px;
}

body.view-contact .static-page-content > p {
    max-width: 640px; /* intro copy reads as a wall of text at full container width; cap it near the form's own 480px so the page doesn't feel lopsided */
}

.static-page-content a[href^="mailto:"] {
    color: var(--link);
    font-weight: 600;
}

.static-page-content code {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 13px;
}

.static-disclaimer {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 13px;
    color: var(--warning-text);
}

.static-status {
    font-size: 13px;
    margin-bottom: 12px;
}

.static-status-success {
    color: var(--success);
}

.static-status-error {
    color: var(--danger);
}

#contact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 480px;
}

#contact-form textarea {
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

#contact-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: -4px; /* pulls the label in close to its input, since the form's own 10px flex gap already adds spacing below */
}

#contact-form select {
    height: 36px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--bg-card);
}

#contact-form .field-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: -4px; /* same tightening as label, so the error sits close to the field it belongs to */
}

#contact-form .field-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: -4px;
}

/* ========================================================================
   7. BLOG ENGINE — post listings, archives, search feeds, reading view
   ======================================================================== */
.blog-wrapper {
    margin: 0 auto;
    padding: 40px 20px;
    max-width: 800px; /* Golden utility block container width */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.blog-footer {
    text-align: center;
    padding-top: 32px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Back link */
.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 24px;
    transition: color var(--transition-speed) ease;
}
.back-link:hover {
    color: var(--primary);
}

/* Post Listing Engine (Feed Layout, Archives, Search Index Views) */
.feed-header {
    margin-bottom: 40px;
}
.feed-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-dark);
}
.feed-subtitle {
    font-family: var(--font-heading);
    color: var(--text-muted);
    margin-top: 4px;
}

.post-feed-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.feed-item-card {
    background: var(--bg-card);
    padding: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}
.feed-item-card:hover {
    border-color: var(--primary);
    background-color: var(--bg-alt);
}

.feed-item-image {
    width: calc(100% + 56px);
    height: 200px;
    object-fit: cover;
    object-position: center;
    margin: -28px -28px 0 -28px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: block;
}

.feed-item-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.3;
}
.feed-item-card:hover .feed-item-title {
    color: var(--primary);
}

.feed-item-excerpt {
    color: var(--text-main);
    font-size: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Individual Long-Form Article (Post Typography Layout) */
.article-container {
    margin: 0 auto;
    max-width: 70ch; /* caps line length for readability and keeps title, byline, pills, share buttons, excerpt, author card, and footer aligned with the body text column */
    padding-top: 40px; /* respiro no topo do post */
}

.article-title {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 16px;
}

.article-content {
    font-family: var(--font-serif); /* JetBrains Mono for body/reading text */
    font-size: 0.9375rem; /* ~15px equivalent */
    line-height: 1.65; /* explicit per spec (was --line-height-reading: 1.75, which already cleared the bar) */
    color: var(--text-dark);
    margin-top: 32px; /* width now comes from .article-container */
    margin-bottom: 32px; /* breathing room before author card / end of article */
}
.article-content p {
    margin-bottom: 1.25rem;
}
.article-content h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
}
.article-content h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
}
.article-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-dark);
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
}
.article-content img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 24px 0;
}

/* Callout blockquote */
.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1.75rem 0;
    color: var(--text-muted);
    font-style: italic;
}
.article-content blockquote p {
    margin-bottom: 0;
}

/* Lists */
.article-content ul,
.article-content ol {
    margin: 0 0 1.25rem 0;
    padding-left: 1.5rem; /* matches the 24px gap used elsewhere */
    color: var(--text-dark);
}
.article-content ul {
    list-style: disc;
}
.article-content ol {
    list-style: decimal;
}
.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.65; /* matches body copy */
}
.article-content li:last-child {
    margin-bottom: 0;
}
/* nested lists shouldn't add another full paragraph gap */
.article-content li > ul,
.article-content li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Comparison tables inside article body */
.article-content table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.75rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.article-content th,
.article-content td {
    padding: 0.85rem 1.5rem; /* 24px min horizontal gap, per spec */
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
}
.article-content th:not(:last-child),
.article-content td:not(:last-child) {
    border-right: 1px solid var(--border-color);
}
.article-content tr:last-child td {
    border-bottom: none;
}
.article-content thead th {
    font-family: var(--font-heading);
    font-weight: 700;
    background: var(--bg-main);
    color: var(--text-dark);
}
/* 3-column matrix widths: 25% / 35% / 40% */
.article-content table th:nth-child(1),
.article-content table td:nth-child(1) { width: 25%; }
.article-content table th:nth-child(2),
.article-content table td:nth-child(2) { width: 35%; }
.article-content table th:nth-child(3),
.article-content table td:nth-child(3) { width: 40%; }

/* Small screens: scroll instead of squeezing (no markup changes needed) */
@media (max-width: 640px) {
    .article-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Shared Taxonomy Pills */
.topics-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-pill {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--bg-main);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}
.topic-pill:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--bg-card);
}

/* Grid Recommendations Block */
.recommendations-section {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}
.recommendations-heading {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 20px;
}
.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.recommendations-grid .topic-pill {
    font-size: 0.65rem;
    padding: 2px 8px;
}


.recommendations-grid .feed-item-title {
    font-size: 1.15rem;
    margin: 4px 0;
}
.read-story-link {
    color: var(--primary);
    font-weight: 600;
}
.empty-state-message {
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* Article Meta & Byline */
.article-byline {
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 16px;
}
.article-byline strong {
    color: var(--text-dark);
}

.article-container > .topics-container {
    margin-bottom: 24px;
}

.article-excerpt {
    font-size: 1.1rem;
    color: var(--text-dark);
    border-left: 3px solid var(--primary);
    padding-left: 16px;
    margin-bottom: 28px;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
}
.share-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.share-buttons a {
    text-decoration: none;
    color: var(--text-dark);
}
.copy-link-btn {
    border: 1px solid var(--text-muted);
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    cursor: pointer;
    color: var(--text-dark);
    font-size: 0.85rem;
}

/* Author Card */
.author-card {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 32px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
}
.author-card strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}
.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}
.author-bio {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Article Footer */
.article-footer {
    margin-top: 1.5rem; /* consistent gap from the author card above it */
}
.article-footer small {
    color: var(--text-muted);
}
.article-footer strong {
    color: var(--text-dark);
}

/* Shared Utility (Admin + Public) */
.inline-delete-form {
    display: none;
}

/* ========================================================================
   8. RESPONSIVE
   ======================================================================== */
@media (max-width: 900px) {
    #content-grid {
        grid-template-columns: 1fr;
    }

    #featured-post-container {
        min-height: 340px;
    }

    .featured-text {
        padding: 28px 24px;
        max-width: 100%;
    }

    .featured-title {
        font-size: 30px;
    }

    #footer-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    #site-logo-divider,
    #site-logo-categories {
        display: none;
    }

    #nav-links {
        display: none;
    }

    #nav-links.nav-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 48px;
        right: 0;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 12px 20px;
        gap: 12px;
        z-index: 10;
    }

    #menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: var(--text-dark);
        color: var(--bg-card);
        border-radius: var(--radius-md);
        font-size: 18px;
    }

    #latest-posts-container {
        grid-template-columns: 1fr;
    }

    .nav-section-posts {
        grid-template-columns: 1fr;
    }

    #site-search-form.expanded #site-search-input {
        width: 110px;
    }

    #category-filters {
        overflow-x: auto;
        white-space: nowrap;
    }

    #footer-top {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    #footer-newsletter-strip {
        flex-direction: column;
        align-items: flex-start;
    }

    #footer-newsletter-form {
        flex-direction: column;
        width: 100%;
    }

    #footer-newsletter-form input {
        width: 100%;
    }
}