/*
 * SHARED COMPONENT LAYER
 *
 * Every StreamField block composes its layout from the primitives here
 * instead of shipping its own copy. Before this file existed, the tab bars
 * in documents.css and staff.css were byte-identical duplicates, the
 * carousel arrows were near-identical, and the section header markup was
 * copy-pasted into seven templates.
 *
 * Primitives: .section-block, .container, .section-header, .card,
 * .card-grid, .btn, .badge, .eyebrow, .tabs, .input, .carousel-nav.
 */

/* ---- App shell ------------------------------------------------------- */

body {
    /* Sticky footer: main grows, footer stays at the bottom on short pages.
       Previously done with Tailwind utilities on <body>/<main>, which also
       hardcoded the page background and content width. */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/*
 * <main> spans the full viewport and every section inside it constrains its
 * own content with .container. This is what lets a section paint a
 * background band edge to edge (see the appearance presets below) and lets
 * the hero go full-bleed without the old `width: 100vw` trick - 100vw
 * includes the scrollbar gutter, which pushed the hero 6px off the left
 * edge and out past the right on any scrolling page.
 */
.site-main {
    flex: 1 1 auto;
    width: 100%;
}

/* Header top bar: deliberately always dark (a deep slate, never pure
   black) regardless of the tenant palette, so it reads as a utility strip
   above the themed header rather than competing with it. */
.site-topbar {
    background: #0f172a;
    color: rgb(255 255 255 / 0.82);
    font-size: var(--fs-xs);
}

.site-topbar a:hover {
    color: #fff;
}

.site-topbar__group {
    display: flex;
    gap: var(--space-xs);
    padding-left: var(--space-sm);
    border-left: 1px solid rgb(255 255 255 / 0.22);
}

.site-topbar__lang {
    color: rgb(255 255 255 / 0.65);
    text-decoration: none;
    transition: color var(--transition);
}

.site-topbar__lang.is-current {
    color: #fff;
    font-weight: 700;
}

.site-subnav {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-page);
}

.site-dropdown {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-overlay);
}

.footer-map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 8rem;
    border-radius: var(--radius-md);
    background: rgb(255 255 255 / 0.06);
    color: rgb(255 255 255 / 0.55);
    font-size: var(--fs-sm);
}

.site-footer__bottom {
    padding-block: var(--space-md);
    border-top: 1px solid rgb(255 255 255 / 0.12);
    font-size: var(--fs-xs);
    text-align: center;
}

.breadcrumbs {
    padding-top: var(--space-lg);
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
}

.breadcrumbs__link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumbs__link:hover {
    color: var(--color-primary-text);
}

.breadcrumbs__current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---- Section + container --------------------------------------------- */

.section-block {
    /* Vertical rhythm is routed through --pad-y so the padding presets can
       retune it by setting one inherited custom property, instead of each
       preset having to out-specify this rule. Longhands with px fallbacks:
       if a custom property ever fails to resolve, spacing degrades to a
       sane value rather than to zero. */
    --pad-y: var(--section-padding-y, 64px);
    padding-top: var(--pad-y);
    padding-bottom: var(--pad-y);
}

/* Collapse the double gap where two plain sections meet, so the rhythm
   between blocks stays one section-padding tall rather than two. Sections
   painting a background band keep their own padding - the band needs its
   inner breathing room, and its edge is what separates it from neighbours. */
.section-block:not([class*="bg-variant-"]) + .section-block:not([class*="bg-variant-"]) {
    padding-top: 0;
}

.container {
    width: 100%;
    max-width: var(--container-max, 1240px);
    margin-inline: auto;
    /* The gutter lives here now that <main> is full-bleed. */
    padding-inline: var(--space-md);
}

/* ---- Appearance presets (editor-selectable, see BlockAppearanceSettings)
 *
 * Deliberately a closed set of tokenised presets rather than a color
 * picker: an editor can restyle a section without being able to introduce
 * an off-palette color or a contrast failure. Every value below resolves
 * from the tenant's own theme tokens.
 *
 * These sit after .section-block so the --pad-y override wins on equal
 * specificity, and they work on the hero too - --pad-y and the background
 * both inherit down to .hero__frame.
 */

.bg-variant-white {
    background-color: var(--bg-surface);
}

.bg-variant-muted {
    background-color: var(--bg-subtle);
}

.bg-variant-brand-tint {
    background-color: var(--color-primary-light);
}

/*
 * Both tinted bands sit darker than the page, which drops the default
 * secondary text under the AA floor (measured 4.14:1 on muted, 3.95:1 on
 * brand-tint). Re-pointing the inherited --text-muted at its deepened
 * variant fixes every descendant at once - subtitles, card metadata,
 * list meta - with no per-component overrides.
 */
