:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --header-bg: #ffffff;
    --menu-bg: #dee4ea;
    --accent: #1f6fa8;       /* 5.4:1 on white (was #3498db, 3.2:1) */
    --link: #1a5f91;         /* 6.8:1 on white; dark theme sets its own */
    --accent-hover: #185a8a; /* 7.3:1 with white text */
    --border: #dee2e6;
    --card-bg: #ffffff;
    --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #f7f1f1;
    --link: #12f0fc;
    --header-bg: #1a1a1a;
    --menu-bg: #2d2d2d;
    --accent: #64b5f6;
    --accent-hover: #90caf9; /* 9.9:1 with #1a1a1a text */
    --border: #404040;
    --card-bg: #2d2d2d;
    --shadow: rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Form controls don't inherit the page font by default (browsers fall back
   to Arial). Engine controls set their own font with class selectors, so
   this element-level rule doesn't touch them. */
button, input, select, textarea {
    font-family: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
}

/* Sticky Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    color: var(--text-primary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 5px var(--shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Site name in the header links home; keep it looking like a title */
a.logo {
    color: inherit;
    text-decoration: none;
}

a.logo:hover {
    text-decoration: underline;
}

/* Hamburger Menu Button */
.menu-toggle {
   background: var(--menu-bg);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: background 0.3s;
}

.menu-toggle:hover,
.menu-toggle:focus {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: 2px solid var(--accent);
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: var(--menu-bg);
    transition: left 0.3s ease, visibility 0s linear 0s;
    z-index: 1001;
    overflow-y: auto;
}

/* visibility:hidden takes the off-screen links out of the tab order;
   the delay lets the slide-out finish before it hides. */
.side-menu.closed {
    left: -300px;
    visibility: hidden;
    transition: left 0.3s ease, visibility 0s linear 0.3s;
}

/* The open menu sits on top of the header's toggle; hide the toggle so
   it isn't a tab stop nobody can see. main.js sets this class. */
.menu-toggle.is-covered {
    visibility: hidden;
}

.menu-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--menu-bg);
    color: var(--text-primary);
    z-index: 10;
}

.menu-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.menu-close:hover,
.menu-close:focus {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: 2px solid var(--accent);
}

nav ul {
    list-style: none;
    padding: 1rem 0;
}

nav ul li {
    margin: 0;
}

nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s;
}

nav ul li a:hover,
nav ul li a:focus {
    background: var(--header-bg);
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

nav ul li a.active {
    background: var(--header-bg);
    border-left: 4px solid var(--accent);
    padding-left: calc(1.5rem - 4px);
    font-weight: bold;
}

.menu-divider {
    padding: 1rem 1.5rem 0.25rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grouped side menu: tighter than the generic nav rules. Scoped to the
   top-level lists so facet lists rendered inside the nav are untouched. */
#side-navigation > ul {
    padding: 0.25rem 0;
}

#side-navigation > ul > li > a {
    padding: 0.55rem 1.5rem;
}

