body {
    font-family: 'Inter', sans-serif;
}

:root {
    --sticky-nav-offset: 116px;
}

html {
    /* Applies to native hash navigation and scrollIntoView defaults */
    scroll-padding-top: var(--sticky-nav-offset);
}

/* Shared navbar mount: sticky across all pages using the component loader */
#site-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Keep hash/anchor targets visible below the sticky navbar. */
main section[id],
#news-detail-content .article-heading[id],
:target {
    scroll-margin-top: var(--sticky-nav-offset);
}

/* Navbar links as soft buttons (clean/professional, low-contrast) */
#site-navbar .top-nav-links > a:not(.hidden),
#site-navbar .top-nav-links > button:not(.hidden),
#site-navbar .top-nav-links > .nav-item > .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.65rem;
    transition: background-color 0.18s ease, color 0.18s ease;
}

#site-navbar .top-nav-links > a:hover,
#site-navbar .top-nav-links > button:not(.hidden):hover,
#site-navbar .top-nav-links > .nav-item > .nav-link:hover {
    background: #f3f4f6;
}

#site-navbar .top-nav-links > a:active,
#site-navbar .top-nav-links > button:not(.hidden):active,
#site-navbar .top-nav-links > .nav-item > .nav-link:active {
    background: #e5e7eb;
}

/* Active page chip (set by navbar-loader) */
#site-navbar .top-nav-links a.text-blue-700,
#site-navbar .mobile-nav-links a.text-blue-700 {
    background: #eff6ff;
}

/* Mobile links/buttons keep the same button behavior */
#site-navbar .mobile-nav-links a,
#site-navbar .mobile-nav-links button:not(.hidden) {
    border-radius: 0.65rem;
    transition: background-color 0.18s ease, color 0.18s ease;
}

#site-navbar .mobile-nav-links a:hover,
#site-navbar .mobile-nav-links button:not(.hidden):hover {
    background: #f3f4f6;
}

#site-navbar .mobile-nav-links a:active,
#site-navbar .mobile-nav-links button:not(.hidden):active {
    background: #e5e7eb;
}

/* Desktop nav dropdowns for page sections */
#site-navbar .nav-item {
    position: relative;
}

#site-navbar .nav-item .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#site-navbar .nav-submenu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 220px;
    border: 1px solid #e5e7eb;
    border-radius: 0.85rem;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    padding: 0.4rem;
    display: none;
    z-index: 60;
}

#site-navbar .nav-item.is-open .nav-submenu,
#site-navbar .nav-item:focus-within .nav-submenu {
    display: block;
}

#site-navbar .nav-submenu-link {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: 0.55rem;
    color: #374151;
    font-size: 0.95rem;
}

#site-navbar .nav-submenu-link:hover {
    background: #f3f4f6;
    color: #1d4ed8;
}

/* Mobile accordion submenus */
#site-navbar .mobile-accordion-btn {
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.5rem;
    border-radius: 0.65rem;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
}

#site-navbar .mobile-accordion-btn::after {
    content: '▾';
    float: right;
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

#site-navbar .mobile-accordion-btn[aria-expanded='true']::after {
    content: '▴';
}

#site-navbar .mobile-submenu {
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    border-left: 2px solid #dbeafe;
    padding-left: 0.55rem;
}

#site-navbar .mobile-submenu-link {
    display: block;
    padding: 0.4rem 0.45rem;
    border-radius: 0.5rem;
    color: #4b5563;
}

#site-navbar .mobile-submenu-link:hover {
    background: #f3f4f6;
    color: #1d4ed8;
}

/* Article media attribution blocks (under images/videos/hero) */
.article-media-meta {
    display: inline-block;
    max-width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f9fafb;
    padding: 0.6rem 0.8rem;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.45;
}

.article-media-meta p {
    margin: 0;
}

.article-media-meta p + p {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px dashed #e5e7eb;
}

.article-media-label {
    display: inline-block;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #374151;
    margin-right: 0.35rem;
}

.article-media-link {
    color: #1f2937;
    text-decoration: none;
    border-bottom: 1px solid #d1d5db;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.article-media-link:hover {
    color: #111827;
    border-bottom-color: #9ca3af;
}

.article-media-meta--hero {
    margin-top: 0.2rem;
}

