:root {
    --bg: #1b1b2f;
    --bg-deep: #12172c;
    --surface-1: rgba(22, 36, 71, 0.82);
    --surface-2: rgba(31, 64, 104, 0.74);
    --surface-3: rgba(23, 44, 77, 0.92);
    --surface-4: rgba(255, 255, 255, 0.06);
    --text: #edf1f7;
    --muted-text: #cfd6e6;
    --soft-text: #aeb9cf;
    --accent: #d32f4a;
    --accent-hover: #b7243b;
    --accent-soft: rgba(211, 47, 74, 0.18);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.22);
    --shadow-lg: 0 30px 80px rgba(4, 7, 18, 0.45);
    --shadow-md: 0 18px 40px rgba(6, 9, 20, 0.28);
    --focus: #ffd700;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 56px;
    --space-10: 72px;
    --space-11: 96px;
    --content-sm: 760px;
    --content-md: 980px;
    --content-lg: 1200px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 20px;
    z-index: 1000;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-lg);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, rgba(228, 63, 90, 0.18), transparent 28%),
        radial-gradient(circle at 80% 20%, rgba(70, 125, 197, 0.18), transparent 24%),
        linear-gradient(180deg, #111426 0%, #161b31 32%, #1b1b2f 100%);
    color: var(--text);
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px),
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px),
        radial-gradient(circle at 35% 70%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px);
    background-size: 220px 220px, 280px 280px, 340px 340px;
    opacity: 0.32;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a,
button,
input,
textarea {
    font: inherit;
}

a,
button {
    cursor: pointer;
}

a {
    color: inherit;
    transition: color 0.18s ease, opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.lang:not(.active) {
    display: none !important;
}

.lang.active {
    display: block;
}

a.lang.active {
    display: inline-flex;
}

img.lang.active {
    display: block;
}

picture.lang.active {
    display: block;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    background: rgba(17, 20, 38, 0.74);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner,
.content-wrap,
.footer-inner {
    width: min(var(--content-lg), calc(100% - 32px));
    margin: 0 auto;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    min-height: 80px; /* Incrementized to provide a stable, standard reserved height */
    padding: 12px 0;
    contain: layout; /* Helps with CLS by isolating the internal layout */
}

.brand-lockup {
    display: grid;
    gap: 0;
    text-decoration: none;
    min-width: 0;
    flex-shrink: 0; /* Prevents logo from shrinking and shifting the nav links */
}

.brand-name {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    line-height: 1.1;
    font-weight: 700;
    color: var(--text);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: nowrap; /* Prevents layout shifts on most desktop/tablet views */
    justify-content: flex-end;
    min-height: 48px; /* Stable height for the nav block */
}

.nav-links,
.language-switch {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.nav-links a {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 10px 14px;
    font-size: 0.92rem;
    text-decoration: none;
    color: var(--muted-text);
    background: transparent;
}

.language-switch button,
.language-switch a {
    padding: 4px 6px;
    font-size: 0.92rem;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
    color: var(--muted-text);
    background: transparent;
    border: none;
    border-radius: 0;
}

.nav-links a:hover,
.language-switch button:hover,
.language-switch a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.nav-links a[aria-current="page"] {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
}

.language-switch button[aria-pressed="true"],
.language-switch a[aria-current="true"] {
    color: var(--text);
    background: transparent !important;
    border: none !important;
    font-weight: 700; /* Maintains consistency when active */
}

.content-wrap {
    padding: var(--space-10) 0 var(--space-11);
}

.section-shell {
    width: min(var(--content-md), 100%);
    margin: 0 auto;
}

.section-shell-wide {
    width: min(var(--content-lg), 100%);
    margin: 0 auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.button-primary,
.button-secondary,
.button-tertiary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.button-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 14px 28px rgba(228, 63, 90, 0.24);
}

.button-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.button-secondary {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
}

.button-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.button-tertiary {
    padding: 0;
    min-height: auto;
    border-radius: 0;
    color: var(--text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.26);
}

.button-tertiary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.section-heading {
    display: grid;
    gap: var(--space-4);
    max-width: 760px;
}

.section-heading h1,
.section-heading h2,
.section-heading h3,
.display-title,
.display-subtitle,
.stat-value,
.card-title,
.event-date,
.page-title {
    margin: 0;
}

.section-heading h2,
.page-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.section-heading p,
.lede,
.page-intro,
.card-copy,
.event-copy,
.meta-copy,
footer p {
    margin: 0;
    color: var(--muted-text);
    font-size: clamp(1rem, 1.4vw, 1.08rem);
}

.glass-panel,
.content-panel,
.card-surface,
.highlight-panel {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow-md);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .site-header,
    .glass-panel,
    .content-panel,
    .card-surface,
    .highlight-panel {
        background: rgba(17, 20, 38, 0.92);
    }
}

.content-panel,
.highlight-panel {
    border-radius: var(--radius-lg);
    padding: clamp(22px, 4vw, 38px);
}

.card-grid {
    display: grid;
    gap: var(--space-5);
}

.card-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-surface {
    border-radius: var(--radius-md);
    padding: clamp(20px, 3vw, 28px);
    transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.card-surface:hover,
.highlight-panel:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
}

.card-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    line-height: 1.15;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--soft-text);
    font-size: 0.82rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.meta-pill:visited,
.meta-pill:hover,
.meta-pill:focus-visible,
.meta-pill:active {
    color: var(--soft-text);
    text-decoration: none;
}

.footer-inner {
    padding: var(--space-8) 0 var(--space-9);
    display: grid;
    gap: var(--space-5);
}

footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 13, 25, 0.42);
}

.footer-top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-6);
    align-items: flex-start;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.footer-links a {
    color: var(--muted-text);
    text-decoration: none;
}

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

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.social-link img {
    width: 20px;
    height: 20px;
}

.community-panel {
    display: grid;
}

.community-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-7);
}

.action-stack {
    justify-items: start;
    min-width: min(280px, 100%);
}

.stack-sm {
    display: grid;
    gap: var(--space-3);
}

.stack-md {
    display: grid;
    gap: var(--space-5);
}

.stack-lg {
    display: grid;
    gap: var(--space-7);
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translate3d(0, 14px, 0); /* Forced compositor-only property */
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in {
    animation: fade-in-up 380ms cubic-bezier(0.16, 1, 0.3, 1) both; /* Using 'both' for better layout stability during animation */
    will-change: opacity, transform; /* Signals the browser to use the compositor and avoid re-layouts */
}

@media (max-width: 1024px) {
    .header-inner,
    .footer-top {
        align-items: flex-start;
        flex-direction: column;
    }

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

@media (max-width: 1080px) {
    .community-grid {
        grid-template-columns: 1fr;
    }

    .action-stack {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .content-wrap {
        padding: var(--space-8) 0 var(--space-10);
    }

    .header-inner {
        min-height: auto;
    }

    .site-nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap; /* Re-enable wrapping on mobile if necessary */
    }

    .nav-links a,
    .language-switch button {
        padding: 9px 12px;
        font-size: 0.88rem;
    }

    .cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .button-primary,
    .button-secondary {
        width: 100%;
    }

    .content-panel,
    .highlight-panel,
    .card-surface {
        border-radius: 24px;
    }

    .footer-inner {
        padding: var(--space-7) 0 var(--space-8);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        animation: none !important;
        transition: none !important;
    }
}