.bg-variant-muted,
.bg-variant-brand-tint {
    --text-muted: var(--text-muted-strong);
}

.pad-compact {
    --pad-y: clamp(2rem, 3.5vw, 3rem);
}

.pad-none {
    --pad-y: 0px;
}

/* ---- Section header -------------------------------------------------- */

.section-header {
    margin-bottom: var(--space-xl, 32px);
}

.eyebrow,
.section-header__eyebrow {
    display: inline-block;
    margin-bottom: var(--space-sm, 8px);
    color: var(--color-primary-text);
    font-family: var(--font-body);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.section-header__title {
    font-family: var(--font-heading);
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    text-wrap: balance;
}

/* A page title (the partial's level=1) is one step up the scale from a
   block heading. Needs to out-specify .section-header__title, which would
   otherwise flatten the u-h1 utility back to --fs-h2. */
.section-header__title.u-h1 {
    font-size: var(--fs-h1);
}

.section-header__subtitle {
    margin-top: var(--space-md, 16px);
    max-width: var(--measure-short, 42rem);
    color: var(--text-muted);
    font-size: var(--fs-body-lg);
    line-height: var(--lh-relaxed);
    text-wrap: pretty;
}

.section-header--center {
    text-align: center;
}

.section-header--center .section-header__subtitle {
    margin-inline: auto;
}

/* ---- Card ------------------------------------------------------------ */

.card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-ambient);
    overflow: hidden;
}

.card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--card-media-ratio, 3 / 2);
    background: var(--bg-page);
    overflow: hidden;
}

.card__media img,
.card__media picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm, 8px);
    padding: var(--space-lg, 24px);
}

.card__title {
    font-family: var(--font-heading);
    font-size: var(--fs-h4);
    font-weight: 700;
    line-height: var(--lh-snug);
    color: var(--text-primary);
}

.card__text {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
}

.card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm, 8px);
    margin-top: auto;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

/* Anything clickable lifts on hover: 2px of travel plus the next
   elevation tier reads as "this is pressable" without any color change. */
.card--interactive {
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--transition), transform var(--transition),
                border-color var(--transition);
}

.card--interactive:hover,
.card--interactive:focus-visible {
    box-shadow: var(--shadow-lifted);
    transform: translateY(var(--lift, -2px));
}

/* ---- Media frame ------------------------------------------------------
 *
 * A fixed-ratio, clipped image box - shared by club cards and gallery
 * tiles. The ratio is declared on the frame, not the image, so the space is
 * reserved before the photo loads (no layout shift) and every upload crops
 * to the same shape instead of stretching. Set --media-ratio to change it.
 *
 * Zoom: the image scales inside the frame while the frame's
 * overflow:hidden keeps the edges crisp. It triggers on the frame itself
 * or on any hovered/focused ancestor marked .has-media-zoom (a whole card).
 */

.media-frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--media-ratio, 4 / 3);
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
}

/* The picture tag wraps the <img> in an inline <picture>, which would break
   the height chain the cover-fit needs. */
.media-frame picture {
    display: block;
    width: 100%;
    height: 100%;
}

.media-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.media-frame:hover img,
.media-frame:focus-visible img,
.has-media-zoom:hover .media-frame img,
.has-media-zoom:focus-within .media-frame img {
    transform: scale(1.03);
}

/* Keep the photo's own proportions (masonry layouts): same corners, clipping
   and zoom, but no forced crop. */
.media-frame--natural {
    aspect-ratio: auto;
}

.media-frame--natural picture,
.media-frame--natural img {
    height: auto;
}

/* ---- Responsive card grid -------------------------------------------- */
/*
 * One fluid grid for every block: tracks are generated from --card-min, so
 * column counts adapt to the container instead of to hardcoded
 * breakpoints. auto-fill (not auto-fit) keeps empty tracks, so a block with
 * a single item renders a normally-sized card rather than one stretched
 * across the full width.
 */

.card-grid {
    display: grid;
    gap: var(--space-lg, 24px);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min, 17rem)), 1fr));
}

/* ---- Buttons --------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm, 8px);
    padding: 0.75rem var(--space-lg, 24px);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition),
                color var(--transition), box-shadow var(--transition),
                transform var(--transition);
}

.btn:hover {
    transform: translateY(var(--lift, -2px));
}

.btn--primary {
    background-color: var(--color-primary-strong);
    color: #fff;
    box-shadow: var(--shadow-ambient);
}

.btn--primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: var(--shadow-lifted);
}

.btn--secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn--secondary:hover {
    border-color: var(--color-primary-strong);
    color: var(--color-primary-text);
    box-shadow: var(--shadow-ambient);
}

.btn--ghost {
    background-color: transparent;
    color: var(--color-primary-text);
    padding-inline: var(--space-sm);
}

.btn--ghost:hover {
    background-color: var(--color-primary-light);
}

/* For use on hero images and other dark/photographic backgrounds. */
.btn--on-dark {
    background-color: #fff;
    color: var(--color-primary-text);
    box-shadow: var(--shadow-lifted);
}