/* Article detail right-side TOC */
@media (min-width: 1024px) {
    .article-toc-aside {
        display: block;
        position: sticky;
        top: calc(var(--sticky-nav-offset) - 6px);
        align-self: start;
        height: fit-content;
    }

    .article-toc-card {
        max-height: calc(100vh - var(--sticky-nav-offset) - 16px);
        overflow-y: auto;
    }
}
/* Simple animation for hero text */
.fade-in-up {
    animation: fadeInUp 1s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.fade-in-up:nth-child(1) { animation-delay: 0.2s; }
.fade-in-up:nth-child(2) { animation-delay: 0.4s; }
.fade-in-up:nth-child(3) { animation-delay: 0.6s; }

.fade-in-down {
    animation: fadeInDown 1s ease-out forwards;
    opacity: 0;
    transform: translateY(-20px);
}
@keyframes fadeInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown 0.25s ease-out forwards;
    transform: translateY(-10px);
}

@keyframes slideDown {
    to {
        transform: translateY(0);
    }
}

/* Auth visibility is controlled in app.js using Tailwind's `hidden` class. */

/* Simple transition for modal */
#agenda-modal {
    transition: opacity 0.3s ease;
}
/* Style for the close button */
#close-modal-btn {
    font-size: 2rem;
    line-height: 1;
    font-weight: 300;
}
/* Adjust main content height when using sticky sidebar */
/* 100vh minus header height (4rem) */
main {
    min-height: calc(100vh - 4rem);
}

/* Video background styles */
.hero-section {
    position: relative;
    overflow: hidden;

    /* Hero height controls (edit these to change hero size) */
    --hero-min-height-mobile: 480px;
    --hero-min-height-desktop: 700px;

    min-height: var(--hero-min-height-mobile);
    display: grid;
    place-items: center; /* center hero-content vertically */
}

@media (min-width: 768px) {
    .hero-section {
        min-height: var(--hero-min-height-desktop);
    }
}

/* container for video/iframe */
.video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* Native video background (CDN-friendly) */
.video-bg video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* visual style requested: subtle blur + slightly dim */
    filter: blur(3px) brightness(0.9);
    transform: scale(1.05); /* prevents blurred edges showing */
}

/* Keep iframe support (if you ever use it again) */
.video-bg iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 56.25vw;
    min-width: calc(100vh * (16 / 9));
    min-height: 100%;
    border: 0;
    z-index: 0;
}

/* overlay to improve readability */
.video-overlay {
    position: absolute;
    inset: 0;
    /* darker overlay + tiny extra blur-like softness */
    background: rgba(2, 6, 23, 0.45);
    z-index: 5;
    pointer-events: none;
}

/* keep hero content above video and overlay */
.hero-content {
    position: relative;
    z-index: 10;
}
/* Reduce motion/data on small screens */
@media (max-width: 768px) {
    /* Keep video visible on mobile as requested.
       If you experience performance issues, reduce blur/brightness or use a smaller video rendition. */
    .video-bg video {
        filter: blur(1px) brightness(0.92);
    }
}

/* Trainer image standardization: fixed size, circular crop */
.trainer-img {
    width: 150px;
    height: 150px;
    border-radius: 9999px; /* rounded-full */
    object-fit: cover;
    display: block;
}

/* Trainer section is hidden on small screens (see index.html). */

/* No extra mobile spacing needed because trainers section is md+ only. */

/* Center a lone last card in a two-column grid: when the last child is odd (i.e. alone)
   span it across both columns and center it. Applies only on md+ screens where
   the layout uses two columns. */

@media (min-width: 768px) {
    .trainers-grid {
        /* keep grid behavior from the markup (Tailwind provides it),
           but ensure we have predictable behavior here too */
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
    }

    .trainers-grid > :nth-child(odd):last-child {
        grid-column: 1 / -1; /* span both columns */
        justify-self: center; /* center the item */
        max-width: 680px; /* optional: keeps the card from becoming too wide */
        width: 100%;
    }
}

/* Scroll reveal animations (in-view)
   We only hide elements when JS is running (html.sr-ready).
   Important: don't hide entire sections; only hide `.reveal` / `.reveal-item` / `.reveal-group`
   so content layout doesn't disappear and animations stay noticeable. */
:root {
    --reveal-delay: 0ms;
}