.menu-text-block {
    padding: 1rem 1.5rem;
    color: rgb(48, 47, 47);
    font-size: 0.875rem;
    line-height: 1.5;
    border-left: 3px solid var(--accent);
    margin: 1rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

.menu-text-block p {
    margin-bottom: 0.5rem;
    color: rgb(48, 47, 47);
}

.menu-text-block p:last-child {
    margin-bottom: 0;
}

/* Theme toggle: sun/moon button in the header, left of the site name.
   Shows the moon in light mode and the sun in dark mode (the theme you'd
   switch to); aria-pressed carries the state for screen readers. */
.theme-btn {
    margin-left: auto;
    margin-right: 0.75rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1.35rem;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-btn:hover {
    background: var(--menu-bg);
}

.theme-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Moon in light mode, sun in dark (the engine's own theme-icon rules only
   apply inside its #btn-theme-toggle since simexdb#72) */
.theme-btn .theme-icon-sun,
[data-theme="dark"] .theme-btn .theme-icon-moon {
    display: none;
}

[data-theme="dark"] .theme-btn .theme-icon-sun {
    display: block;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;  /* same as header but later in the DOM, so it dims the header too */
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
main {
    margin-top: 60px;
    margin-left: 300px;
    padding: 2rem;
    max-width: calc(100% - 300px);
    width: 100%;
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

main.menu-closed {
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
}

section {
    margin-bottom: 1.5rem;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.55rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

a {
    color: var(--link);
}

.responsive-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-small {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-medium {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-large {
    max-width: 900px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-centered {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* optimizedGallery shortcode */
.gallery-card {
    flex-basis: 100%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

/* Each tile is a fixed square; the image (wrapped in <picture> by the image
   plugin) is absolutely positioned to fill it — no percentage-height chain. */
.gallery-grid a {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 6px;
}

.gallery-grid a > picture {
    position: absolute;
    inset: 0;
    display: block;
}

.gallery-grid a > img,
.gallery-grid a > picture > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gallery-grid a > img {
    position: absolute;
    inset: 0;
}

.gallery-grid a:hover img,
.gallery-grid a:focus-visible img {
    transform: scale(1.04);
}

/* video tile: play-button badge over the thumbnail */
.gallery-video {
    position: relative;
}

.gallery-video::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55) no-repeat center / 22px url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>');
    pointer-events: none;
}

.gallery-missing {
    color: #b00;
    font-style: italic;
}

/* GLightbox slide counter (added by main.js) */
.glightbox-container .gcounter {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000000;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.4;
    pointer-events: none;
}

/* "Watch on YouTube" link added to video slides (see main.js) */
.glightbox-container .gslide-video {
    position: relative;
}

.glightbox-container .gyt-link {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000000;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.4;
    text-decoration: none;
}

.glightbox-container .gyt-link:hover {
    background: rgba(0, 0, 0, 0.85);
    text-decoration: underline;
}

/* "Download" link on slides with data-download (see main.js) */
.glightbox-container .gdownload {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000000;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.4;
    text-decoration: none;
}

.glightbox-container .gdownload:hover,
.glightbox-container .gdownload:focus-visible {
    background: rgba(0, 0, 0, 0.85);
    text-decoration: underline;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Flexbox Layout */
.flex {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.flex > * {
    flex: 1 1 250px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card h3 {
    margin-bottom: 0.5rem;
}

/* Spaced-out chant headings ("BRRRIDGE!"): spacing in CSS, not in the
   text, so screen readers read a word instead of single letters. */
.chant {
    letter-spacing: 0.4em;
}

.card p {
    margin-bottom: 0;
}

.card p + p,
.card p + .img-link {
    margin-top: 1rem;
}

/* <a class="glightbox img-link"> wrapped around an image, so the
   lightbox opens a full-size file and is reachable by keyboard. */
.img-link {
    display: block;
}

/* ---- Homepage (index.njk) ---- */
.tagline {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.lead {
    max-width: 70ch;
    margin-bottom: 2rem;
}

/* Photo + stats side by side; stacks on narrow screens */
.home-hero {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

.home-photo img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* <dt> label sits under its <dd> figure */
.stat-figures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
    margin: 0;
}

.stat-figures > div {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;  /* top-align figures when a label wraps */
}

.stat-figures .stat-wide {
    grid-column: 1 / -1;
}

.stat-figures dd {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stat-figures dt {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-more {
    margin-top: 1.25rem;
}

.stat-more summary {
    cursor: pointer;
    color: var(--link);
    margin-bottom: 0.5rem;
}

.stat-more h3 {
    font-size: 1rem;
    margin: 1rem 0 0.25rem;
}

/* "Find a trip": GET form into /tb?search= */
.trip-find {
    max-width: 40rem;
    margin-bottom: 2rem;
}

.trip-find label {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.trip-find-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.trip-find input {
    flex: 1 1 12rem;
    min-width: 0;
    padding: 0.7rem 1rem;
    font: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--text-secondary);  /* 3:1+ boundary in both themes */
    border-radius: 8px;
}

.trip-find input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

/* dark --text-secondary is near-white, so a placeholder would read as typed text */
[data-theme="dark"] .trip-find input::placeholder {
    color: #a3a3a3;  /* 5.5:1 on #2d2d2d */
}

.trip-find input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.book-cover {
    width: 160px;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Entry tiles: whole card is the link; TB tile gets double width */
.home-tiles {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.tile {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--accent);
}

.tile:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.tile-main h2 {
    font-size: 1.9rem;
}

.tile-cta {
    margin-top: auto;
    padding-top: 1rem;
    color: var(--link);
    font-weight: 600;
}

@media (max-width: 1024px) {
    .home-hero,
    .home-tiles {
        grid-template-columns: 1fr;
    }

    /* Once the hero stacks, lift "Find a trip" above the photo and stats
       so it shows on the first screen (DOM order stays desktop order) */
    #home {
        display: flex;
        flex-direction: column;
    }

    #home > .home-hero {
        order: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile { transition: none; }
    .tile:hover { transform: none; }
}

/* Lists */
.styled-list {
    list-style: none;
    padding-left: 0;
}

.styled-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.styled-list li::before {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    color: var(--accent);
}

.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.list-unstyled li {
    padding: 0.5rem 0;
}

.list-unstyled-compact {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.list-unstyled-compact li {
    padding: 0;
    margin: 0;
}

/* Share Button */
.share-container {
    position: relative;
    /*display: inline-block;*/
    margin: 0 0 1rem 1rem;
    float: right;
}

/* Secondary action: outlined and small so it doesn't outshout the content. */
.share-button {
    font: inherit;
    font-size: 0.875rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s, border-color 0.2s;
}

.share-button:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.share-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.share-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 100;
}

.share-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.share-option:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.share-option:first-child {
    border-radius: 8px 8px 0 0;
}

.share-option:hover {
    background: var(--bg-secondary);
}

.share-option i {
    width: 20px;
    text-align: center;
}

.share-option[data-share="facebook"]:hover i {
    color: #1877f2;
}

.share-option[data-share="twitter"]:hover i {
    color: #1da1f2;
}

.share-option[data-share="linkedin"]:hover i {
    color: #0077b5;
}

.share-option[data-share="email"]:hover i {
    color: #ea4335;
}

.share-option[data-share="copy"]:hover i {
    color: var(--accent);
}

/* Clear float for content below */
.share-container + section {
    clear: both;
}

/* Responsive Iframe Container */
.responsive-iframe {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.responsive-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Collapsible Sections */
.collapsible {
    margin-bottom: 1rem;
    border:0;
}

.collapsible-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    transition: background 0.3s;
    color: var(--text-primary);
}

.collapsible-header:hover {
    background: var(--bg-secondary);
}

.collapsible-header::after {
    content: "+";
    font-size: 1.5rem;
    color: var(--accent);
    transition: transform 0.3s;
}

.collapsible-header.active::after {
    transform: rotate(45deg);
}

/* Side-menu "Filters" toggle: slimmer than the in-page collapsibles,
   inset to line up with the menu links' text (24px) and centred */
.side-menu .collapsible {
    margin-block: 0.25rem;
}

.side-menu .collapsible-header {
    padding-block: 0.35rem;
    width: calc(100% - 3rem);
    margin-inline: auto;
    justify-content: center;
    gap: 0.5rem;
}

.side-menu .collapsible-header::after {
    line-height: 1;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--card-bg);
    /*border: 1px solid var(--border);*/
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.collapsible-content-inner {
    padding: 1rem;
}

/* Tabs */
.tabs {
    margin-bottom: 2rem;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.3s, border-color 0.3s;
}

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

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.tab-content.active {
    display: block;
}

/* Buttons */
.btn {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 2px 4px var(--shadow);
    font-family: inherit;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    gap: 0.35rem;
}

.btn-small i {
    font-size: 0.75rem;
}

.btn-xs {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    gap: 0.25rem;
}

.btn-xs i {
    font-size: 0.65rem;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--card-bg);
    border-color: var(--accent);
}

/* Footer */
footer {
    background: var(--header-bg);
    color: var(--bg-primary);
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
    margin-left: 300px;
    transition: margin-left 0.3s ease;
}

footer.menu-closed {
    margin-left: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--bg-primary);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--bg-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .side-menu {
        left: -300px;
    }

    .side-menu.active {
        left: 0;
    }

    .side-menu.closed {
        left: -300px;
    }

    main {
        margin-left: auto;
        margin-right: auto;
        max-width: 1200px;
    }

    main.menu-closed {
        margin-left: auto;
        max-width: 1200px;
    }

    footer {
        margin-left: 0;
    }

    footer.menu-closed {
        margin-left: 0;
    }

    header .logo {
        display: block;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    main {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .tab-buttons {
        flex-wrap: wrap;
    }

    footer {
        padding: 2rem 1rem 1rem;
    }

    #map {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .side-menu {
        width: 80%;
        left: -80%;
    }

    .side-menu.active {
        left: 0;
    }

    .side-menu.closed {
        left: -80%;
    }
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(calc(-100% - 4px)); /* own height + margin, so no sub-pixel sliver shows */
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 1100; /* above the fixed header (1000) and side menu (1001) */
}

.skip-link:focus {
    transform: none;
}

/* Print Styles */
@media print {
    /* Hide interactive elements */
    .menu-toggle,
    .menu-close,
    .side-menu,
    .overlay,
    .share-container,
    .share-button,
    .share-dropdown,
    .theme-btn,
    .trip-find,
    .leaflet-control-zoom-out,
    .leaflet-control-zoom-in,
    .leaflet-bar {
        display: none !important;
    }

    /* Keep header but simplify it */
    header {
        position: static;
        background: white;
        color: black;
        border-bottom: 1px solid black;
        box-shadow: none;
    }

    header .logo {
        color: black;
    }

    /* Page-filling flex root — body height gives all children a resolved size */
    body {
        display: flex;
        flex-direction: column;
        height: 10in; /* letter 11in − 0.5in top − 0.5in bottom margin */
        background: white;
        color: black;
        overflow: hidden;
    }

    header {
        flex: 0 0 auto;
    }

    main {
        flex: 1;
        min-height: 0;
        margin: 0 !important;
        max-width: 100%;
        padding: 0 !important;
    }

    main.menu-closed {
        margin-left: 0;
    }

    footer {
        flex: 0 0 auto;
        margin-left: 0 !important;
        background: white;
        color: black;
        border-top: none;
    }

    /* Add page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    .card {
        page-break-inside: avoid;
    }

    .collapsible {
        page-break-inside: avoid;
    }

    .tabs {
        page-break-inside: avoid;
    }

    /* Simplify cards for print */
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        margin-bottom: 1rem;
    }

    /* Ensure images fit on page */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Optimize text for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    h1 {
        font-size: 24pt;
    }

    h2 {
        font-size: 18pt;
    }

    h3 {
        font-size: 14pt;
    }

    /* Tell the browser to print the plaque background image */
    .plaque {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: letter portrait;
        margin: 0.5in;
    }

    /* Header - keep compact, logo right-aligned */
    header {
        position: static;
        background: white;
        color: black;
        border-bottom: 2px solid black;
        box-shadow: none;
        padding: 0 1rem;
        margin-bottom: 0.5rem;
        justify-content: flex-end;
    }

    header .logo {
        color: black;
        font-size: 1.2rem;
    }

    /* Title section */
    section#home h1 {
        font-size: 16pt;
        margin-bottom: 0.25rem;
    }

    section#home > p {
        font-size: 10pt;
        margin-bottom: 0.25rem;
    }

    /* ---- Page-filling flex layout ---- */

    main {
        display: flex;
        flex-direction: column;
        min-height: calc(10in - 1in); /* letter minus 0.5in top + bottom margins */
        margin: 0 !important;
        max-width: 100%;
        padding: 0 !important;
    }

    section#home {
        flex: 0 0 auto;
    }

    section#layouts {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        gap: 0.4rem;
    }

    /* Kill per-row bottom margin — flex gap controls spacing */
    section#layouts > .flex {
        margin-bottom: 0;
    }

    /* Plaque row: always first, takes natural content height */
    section#layouts > .flex:first-child {
        flex: 0 0 auto;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    /* Media row: fixed slice only when the map row also follows;
       when it's the last row (no map) the rule below gives it flex: 1 */
    section#layouts > .media-row:not(:last-child) {
        flex: 0 0 34%;
        min-height: 0;
    }

    /* Rows take their natural (bounded) height — nothing greedily fills — so
       plaque + photos + map land on one sheet. */
    section#layouts > .flex:last-child {
        flex: 0 0 auto;
        min-height: 0;
    }

    /* media row with no group/swag shots (extras/video only): don't print it */
    .print-hide {
        display: none !important;
    }

    /* ---- Plaque card ---- */

    .plaque {
        height: auto !important;
    }

    .plaque ul {
        font-size: 9pt;
        line-height: 1.3;
    }

    .plaque li {
        margin-bottom: 0.1rem;
    }

    /* ---- QR code card ---- */

    .card.printOnly {
        padding-top: 1.2rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .card.printOnly p {
        font-size: 8pt;
        margin: 0;
        text-align: center;
    }

    .photo-qrcode {
        width: 80px;
        height: 80px;
    }

    /* ---- Media row: group/swag photos, fixed band, whole photo shown ---- */

    /* natural height (the photo band below), not a page fraction */
    section#layouts > .media-row:not(:last-child),
    section#layouts > .media-row:last-child {
        flex: 0 0 auto;
    }

    section#layouts > .media-row {
        gap: 0 !important;
        align-items: stretch;
    }

    .media-row .gallery-card {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0.2rem;
        margin-bottom: 0;
    }

    .media-row .gallery-card h4 {
        display: none;
    }

    /* print shows the named group/swag shots only — no extras, no video */
    .media-row .gallery-grid > a:not(.gallery-named) {
        display: none !important;
    }

    /* a fixed-height band; each photo is that tall, natural width, whole photo */
    .media-row .gallery-grid {
        display: flex;
        gap: 0.5rem;
        height: 2.5in;
        justify-content: center;
        align-items: center;
    }

    .media-row .gallery-grid > a {
        position: static;
        aspect-ratio: auto;
        flex: 0 1 auto;
        min-width: 0;
        max-width: 48%;
        height: 100%;
        overflow: hidden;
        border-radius: 0;
    }

    .media-row .gallery-grid a > picture {
        position: static;
        display: block;
        height: 100%;
    }

    .media-row .gallery-grid a > img,
    .media-row .gallery-grid a > picture > img {
        position: static;
        width: auto;
        max-width: 100%;
        height: 100%;
        object-fit: contain;     /* whole photo, uncropped */
        transform: none !important;
    }

    /* Defeat specificity: screenOnly must always be hidden in print */
    .screenOnly {
        display: none !important;
    }

    /* ---- Map card: bounded height, route capture centred ---- */

    section#layouts > .map-row .card {
        display: block;
        padding: 0.2rem;
    }

    .map-row .responsive-iframe {
        height: auto !important;
        padding-bottom: 0 !important;
    }

    #map {
        display: none !important;
    }

    #map-capture {
        display: block;
        width: 100%;
        max-height: 3.7in;
        object-fit: contain;
    }

    /* ---- General card adjustments ---- */

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    /* ---- Footer ---- */

    footer {
        margin-left: 0 !important;
        margin-top: 0;
        padding: 0.25rem;
        background: white;
        color: black;
        border-top: none;
    }

    .footer-bottom {
        padding-top: 0.1rem;
        font-size: 8pt;
    }
    .btn {
        display: none !important;
    }

}

/* Lost & Found swag pages (src/_includes/_lostAndFound.njk) */
.lf-switch {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
}

.lf-switch a {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.lf-switch a:hover {
    text-decoration: underline;
}

.lf-switch a[aria-current="page"] {
    background: var(--accent);
    color: #fff;
}

[data-theme="dark"] .lf-switch a[aria-current="page"] {
    color: var(--bg-primary);
}

.lf-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem 0.75rem;
}

.lf-tile > a.glightbox {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-secondary);
}

.lf-tile > a.glightbox > picture {
    position: absolute;
    inset: 0;
    display: block;
}

.lf-tile > a.glightbox img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.lf-tile > a.glightbox:hover img,
.lf-tile > a.glightbox:focus-visible img {
    transform: scale(1.04);
}

.lf-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .lf-tile > a.glightbox img { transition: none; }
}

/* Say cheese: one compact card per trip, several per row
   (src/pages/sayCheese.njk). At most 3 tiles show; the 3rd carries "+N"
   (--more) when the trip has more — the rest stay in the lightbox carousel. */
.cheese-grid {
    list-style: none;
    margin: 1.5rem 0 2rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1rem;
}

.cheese-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cheese-title {
    font-size: 1rem;
    line-height: 1.3;
    margin: 0;
}

.cheese-tiles.gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.cheese-tiles > a:nth-child(n+4) {
    display: none;
}

.cheese-tiles[style*="--more"] > a:nth-child(3)::before {
    content: var(--more);
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.card .cheese-count {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
