/* ==========================================================================
   Costa Tropical Senderismo — base.css
   Mobile-first design system. Every color comes from CSS custom properties
   set by the admin panel (see layouts/public.php). Edit styles here only
   when you want to change the look of a component, not its colors.
   ========================================================================== */

:root {
    --color-dark: #012D35;
    --color-accent: #3F8E9C;
    --color-action: #588826;
    --color-link: #588826;
    --color-bg: #F4F7F6;
    --color-surface: #FFFFFF;
    --color-surface-alt: #E9F0EE;
    --color-text: #1C2B30;
    --color-text-muted: #5B6B70;
    --color-heading: #012D35;
    --color-border: #D7E2E0;
    --color-footer-bg: #012D35;
    --color-footer-top-bg: #3F8E9C;
    --color-footer-text: #DCE8E9;
    --color-easy: #4CAF50;
    --color-moderate: #F5A623;
    --color-hard: #E53935;
    --color-notice-bg: #FFF6DE;
    --color-notice-text: #7A5B00;
    --color-notice-border: #F0D78C;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 6px 24px rgba(1, 45, 53, 0.08);
    --shadow-lg: 0 14px 40px rgba(1, 45, 53, 0.16);
    --container: 1120px;
    --header-h: 100px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
    max-width: 100%;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { color: var(--color-heading); line-height: 1.25; margin: 0 0 .6em; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { vertical-align: middle; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    background: var(--color-dark); color: #fff; padding: 10px 16px; border-radius: 8px;
    transition: top .2s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
.container--narrow { max-width: 820px; }

.section { padding: 40px 0; }
.section--alt { background: var(--color-surface-alt); }
.section--sm { padding: 24px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { font-size: 1.4rem; margin: 0; }
.section-title--sm { font-size: 1.1rem; margin: 18px 0 10px; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.link-more svg { width: 18px; height: 18px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--color-surface);
}
.site-header::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    height: 2px;
    background: var(--color-footer-bg);
}
.site-header::before {
    content: '';
    position: absolute; inset: 0; z-index: 0;
    background-image: var(--header-bg-image, none);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: var(--header-bg-opacity, 1);
    pointer-events: none;
}
.site-header > .container { position: relative; z-index: 1; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--logo-size, 100px); padding-block: 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { height: var(--logo-size, 100px); width: auto; border-radius: 10px; }

.site-nav { display: none; }
.nav-list { display: flex; align-items: center; gap: 4px; }
.nav-account { display: none; }
.nav-link { display: block; padding: 6px 12px; border-radius: 999px; color: var(--color-text); font-weight: 600; font-size: .95rem; }
.nav-link:hover { background: var(--color-surface-alt); text-decoration: none; }
.header-user { display: inline-flex; align-items: center; gap: 7px; }
.header-user svg { width: 18px; height: 18px; flex: none; }
.nav-admin { display: inline-flex; align-items: center; justify-content: center; padding: 10px; }
.nav-admin svg { width: 18px; height: 18px; flex: none; }
.nav-item.is-active .nav-link { background: var(--color-dark); color: #fff; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-switcher { display: flex; border: 1px solid var(--color-border); border-radius: 999px; overflow: hidden; }
.lang-link { padding: 6px 10px; font-size: .8rem; font-weight: 700; color: var(--color-text-muted); background: var(--color-surface-alt); }
.lang-link:hover { text-decoration: none; background: var(--color-surface-alt); }
.lang-link.is-active { background: var(--color-action); color: #fff; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--color-border); background: none; border-radius: 10px; }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .icon-close { display: none; }
body.nav-open { overflow: hidden; }
body.nav-open .nav-toggle .icon-close { display: inline; }
body.nav-open .nav-toggle .icon-menu { display: none; }

@media (min-width: 900px) {
    .site-nav { display: block; }
    .nav-toggle { display: none; }
}
@media (max-width: 899px) {
    .header-account { display: none; }
    .header-inner { min-height: var(--logo-size-mobile, calc(var(--logo-size, 100px) * .5)); }
    .brand-logo { height: var(--logo-size-mobile, calc(var(--logo-size, 100px) * .5)); }
    body.nav-open .site-nav {
        display: block;
        position: fixed; inset: var(--header-h) 0 0 0;
        background: var(--color-surface);
        overflow-y: auto; padding: 12px;
        border-top: 1px solid var(--color-border);
    }
    body.nav-open .nav-list { flex-direction: column; align-items: stretch; gap: 6px; }
    body.nav-open .nav-link { padding: 14px; border-radius: 12px; font-size: 1.05rem; }
    body.nav-open .nav-account {
        display: flex; flex-direction: column; gap: 6px;
        margin-top: 12px; padding-top: 12px;
        border-top: 1px solid var(--color-border);
    }
    body.nav-open .nav-account-link { font-weight: 700; }
    body.nav-open .nav-account-link[href$="/logout"] { color: #c62828; }
    body.nav-open .nav-admin { justify-content: flex-start; }
}

/* ---------- Notices ---------- */
.notices { background: var(--color-notice-bg); border-bottom: 1px solid var(--color-border); }
html.js [data-notices] { display: none; }
.notice {
    display: flex; align-items: center;
    padding: 10px 0; color: var(--color-notice-text); font-size: .9rem;
}
.notice + .notice { border-top: 1px solid var(--color-notice-border); }
.notice--info { background: #E8F2FB; color: #1D5FA8; }
.notice--warning { background: var(--color-notice-bg); }
.notice--alert, .notice--important { background: #FDECEA; color: #B3261E; }
.notice--info + .notice { border-top-color: #BBD4EA; }
.notice--alert + .notice, .notice--important + .notice { border-top-color: #F3C7C2; }
.notice-inner {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px;
    width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px;
}
.notice-icon svg { width: 20px; height: 20px; flex: none; }
.notice-message { flex: 1; }
.notice-message a { color: inherit; text-decoration: underline; font-weight: 600; }
.notice-message a:hover { opacity: .8; }
.notice-dismiss {
    background: none; border: none; color: inherit; opacity: .6;
    display: inline-flex; padding: 4px;
}
.notice-dismiss:hover { opacity: 1; }
.notice-dismiss svg { width: 18px; height: 18px; }
.notice--diner { margin: 20px 0; border: 1px solid var(--color-notice-border); border-radius: var(--radius-sm); padding: 12px 16px; gap: 12px; background: #fff; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
    border: 2px solid transparent; transition: filter .15s, transform .1s;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--color-action); color: #fff; }
.btn--ghost { background: transparent; border-color: rgba(255,255,255,.7); color: #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.12); }
.btn--outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--dark { background: var(--color-dark); color: #fff; }
.btn svg { width: 18px; height: 18px; }

.btn--wikiloc {
    margin-top: 20px; background: #fff; border-color: var(--color-border); color: var(--color-dark);
}
.btn--wikiloc img { border-radius: 4px; }

/* ---------- Hero ---------- */
.hero { position: relative; display: flex; align-items: center; min-height: 420px; padding: 64px 0; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(1,45,53,.55), rgba(1,45,53,.78)); }
.hero-content { position: relative; color: #fff; max-width: 640px; }
.hero-title { color: #fff; font-size: 2rem; margin-bottom: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.page-hero {
    position: relative; background: var(--color-dark); color: #fff;
    display: flex; align-items: center;
    min-height: var(--hero-min, 100px); max-height: var(--hero-max, 100px);
    overflow: hidden;
}
.page-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page-hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(1,45,53,.55), rgba(1,45,53,.78)); }
.page-hero-content { position: relative; }
.page-hero-title { color: #fff; font-size: 1.7rem; margin-bottom: 8px; }
.page-hero-subtitle { color: rgba(255,255,255,.85); max-width: 640px; margin: 0; }
.page-hero-subtitle.prose p:last-child { margin-bottom: 0; }
.page-hero .btn { margin-top: 18px; }

/* ---------- Hike cards ---------- */
.hike-grid { display: grid; gap: 20px; }
@media (min-width: 560px) { .hike-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .hike-grid { grid-template-columns: repeat(3, 1fr); } }

.hike-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s;
}
.hike-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.hike-card-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--color-surface-alt); }
.hike-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.hike-card:hover .hike-card-media img { transform: scale(1.05); }
.hike-card-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.hike-card-placeholder svg { width: 64px; height: 64px; color: var(--color-accent); opacity: .5; }
.hike-card-date {
    position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; align-items: center;
    background: var(--color-surface); border-radius: 12px; padding: 6px 10px; line-height: 1.1;
    box-shadow: var(--shadow);
}
.hike-card-date-day { font-size: 1.15rem; font-weight: 800; color: var(--color-heading); }
.hike-card-date-month { font-size: .72rem; text-transform: uppercase; color: var(--color-text-muted); }
.hike-card-date-year { font-size: .72rem; color: var(--color-text-muted); border-top: 1px solid var(--color-border); margin-top: 3px; padding-top: 3px; }
.hike-card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.hike-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hike-card-title { font-size: 1.08rem; margin: 0; }
.hike-card-title a { color: var(--color-heading); }
.hike-card-title a:hover { color: var(--color-link); text-decoration: none; }
.hike-card-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: auto; }
.hike-card-stats li { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--color-text-muted); }
.hike-card-stats svg { width: 16px; height: 16px; color: var(--color-accent); }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge--difficulty { background: color-mix(in srgb, var(--band, var(--color-accent)) 18%, white); color: var(--band, var(--color-text)); border: 1px solid color-mix(in srgb, var(--band, var(--color-accent)) 40%, white); }
.badge--route { background: #eef0f2; color: #4b5563; border: 1px solid #dfe3e6; }
.badge--soon { background: color-mix(in srgb, var(--color-accent) 14%, white); color: var(--color-accent); border: 1px solid color-mix(in srgb, var(--color-accent) 35%, white); }

.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text); font-weight: 600; font-size: .9rem;
}
.chip:hover { border-color: var(--color-accent); }
.chip.is-active { background: var(--color-dark); color: #fff; border-color: var(--color-dark); }
.chip-count { font-size: .75rem; background: rgba(0,0,0,.08); border-radius: 999px; padding: 1px 8px; }
.chip.is-active .chip-count { background: rgba(255,255,255,.22); }

/* ---------- Filter bar ---------- */
.filter-bar { margin-bottom: 24px; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tab {
    padding: 9px 20px; border-radius: 999px; border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); font-weight: 600; font-size: .92rem;
}
.filter-tab:hover { text-decoration: none; border-color: var(--color-accent); }
.filter-tab.is-active { background: var(--color-action); border-color: var(--color-action); color: #fff; }

/* Collapsible past hikes */
.past-hikes { margin-top: 28px; }
.past-hikes-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    list-style: none; cursor: pointer;
    padding: 16px 20px; border-radius: var(--radius);
    background: var(--color-surface); border: 1px solid var(--color-border);
    box-shadow: var(--shadow); font-weight: 700; font-size: 1.05rem; color: var(--color-heading);
}
.past-hikes-summary::-webkit-details-marker { display: none; }
.past-hikes-summary:hover { border-color: var(--color-accent); }
.past-hikes-chevron { display: inline-flex; color: var(--color-accent); transition: transform .2s; }
.past-hikes-chevron svg { width: 20px; height: 20px; }
.past-hikes[open] .past-hikes-chevron { transform: rotate(180deg); }
.past-hikes-grid { margin-top: 20px; }

/* ---------- Infinite scroll loader ---------- */
.past-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 24px 0;
}
.past-load-more-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-accent, #588826);
    border-top-color: transparent;
    border-radius: 50%;
    animation: past-load-more-spin .8s linear infinite;
    opacity: 0;
    transition: opacity .2s;
}
.past-load-more.is-loading .past-load-more-spinner { opacity: 1; }
@keyframes past-load-more-spin { to { transform: rotate(360deg); } }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--color-text-muted); }
.empty-icon { width: 48px; height: 48px; color: var(--color-accent); opacity: .6; }
.empty-state p { margin-top: 12px; }

/* ---------- Hike detail ---------- */
.hike-hero { position: relative; background: var(--color-dark); color: #fff; display: flex; align-items: center; min-height: var(--hike-hero-h, 135px); padding: 16px 0; overflow: hidden; }
.hike-hero-content { position: relative; }
.hike-hero-title { color: #fff; font-size: 1.8rem; margin-bottom: 14px; }
.hike-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.hike-hero-date { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; }
.hike-hero-date svg { width: 18px; height: 18px; }
.hike-hero-chips { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.hike-hero-chips li { display: inline-flex; align-items: center; gap: 7px; font-size: .95rem; font-weight: 600; }
.hike-hero-chips svg { width: 18px; height: 18px; }

.breadcrumb { padding-top: 16px; font-size: .9rem; }
.breadcrumb a { display: inline-flex; align-items: center; gap: 6px; }

.hike-layout { display: grid; gap: 32px; }
@media (min-width: 920px) { .hike-layout { grid-template-columns: 1fr 320px; align-items: start; } }
.hike-main { min-width: 0; }

.hike-featured {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* On mobile, show the hike facts between the description and the route features. */
@media (max-width: 919px) {
    .hike-layout { display: flex; flex-direction: column; align-items: stretch; }
    .hike-main { display: contents; }
    .hike-main > .prose { order: 1; }
    .hike-side { order: 2; }
    .hike-route-features { order: 3; }
    .hike-main > .signup-section { order: 4; }
    .hike-gallery { order: 5; }
    .hike-facts { position: static; }
}

/* Facts card */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.account-warning { border-color: color-mix(in srgb, #b45309 35%, var(--color-border)); background: color-mix(in srgb, #fef3c7 60%, var(--color-surface)); }
.account-warning p { margin: .3rem 0; font-size: .9rem; }
.account-warning .section-title { color: #92400e; }
.hike-facts { padding: 18px 20px; }
.fact-list { margin: 0; }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--color-border); }
.fact:last-child { border-bottom: none; }
.fact dt { color: var(--color-text-muted); font-size: .9rem; }
.fact dd { margin: 0; font-weight: 700; text-align: right; }
.fact-difficulty { margin-top: 14px; }

/* Weather widget */
.hike-weather { margin-top: 16px; padding: 18px 14px; }
.weather-slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.weather-slot { flex: 0 0 calc((100% - 16px) / 3); min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--color-surface-alt, #eef2f1); border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 10px 4px; text-align: center; }
.weather-time { font-size: .95rem; font-weight: 700; color: var(--color-heading, #23363b); }
.weather-icon { font-size: 1.5rem; line-height: 1.2; }
.weather-temp { font-size: .95rem; font-weight: 700; }
.weather-rain { display: inline-flex; align-items: center; gap: 2px; font-size: .72rem; color: var(--color-text-muted); }
.weather-rain svg { width: 13px; height: 13px; flex: none; }
.weather-wind { display: inline-flex; align-items: center; gap: 2px; font-size: .72rem; color: var(--color-text-muted); }
.weather-wind svg { width: 14px; height: 14px; flex: none; }
.weather-wind-speed { font-size: .72rem; font-weight: 600; }
.weather-wind-desc { font-size: .66rem; color: var(--color-text-muted); line-height: 1.15; text-align: center; word-break: break-word; }

/* Difficulty bar */
.difficulty-track {
    position: relative; height: 12px; border-radius: 999px;
    background: linear-gradient(90deg, var(--color-easy) 0%, var(--color-moderate) 50%, var(--color-hard) 100%);
    opacity: .9;
}
.difficulty-marker {
    position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 3px solid var(--color-dark); transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,.3); pointer-events: none;
}
.difficulty-labels { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: .78rem; color: var(--color-text-muted); }
.difficulty-value { text-align: center; color: var(--color-text); }
.difficulty-value strong { font-size: 1rem; }

/* Property badges */
.property-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.property-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px;
    font-size: .88rem; font-weight: 600;
}
.property-badge svg { width: 18px; height: 18px; color: var(--color-accent); }

/* GPX visuals */
.gpx-map, .gpx-profile { margin: 0 0 8px; }
.route-map, .elevation-profile { width: 100%; height: auto; border-radius: var(--radius); overflow: hidden; }

.route-map-wrap {
    position: relative;
    z-index: 0;
    isolation: isolate;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 8px;
}

.route-map-leaflet {
    width: 100%;
    height: 380px;
    background: var(--color-surface-alt);
}

@media (max-width: 640px) {
    .route-map-leaflet { height: 280px; }
}

/* Gallery + lightbox */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery-item { position: relative; display: block; padding: 0; border: none; background: none; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item--wide { grid-column: span 2; grid-row: span 2; }

.lightbox {
    position: fixed; inset: 0; z-index: 200; background: rgba(1, 20, 25, .94);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lightbox[hidden] { display: none; }
.lightbox-figure { margin: 0; max-width: 900px; width: 100%; text-align: center; }
.lightbox-figure img { max-height: 78vh; width: auto; max-width: 100%; margin-inline: auto; border-radius: 10px; }
.lightbox-figure figcaption { color: #fff; margin-top: 12px; font-size: .95rem; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute; background: rgba(255,255,255,.12); border: none; color: #fff;
    border-radius: 50%; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
}
.lightbox-close svg, .lightbox-prev svg, .lightbox-next svg { width: 24px; height: 24px; }
.lightbox-close { top: 18px; right: 18px; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-prev:hover, .lightbox-next:hover, .lightbox-close:hover { background: rgba(255,255,255,.25); }

/* ---------- FAQ ---------- */
.faq-search { margin-bottom: 22px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px; padding: 4px 8px 4px 18px; box-shadow: var(--shadow); }
.search-box svg { width: 20px; height: 20px; color: var(--color-text-muted); flex: none; }
.search-box input { flex: 1; border: none; background: none; padding: 12px 0; outline: none; }
.faq-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.faq-group { margin-bottom: 32px; }
.accordion { display: grid; gap: 10px; }
.accordion-item { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.accordion-item[open] { border-color: var(--color-accent); }
.accordion-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 18px; cursor: pointer; font-weight: 700; list-style: none; color: var(--color-heading);
}
.accordion-head::-webkit-details-marker { display: none; }
.accordion-head:hover { background: var(--color-surface-alt); }
.accordion-icon { width: 20px; height: 20px; flex: none; transition: transform .2s; color: var(--color-accent); }
.accordion-item[open] .accordion-icon { transform: rotate(180deg); }
.accordion-body { padding: 0 18px 18px; }
.accordion-body.prose > :last-child { margin-bottom: 0; }

/* ---------- Prose (WYSIWYG content) ---------- */
.prose { line-height: 1.7; }
.prose h2 { font-size: 1.4rem; margin-top: 1.4em; }
.prose h3 { font-size: 1.15rem; margin-top: 1.2em; }
.prose h4 { font-size: 1.05rem; }
.prose p { margin: 0 0 1em; }
.prose ul { list-style: disc; padding-left: 1.4em; margin: 0 0 1em; }
.prose ol { list-style: decimal; padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose img { border-radius: var(--radius); margin: 1em 0; }
.prose a { text-decoration: underline; }
.prose blockquote { margin: 1em 0; padding: 12px 18px; border-left: 4px solid var(--color-accent); background: var(--color-surface-alt); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose figure { margin: 1em 0; }
.prose figcaption { font-size: .85rem; color: var(--color-text-muted); text-align: center; }

/* ---------- Footer ---------- */
.site-footer { color: var(--color-footer-text); margin-top: 40px; }
.footer-top { background: var(--color-footer-top-bg); color: var(--color-footer-text); }
.footer-grid { display: grid; gap: 32px; padding: 48px 16px 40px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr; } }
.footer-about { min-width: 0; }
.footer-about p { opacity: .85; font-size: .92rem; margin: 0; }
.footer-about .footer-about-text { opacity: .85; font-size: .92rem; }
.footer-about .footer-about-text p { margin: 0 0 .4rem; }
.footer-about .footer-about-text p:last-child { margin: 0; }
.footer-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.footer-menu-btn {
    display: inline-flex; align-items: center;
    padding: 8px 16px; border-radius: 999px;
    background: var(--color-footer-text); color: var(--color-footer-bg);
    font-weight: 700; font-size: .88rem;
}
.footer-menu-btn:hover { background: #fff; color: var(--color-footer-bg); text-decoration: none; }
.footer-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.footer-logo-link { display: inline-flex; }
.footer-logo-link:hover { text-decoration: none; opacity: .94; }
.footer-logo { height: var(--logo-size, 100px); width: auto; border-radius: 8px; }
.social-links { display: flex; gap: 10px; margin-top: 18px; }
@media (max-width: 719px) {
    .footer-side { align-items: flex-start; }
}
.social-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.18); color: var(--color-footer-text);
}
.social-link:hover { background: var(--color-accent); color: #fff; text-decoration: none; }
.social-link svg { width: 20px; height: 20px; }
.footer-bottom { background: var(--color-footer-bg); color: var(--color-footer-text); border-top: 1px solid rgba(255,255,255,.12); padding: 16px 0; }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .85rem; opacity: .8; }

/* ---------- Offline ---------- */
.offline-page { min-height: 55vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.offline-card { text-align: center; max-width: 480px; }
.offline-icon { width: 56px; height: 56px; color: var(--color-accent); }
.offline-card h1 { margin: 16px 0 8px; }
.offline-card p { color: var(--color-text-muted); margin-bottom: 20px; }

/* ---------- Auth pages ---------- */
.auth-page { min-height: 60vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 460px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }
.auth-card h1 { margin: 0 0 20px; font-size: 1.4rem; }
.auth-card .form-stack { gap: 14px; }
.auth-forgot { text-align: right; font-size: .88rem; }
.auth-forgot a { color: var(--color-accent); }
.auth-alt { margin-top: 18px; text-align: center; font-size: .9rem; color: var(--color-text-muted); }
.auth-alt a { font-weight: 700; color: var(--color-accent); }

.oauth-buttons { display: flex; flex-direction: column; gap: .6rem; margin-top: 18px; }
.oauth-divider { display: flex; align-items: center; gap: 12px; color: var(--color-text-muted); font-size: .82rem; margin: 0; }
.oauth-divider::before,
.oauth-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.oauth-btn svg { flex-shrink: 0; }
.oauth-btn--google { background: #fff; color: #4285F4; border-color: #dadce0; }
.oauth-btn--google:hover { background: #f8f9fa; }
.oauth-btn--facebook { background: #1877F2; color: #fff; border-color: #1877F2; }
.oauth-btn--facebook:hover { background: #0f6ad1; }

.oauth-list { display: flex; flex-direction: column; gap: .6rem; }
.oauth-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.oauth-row:last-child { border-bottom: none; }
.oauth-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.oauth-name svg { width: 20px; height: 20px; }
.oauth-linked { font-size: .82rem; color: var(--color-text-muted); }

/* ---------- Buttons ---------- */
.btn--block { width: 100%; }
.btn--danger { background: #E53935; color: #fff; border-color: #E53935; }
.btn--danger:hover { background: #C62828; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .92rem; }
.alert--error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert--success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert--warning { background: #fff8e1; color: #ef6c00; border: 1px solid #fff3c4; }
.alert--warning .btn--ghost { border-color: #f2c14e; color: #8a5a00; }
.alert--warning .btn--ghost:hover { background: rgba(239, 108, 0, .08); }
.alert--info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.alert--info a { color: inherit; text-decoration: underline; font-weight: 600; }
.alert--info a:hover { opacity: .8; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 1.1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.1rem; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.ice-block { margin-top: .4rem; padding-top: 1.1rem; border-top: 1px solid var(--color-border); }
.ice-row { display: grid; grid-template-columns: 1fr; gap: .8rem; padding: .9rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-alt); margin-bottom: .8rem; align-items: end; }
@media (min-width: 640px) {
    .ice-row { grid-template-columns: 1fr 1.4fr auto; align-items: end; }
}
.ice-row .link-danger { justify-self: start; padding-bottom: .55rem; }

/* ---------- Page split (2/3 + 1/3) ---------- */
.page-split { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 820px) { .page-split { grid-template-columns: 2fr 1fr; align-items: start; } }
.page-split-side { font-size: .92rem; }
.page-split-side .prose { line-height: 1.6; }
.page-split-image img { width: 100%; height: auto; border-radius: var(--radius); display: block; }

.field { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.field--full { grid-column: 1 / -1; }

.field-label { font-size: .85rem; font-weight: 700; color: var(--color-heading); letter-spacing: .01em; }
.field-help { font-size: .82rem; color: var(--color-text-muted); }

.input {
    width: 100%;
    padding: .68rem .9rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: .95rem;
    box-shadow: inset 0 1px 2px rgba(1, 45, 53, .04);
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--color-text-muted); opacity: .75; }
.input:hover { border-color: #a9bfc1; }
.input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 20%, transparent);
}
.input:disabled {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: .8;
}
select.input { padding-right: 2rem; cursor: pointer; }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; }
.input--sm { padding: .35rem .6rem; font-size: .85rem; border-radius: 8px; }

.password-toggle { position: relative; display: block; }
.password-toggle .input { padding-right: 2.9rem; }
.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .25rem;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 8px;
}
.password-toggle-btn:hover { color: var(--color-text); }
.password-toggle-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 25%, transparent); }
.password-toggle-btn svg { width: 18px; height: 18px; }
.password-toggle-btn [hidden] { display: none; }

.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; line-height: 1.45; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--color-action); }
.check a { text-decoration: underline; text-underline-offset: 2px; }
.check--inline { gap: .3rem; font-size: .82rem; }
.check-row { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; margin-top: .2rem; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: .2rem; }

/* Signup embedded on the hike page */
.signup-embed { margin-top: 20px; }
.signup-embed .signup-info { margin-bottom: 12px; }
.signup-embed .card { box-shadow: var(--shadow-lg); }

/* ---------- Account ---------- */
.account-layout { display: grid; gap: 28px; }
@media (min-width: 900px) { .account-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-width: 899px) {
    .account-layout { display: flex; flex-direction: column; }
    .account-col:first-child { order: 2; }
    .account-col:last-child { order: 1; }
}
.account-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
#account-profile-form, #account-password { scroll-margin-top: calc(var(--header-h) + 16px); }
.account-history { padding: 14px 20px; }
.account-history-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    list-style: none; cursor: pointer;
}
.account-history-summary::-webkit-details-marker { display: none; }
.account-history-summary .section-title--sm { margin: 0; }
.account-history[open] .past-hikes-chevron { transform: rotate(180deg); }
.account-history-body { padding: 4px 0 8px; }
.account-collapsible { padding: 14px 20px; }
.account-collapsible-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    list-style: none; cursor: pointer;
}
.account-collapsible-summary::-webkit-details-marker { display: none; }
.account-collapsible-summary .section-title--sm,
.account-collapsible-summary .danger-zone-title { margin: 0; }
.account-collapsible[open] .past-hikes-chevron { transform: rotate(180deg); }
.account-collapsible-body { padding: 12px 0 4px; }
.account-danger-zone { border-top: 2px solid #ffcdd2; padding-top: 16px; }
.account-danger-zone .muted { font-size: .85rem; margin-bottom: 8px; }
.danger-zone-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #c62828;
    margin: 0 0 8px;
}
.link-danger {
    background: none; border: none; padding: 0; cursor: pointer;
    color: #c62828; font-size: .9rem; font-weight: 600;
    text-decoration: underline; text-underline-offset: 2px;
}
.link-danger:hover { color: #E53935; }

.account-signups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.account-signup-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 14px; border: 1px solid var(--color-border);
    border-radius: var(--radius); background: var(--color-surface);
}
.account-signup-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.account-signup-title { font-weight: 600; font-size: .95rem; }
.account-signup-name { font-weight: 700; font-size: .9rem; color: var(--color-heading); }
.account-signup-date { font-size: .82rem; }
.signup-status {
    align-self: flex-start; font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}
.signup-status--ok { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.signup-status--warn { background: #fff8e1; color: #b26a00; border-color: #ffe082; }
.signup-status--muted { background: #fafafa; color: #888; border-color: #e0e0e0; }

/* ---------- Signup ---------- */
.hike-signup-title { font-size: 1.1rem; margin-bottom: 20px; color: var(--color-text-muted); }
.signup-info { margin-bottom: 20px; }
.signup-spots { font-size: 1rem; }
.signup-waitlist-info { margin: 0 0 16px; font-size: .95rem; color: var(--color-text-muted); line-height: 1.5; }
.signup-form-card { width: 100%; padding: 24px; }

/* ---------- Participants list on hike page ---------- */
.participants { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.participant-card {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 999px; font-size: .92rem; font-weight: 600;
}
.participant-card .participant-emoji { font-size: 1.1rem; }
.participant-card.is-you { border-color: var(--color-accent); background: rgba(63,142,156,.08); }

/* ---------- Spots badge on hike cards ---------- */
.hike-card-spots {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .85rem; font-weight: 700; padding: 3px 10px;
    border-radius: 999px; background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}
.hike-card-spots.is-full { background: #ffebee; color: #c62828; border-color: #ffcdd2; }
.hike-card-waitlist {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .85rem; font-weight: 700; padding: 3px 10px;
    border-radius: 999px; background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2;
}

/* ---------- Cancellation banner ---------- */
.cancel-banner {
    background: linear-gradient(135deg, #ffebee, #fff8e1);
    border: 2px solid #ef5350; border-radius: var(--radius);
    padding: 24px; margin: 20px 0; text-align: center;
}
.cancel-banner h2 { color: #c62828; margin: 0 0 6px; font-size: 1.2rem; }
.cancel-banner p { color: b51515; margin: 0; }

/* ---------- Delegations ---------- */
.btn--sm { padding: 5px 12px; font-size: .85rem; }
.inline { display: inline; }
.delegation-invite { max-width: 420px; }
.delegation-lists { display: grid; gap: 24px; margin-top: 24px; }
@media (min-width: 768px) { .delegation-lists { grid-template-columns: 1fr 1fr; } }
.delegation-sub { font-size: 1rem; margin: 0 0 10px; }
.delegation-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px; border: 1px solid var(--color-border);
    border-radius: var(--radius); margin-bottom: 8px;
}
.delegation-person { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.delegation-person strong { font-size: .95rem; }
.delegation-person .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.delegation-pending {
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: 2px 8px; border-radius: 999px; background: #fff8e1; color: #b26a00; border: 1px solid #ffe082;
}
.delegation-actions { display: flex; gap: 8px; }