.btn--on-dark:hover {
    background-color: #fff;
    color: var(--color-primary-hover);
    box-shadow: var(--shadow-overlay);
}

.btn--sm {
    padding: 0.5rem var(--space-md, 16px);
    font-size: var(--fs-xs);
}

.btn--block {
    width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Badges / pills -------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs, 4px);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: var(--fs-2xs);
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* Soft tint - the default for metadata (categories, age groups, tenure). */
.badge--soft {
    background: var(--color-primary-light);
    color: var(--color-primary-text);
}

/* Solid - reserved for format/status markers that must read as a label. */
.badge--solid {
    background: var(--color-primary-strong);
    color: #fff;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.badge--neutral {
    background: var(--bg-page);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* ---- Tabs (shared by the Documents and Staff blocks) ----------------- */

.tabs__nav {
    display: flex;
    gap: var(--space-xs, 4px);
    margin-bottom: var(--space-lg, 24px);
    padding: var(--space-xs);
    border-radius: var(--radius-full);
    background: var(--bg-page);
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tabs__nav::-webkit-scrollbar {
    display: none;
}

.tabs__tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm, 8px);
    padding: 0.5rem var(--space-md, 16px);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--transition), color var(--transition),
                box-shadow var(--transition);
}

.tabs__tab:hover {
    color: var(--color-primary-text);
}

.tabs__tab.is-active {
    background: var(--bg-surface);
    color: var(--color-primary-text);
    box-shadow: var(--shadow-ambient);
}

.tabs__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding-inline: 0.35rem;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary-text);
    font-size: var(--fs-2xs);
    font-weight: 700;
}

.tabs__tab.is-active .tabs__count {
    background: var(--color-primary-strong);
    color: #fff;
}

/* ---- Accordion ------------------------------------------------------- */

.accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.accordion__item {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.accordion__item:hover {
    box-shadow: var(--shadow-ambient);
}

.accordion__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-heading);
    font-size: var(--fs-body);
    font-weight: 600;
    color: var(--text-primary);
    text-align: start;
    transition: background-color var(--transition);
}

.accordion__trigger:hover {
    background: var(--bg-page);
}

.accordion__marker {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary-text);
    font-size: var(--fs-body);
    font-weight: 700;
}

.accordion__panel {
    padding: 0 var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-md);
}

.accordion__action {
    margin-top: var(--space-md);
}

/* ---- Definition-list grid (weekly menu) ------------------------------ */

.meal-list {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.meal-list__item dt {
    color: var(--text-muted);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.meal-list__item dd {
    margin: var(--space-xs) 0 0;
    font-size: var(--fs-sm);
    color: var(--text-primary);
}

/* ---- Roster card (legacy Staff page) --------------------------------- */

.roster-grid {
    --card-min: 16rem;
}

.roster-card__body {
    align-items: center;
    text-align: center;
}

.roster-card__avatar {
    display: block;
    width: 7rem;
    height: 7rem;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-full);
    background: var(--bg-page);
    overflow: hidden;
}

.roster-card__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.roster-card__photo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.roster-card__role {
    color: var(--color-primary-text);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.roster-card__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs);
}

/* ---- Form controls --------------------------------------------------- */

.input {
    width: 100%;
    min-width: 0;
    padding: 0.75rem var(--space-md, 16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    transition: border-color var(--transition), box-shadow var(--transition),
                background-color var(--transition);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    background: var(--bg-surface);
    border-color: var(--color-primary-strong);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* ---- Carousel arrows (shared visual for Staff and Gallery) ----------- */

.carousel-nav {
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lifted);
    transition: background-color var(--transition), color var(--transition),
                box-shadow var(--transition);
}

.carousel-nav:hover {
    background: var(--color-primary-strong);
    color: #fff;
    box-shadow: var(--shadow-overlay);
}

.carousel-nav svg {
    width: 1.35rem;
    height: 1.35rem;
}

@media (max-width: 640px) {
    .carousel-nav {
        display: none;
    }
}

/* ---- Horizontal scroll rail (carousel track) ------------------------- */

.scroll-rail {
    display: flex;
    gap: var(--space-md, 16px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-sm, 8px);
    scrollbar-width: thin;
}

.scroll-rail > * {
    scroll-snap-align: start;
}

/* ---- Empty state ----------------------------------------------------- */

.empty-state {
    padding: var(--space-2xl, 48px) var(--space-lg, 24px);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    text-align: center;
}