html.sr-ready .reveal,
html.sr-ready .reveal-item,
html.sr-ready .reveal-group {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 650ms cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.sr-ready .reveal.is-inview,
html.sr-ready .reveal-item.is-inview,
html.sr-ready .reveal-group.is-inview {
    opacity: 1;
    transform: translateY(0);
}

/* Optional variants */
.reveal-fade { transform: none; }
.reveal-zoom { transform: scale(0.98); }
.reveal-zoom.is-inview { transform: scale(1); }

/* Stagger support for grouped items */
html.sr-ready .reveal-item {
    transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
    html.sr-ready .reveal,
    html.sr-ready .reveal-item,
    html.sr-ready .reveal-group {
         transition: none;
         transform: none;
         opacity: 1;
     }
}

/* News-style updates feed */
.news-section {
    background:
        linear-gradient(to bottom, #f8fafc 0%, #f9fafb 60%, #f8fafc 100%);
}

.news-section__header {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.news-section__header > div {
    max-width: 100%;
}

.news-feed {
    align-items: stretch;
}

.news-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(20, 19, 19, 0.06);
}

.news-card__title {
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.news-card__content {
    color: #4b5563;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    overflow: hidden;
}

.news-card__timestamp {
    font-size: 0.9rem;
    color: #6b7280;
}

.news-card__image {
    height: 12rem;
    width: 100%;
    border-radius: 0.75rem;
    object-fit: cover;
}

.news-card__cta {
    align-self: flex-start;
}

.news-card__actions {
    margin-top: auto;
}

/* First card gets a featured, editorial look */
.news-feed .news-card--featured {
    border-color: #dbeafe;
    box-shadow: 0 14px 16px rgba(39, 60, 244, 0.05);
}

.news-feed .news-card--featured .news-card__title--featured {
    font-size: 1.65rem;
    -webkit-line-clamp: 4;
}

.news-feed .news-card--featured .news-card__image--featured {
    height: 16rem;
}

.news-feed .news-card--featured .news-card__content {
    -webkit-line-clamp: 8;
}

@media (min-width: 768px) {
    .news-feed .news-card--featured {
        grid-column: span 2;
    }
}

@media (min-width: 1280px) {
    .news-feed .news-card--featured {
        grid-column: span 2;
    }
}

/* Dashboard article editor helpers */
.article-blocks-scroll {
    max-height: min(58vh, 760px);
    overflow: auto;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    background: #f9fafb;
}

.article-blocks-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(249, 250, 251, 0.96);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(2px);
}

.article-editor-row.dragging {
    opacity: 0.55;
}

.article-editor-row.drag-over-top {
    box-shadow: inset 0 3px 0 #2563eb;
}

.article-editor-row.drag-over-bottom {
    box-shadow: inset 0 -3px 0 #2563eb;
}

/* Homepage program area (agenda + events) */
.home-program-section {
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

.home-program-column {
    border-radius: 1rem;
}

.home-program-grid--events-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.agenda-card {
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

/* Event cards (used on homepage and dashboard list) */
.event-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    padding: 1rem;
}

.event-card__date {
    background: #2563eb;
    color: #ffffff;
    border-radius: 0.85rem;
    min-width: 4.75rem;
    padding: 0.75rem 0.6rem;
    text-align: center;
    line-height: 1.1;
}

.event-card__day {
    display: block;
    font-size: 1.85rem;
    font-weight: 700;
}

.event-card__month {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.event-card__content {
    min-width: 0;
}

.event-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.event-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.event-card__year {
    color: #6b7280;
    font-weight: 600;
}

.event-card__time {
    display: block;
    margin-top: 0.35rem;
    color: #1d4ed8;
    font-weight: 600;
}

.event-card__description {
    margin-top: 0.45rem;
    color: #4b5563;
}

.event-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.event-card__actions--mobile {
    margin-top: 0.8rem;
}

.event-card__actions--desktop {
    display: none;
}

.event-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.event-action-btn--primary {
    background: #1d4ed8;
    color: #ffffff;
}

.event-action-btn--primary:hover {
    background: #1e40af;
}

.event-action-btn--neutral {
    background: #111827;
    color: #ffffff;
}

.event-action-btn--neutral:hover {
    background: #1f2937;
}

.event-action-btn--danger {
    background: #dc2626;
    color: #ffffff;
}

.event-action-btn--danger:hover {
    background: #b91c1c;
}

.event-card--dashboard {
    border-color: #dbeafe;
    background: linear-gradient(to right, #ffffff, #f8fbff);
}

/* Dashboard event forms */
.dashboard-event-form {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.9rem;
}

.dashboard-event-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: #1f2937;
}

.dashboard-event-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    background: #f9fafb;
    padding: 0.65rem 0.8rem;
    color: #111827;
}

.dashboard-event-input:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
    border-color: #60a5fa;
}

@media (min-width: 1280px) {
    .home-program-grid--events-hidden #schedule .reveal-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {

    .event-card {
        padding: 1.2rem 1.3rem;
        gap: 1.2rem;
    }

    .event-card__actions--desktop {
        display: flex;
    }

    .event-card__actions--mobile {
        display: none;
    }

    .dashboard-event-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1279px) {
    .news-section__header {
        justify-content: center;
        text-align: center;
    }

    .news-section__header > div {
        margin-inline: auto;
    }

    .news-section__header p {
        margin-inline: auto;
    }
}

@media (max-width: 767px) {
    .event-card {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .event-card__date {
        width: fit-content;
        min-width: 4.5rem;
    }
}

/* Dashboard mobile usability */
@media (max-width: 767px) {
    .dashboard-page main {
        min-height: auto;
        padding: 0.9rem;
        /* Keep content clear of the fixed mobile footer nav */
        padding-bottom: calc(7rem + env(safe-area-inset-bottom));
    }

    #mobile-sidebar {
        box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.08);
        padding-top: 0.4rem;
        padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
    }

    #mobile-sidebar nav {
        gap: 0.15rem;
        justify-content: space-between;
    }

    #mobile-sidebar [data-tab] {
        border-radius: 0.75rem;
        min-width: 0;
        min-height: 2.65rem;
        justify-content: center;
        flex: 1 1 0;
    }

    /* Icon-only mobile dashboard nav */
    #mobile-sidebar [data-tab] span {
        display: none;
    }

    #mobile-sidebar [data-tab] i {
        margin-top: 0;
        font-size: 1.2rem;
    }

    /* Dashboard cards/forms on narrow screens */
    #tab-events > .bg-white,
    #tab-training > .bg-white,
    #tab-signups > .bg-white,
    #tab-updates > .bg-white,
    #tab-leden > .bg-white,
    #tab-articles .bg-white {
        border-radius: 1rem;
        padding: 1rem;
    }

    .dashboard-event-form {
        gap: 0.75rem;
    }

    #tab-signups .grid,
    #tab-updates .grid,
    #tab-leden form.grid {
        grid-template-columns: 1fr;
    }

    #tab-training .training-toolbar {
        position: static;
        z-index: auto;
        background: transparent;
        margin-bottom: 0.6rem;
    }

    /* Scheduler controls should stack on mobile to prevent overlap */
    #tab-training #training-generate-baseline-btn {
        width: 100%;
    }

    #tab-training #training-scheduler-status {
        width: 100%;
        display: block;
        line-height: 1.35;
    }

    #tab-training #training-scheduler-respect-locked {
        margin-top: 0.1rem;
    }

    #tab-training label[for="training-scheduler-config"] + textarea {
        margin-bottom: 0.1rem;
    }

    #tab-training table {
        min-width: 760px;
    }

    #tab-training th,
    #tab-training td {
        padding: 0.65rem 0.75rem;
        vertical-align: top;
    }

    /* Training modal + template modal mobile comfort */
    #training-modal,
    #template-builder-modal {
        align-items: flex-start;
        padding-top: 0.8rem;
        padding-bottom: 4.5rem;
    }

    .training-modal-card,
    #template-builder-modal > div {
        width: 100%;
        max-height: 86vh;
        overflow-y: auto;
        border-radius: 0.9rem;
    }

    .training-modal-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        padding-bottom: 0.25rem;
    }

    .training-modal-actions button,
    #template-builder-form button[type="submit"],
    #template-builder-cancel {
        width: 100%;
    }
}

/* Dashboard desktop sidebar icon alignment */
@media (min-width: 768px) {
    .dashboard-page aside nav [data-tab] i {
        width: 1.5rem;
        min-width: 1.5rem;
        margin-left: 0;
        margin-right: 0.65rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}

