/*
 * Ruustrappers - site stylesheet.
 * Mobile first; breakpoints at 640px (tablet) and 960px (desktop).
 */

/* ---------------------------------------------------------------- tokens */

:root {
    --brand: #1f3fd1;
    --brand-strong: #1630a8;
    --brand-soft: #e9edff;
    --brand-ink: #ffffff;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --ink: #121826;
    --ink-2: #3d4556;
    --muted: #6b7385;
    --line: #e3e7ef;
    --line-strong: #cfd5e1;

    --success: #157a43;
    --success-soft: #e3f6eb;
    --danger: #c42b2b;
    --danger-soft: #fde8e8;
    --warning: #9a5b00;
    --warning-soft: #fff3dc;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --topbar-h: 60px;
    --tabbar-h: 64px;

    color-scheme: light;
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

.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;
}

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- layout */

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 720px; }
.container-tight { max-width: 460px; }

.site-main { flex: 1 0 auto; padding: 24px 0 40px; }
body.has-tabbar .site-main { padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }

@media (min-width: 960px) {
    .site-main { padding-top: 40px; padding-bottom: 64px; }
    body.has-tabbar .site-main { padding-bottom: 64px; }
}

/* ---------------------------------------------------------------- top bar */

.topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar .container { height: 100%; display: flex; align-items: center; gap: 16px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; box-shadow: var(--shadow); object-fit: contain; }
.brand-name { font-size: 1.05rem; text-transform: uppercase; }
.brand-name span { color: var(--brand); }

.mainnav { display: none; margin-left: auto; align-items: center; gap: 2px; }
.mainnav a {
    color: var(--ink-2); font-weight: 600; font-size: .95rem;
    padding: 8px 12px; border-radius: 999px;
}
.mainnav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.mainnav a.active { background: var(--brand-soft); color: var(--brand); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

@media (min-width: 960px) {
    .mainnav { display: flex; }
    .topbar-actions { margin-left: 8px; }
    .menu-toggle { display: none !important; }
}

/* ---------------------------------------------------------------- drawer (mobile menu) */

.drawer {
    position: fixed; inset: 0; z-index: 60;
    visibility: hidden; pointer-events: none;
}
.drawer.open { visibility: visible; pointer-events: auto; }
.drawer-backdrop {
    position: absolute; inset: 0; background: rgba(10, 14, 24, .45);
    opacity: 0; transition: opacity .2s ease;
}
.drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(320px, 86vw);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .25s ease;
    display: flex; flex-direction: column;
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
}
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px; }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a {
    display: flex; align-items: center; gap: 14px;
    padding: 12px; border-radius: var(--radius-sm);
    color: var(--ink); font-weight: 600;
}
.drawer-nav a i { width: 20px; text-align: center; color: var(--muted); }
.drawer-nav a:hover { background: var(--surface-2); text-decoration: none; }
.drawer-nav a.active { background: var(--brand-soft); color: var(--brand); }
.drawer-nav a.active i { color: var(--brand); }
.drawer-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.drawer-foot { margin-top: auto; padding: 16px 4px 0; display: flex; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
    .drawer-backdrop, .drawer-panel { transition: none; }
}

/* ---------------------------------------------------------------- bottom tab bar (members, mobile) */

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 560px; }
.tabbar a {
    height: var(--tabbar-h);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tabbar a i { font-size: 1.15rem; }
.tabbar a:hover { text-decoration: none; color: var(--ink); }
.tabbar a.active { color: var(--brand); }

@media (min-width: 960px) { .tabbar { display: none; } }

/* ---------------------------------------------------------------- buttons */

.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--ink);
    --btn-border: var(--line-strong);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 18px;
    font: inherit; font-weight: 650; font-size: .95rem; line-height: 1.2;
    color: var(--btn-fg); background: var(--btn-bg);
    border: 1px solid var(--btn-border); border-radius: 999px;
    cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-border: var(--brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { --btn-fg: var(--danger); --btn-border: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

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

/* ---------------------------------------------------------------- page header */

.page-head { margin-bottom: 24px; }
.page-head .eyebrow { margin-bottom: 6px; }
.page-head p.lead { color: var(--muted); font-size: 1.05rem; max-width: 60ch; margin: 0; }
.page-head .actions { margin-top: 16px; }

/* pull quote under a page title (random cycling quote on /ritten) */
.quote {
    position: relative; margin: 14px 0 0;
    padding: 2px 0 2px 44px;
}
.quote::before {
    content: "\201C"; position: absolute; left: 0; top: -10px;
    font: 800 3.6rem/1 Georgia, "Times New Roman", serif; color: var(--brand); opacity: .35;
}
.quote blockquote { margin: 0; }
.quote p { margin: 0; font-size: 1.08rem; font-style: italic; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.quote figcaption { margin-top: 8px; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.quote figcaption::before { content: ""; display: inline-block; width: 18px; height: 2px; margin-right: 8px; vertical-align: middle; background: var(--brand); }
@media (min-width: 640px) {
    .page-head.split { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
    .page-head.split .actions { margin-top: 0; flex-shrink: 0; }
}

.eyebrow { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }

.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 18px; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (min-width: 640px) {
    .card-body { padding: 24px; }
    .card-head { padding: 18px 24px; }
    .card-foot { padding: 16px 24px; }
}

.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin: 0 0 12px; }
.section-title i { color: var(--brand); }
.section-title .count { font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }

.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .layout-aside { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .78rem; font-weight: 650; line-height: 1;
    padding: 6px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
    white-space: nowrap;
}
.badge i { font-size: .75rem; opacity: .8; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- alerts */

.alert {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--brand-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
    margin-bottom: 20px;
}
.alert i { color: var(--brand); margin-top: 3px; }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-warning i { color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger i { color: var(--danger); }

/* ---------------------------------------------------------------- forms */

.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
    .form-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .form-grid > * { grid-column: span 6; }
    .form-grid > .span-2 { grid-column: span 2; }
    .form-grid > .span-3 { grid-column: span 3; }
    .form-grid > .span-4 { grid-column: span 4; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 650; font-size: .9rem; color: var(--ink-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: .82rem; color: var(--muted); }
.field .error { font-size: .85rem; color: var(--danger); font-weight: 600; display: flex; gap: 6px; align-items: baseline; }

.input, .select, .textarea {
    width: 100%; min-height: 46px;
    font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
    padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7385' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
input[type="date"].input, input[type="time"].input { min-width: 0; }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

/* checkbox / switch rows */
.check {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0; cursor: pointer;
}
.check + .check { border-top: 1px solid var(--line); }
.check input[type="checkbox"] {
    flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0;
    accent-color: var(--brand); cursor: pointer;
}
.check .check-text { display: flex; flex-direction: column; gap: 2px; }
.check .check-title { font-weight: 650; }
.check .check-desc { font-size: .88rem; color: var(--muted); }

/* file input */
.file-drop {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.file-drop:hover { border-color: var(--brand); color: var(--ink); }
.file-drop i { font-size: 1.2rem; color: var(--brand); }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-drop .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-section + .form-section { margin-top: 16px; }
.form-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.form-section-title i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .9rem; }
.form-section-desc { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }

.form-actions {
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
    margin-top: 20px;
}
.sticky-actions {
    position: sticky; bottom: 0; z-index: 5;
    margin-top: 20px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 70%, transparent);
    display: flex; gap: 10px; justify-content: flex-end;
}
body.has-tabbar .sticky-actions { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 12px; }
@media (min-width: 960px) { body.has-tabbar .sticky-actions { bottom: 0; } }
@media (max-width: 639px) { .sticky-actions .btn, .form-actions .btn { flex: 1 1 auto; } }

/* ---------------------------------------------------------------- segmented tabs */

.tabs {
    display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity;
    padding: 4px; margin: 0 -16px 20px; padding-left: 16px; padding-right: 16px;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .tabs { margin-left: 0; margin-right: 0; padding-left: 4px; padding-right: 4px; flex-wrap: wrap; } }
.tab {
    flex: 0 0 auto; scroll-snap-align: start;
    font: inherit; font-weight: 650; font-size: .9rem; text-transform: capitalize;
    padding: 8px 16px; min-height: 40px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.tab:hover { border-color: var(--line-strong); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.tab .tab-count { font-size: .75rem; opacity: .65; margin-left: 4px; }
.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------- list items (rides / events) */

.list { display: flex; flex-direction: column; gap: 12px; }

.item {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; box-shadow: var(--shadow);
    color: inherit;
}
a.item:hover { text-decoration: none; border-color: var(--line-strong); }
a.item:hover .item-title { color: var(--brand); }
.item.is-past { opacity: .62; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .88rem; }
.item-meta span { display: inline-flex; align-items: center; gap: 6px; }
.item-meta i { font-size: .8rem; }
.item .badges { margin-top: 10px; }
.item-side { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
@media (min-width: 640px) { .item { padding: 16px 18px; gap: 18px; align-items: center; } }

.date-tile {
    flex: 0 0 auto; width: 58px; text-align: center;
    border-radius: 12px; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--line);
}
.date-tile .dt-dow { display: block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--brand); color: var(--brand-ink); padding: 3px 0; }
.date-tile .dt-day { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1.15; padding-top: 4px; }
.date-tile .dt-mon { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding-bottom: 5px; }
.is-today .date-tile { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

.item-details { margin-top: 10px; }
.item-details summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    font-size: .85rem; font-weight: 650; color: var(--brand);
}
.item-details summary::-webkit-details-marker { display: none; }
.item-details summary i { transition: transform .15s ease; }
.item-details[open] summary i { transform: rotate(180deg); }
.item-details .item-info { margin-top: 8px; font-size: .92rem; color: var(--ink-2); white-space: pre-line; }

.month-heading { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; margin: 8px 0 0; }

/* ---------------------------------------------------------------- facts (icon + label + value) */

.facts { display: grid; grid-template-columns: minmax(0, 1fr); }
.fact { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact-icon { grid-row: span 2; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.fact-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fact-value { font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 640px) {
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
    .fact:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
}

.prose { color: var(--ink-2); overflow-wrap: anywhere; }
.prose p { margin-bottom: .8rem; }

/* ---------------------------------------------------------------- people */

.avatar {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .85rem; font-weight: 800; letter-spacing: .02em;
    background: var(--brand-soft); color: var(--brand);
    text-transform: uppercase;
}
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }

.member-list { display: flex; flex-direction: column; }
.member {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: 0; }
.member-name { font-weight: 650; background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--ink); text-align: left; cursor: pointer; }
.member-name:hover { color: var(--brand); }
.member-sub { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .actions { gap: 4px; flex-wrap: nowrap; }

/* ---------------------------------------------------------------- comments */

.comments { display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 12px; }
.comment-bubble { flex: 1 1 auto; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 10px 14px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 4px; }
.comment-head strong { font-size: .92rem; }
.comment-head time { font-size: .78rem; color: var(--muted); }
.comment-body { font-size: .95rem; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- files */

.files { display: flex; flex-direction: column; gap: 8px; }
.file {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.file-icon { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.file-main { flex: 1 1 auto; min-width: 0; }
.file-main a { font-weight: 650; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main a:hover { color: var(--brand); }
.file-sub { font-size: .8rem; color: var(--muted); }

/* folder tree (advalvas) */
.tree details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tree details + details { margin-top: 12px; }
.tree summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; font-weight: 700;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s ease; }
.tree details[open] > summary .chev { transform: rotate(90deg); }
.tree summary .folder { color: var(--warning); }
.tree .tree-body { padding: 0 12px 12px; }
.tree .tree-body details { box-shadow: none; background: var(--surface-2); margin-top: 8px; }
.tree .files { margin-top: 4px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .col-actions .row { justify-content: flex-end; flex-wrap: nowrap; gap: 4px; }

/* On phones the admin tables become stacked cards. */
@media (max-width: 639px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
    .table-stack tr:last-child { border-bottom: 0; }
    .table-stack td { border: 0; padding: 2px 0; }
    .table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
    .table-stack td.cell-title { font-weight: 700; font-size: 1rem; }
    .table-stack td.cell-title::before { content: none; }
    .table-stack .col-actions { text-align: left; padding-top: 10px; }
    .table-stack .col-actions .row { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- registration */

.reg-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.reg-row:last-child { border-bottom: 0; }
.reg-total { min-width: 40px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 3px 8px; font-size: .88rem; }
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex-shrink: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 44px; min-height: 36px; padding: 0 12px; border-radius: 999px;
    font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none;
}
.segmented input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }
.segmented input[value="RIDE"]:checked + label { background: var(--success); color: #fff; }
.segmented input[value="ABSENT"]:checked + label { background: var(--danger); color: #fff; }
.segmented.is-disabled { opacity: .45; pointer-events: none; }
@media (max-width: 639px) { .segmented label .seg-text { display: none; } }

/* ---------------------------------------------------------------- empty state */

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--line-strong); margin-bottom: 12px; display: block; }
.empty p { max-width: 40ch; margin: 0 auto 16px; }

/* ---------------------------------------------------------------- home */

.hero {
    position: relative; overflow: hidden;
    border-radius: calc(var(--radius) + 6px);
    background:
        radial-gradient(1200px 400px at 110% -20%, rgba(255,255,255,.18), transparent 60%),
        radial-gradient(600px 300px at -10% 120%, rgba(0,0,0,.25), transparent 60%),
        linear-gradient(135deg, #1f3fd1, #1630a8 55%, #0f1f6e);
    color: #fff;
    padding: 32px 22px;
    box-shadow: var(--shadow-lg);
}
.hero::after {
    content: ""; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px;
    border: 28px solid rgba(255,255,255,.07); border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; display: grid; gap: 24px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(2rem, 1.4rem + 3vw, 3.2rem); margin-bottom: 12px; }
.hero p { color: rgba(255,255,255,.86); font-size: 1.08rem; max-width: 52ch; }
.hero .eyebrow { color: rgba(255,255,255,.75); }
.hero .actions { margin-top: 22px; }
.hero .btn-primary { --btn-bg: #fff; --btn-fg: #1630a8; --btn-border: #fff; }
.hero .btn-primary:hover { background: #eef1ff; }
.hero .btn { --btn-bg: rgba(255,255,255,.12); --btn-fg: #fff; --btn-border: rgba(255,255,255,.35); }
.hero .btn:hover { background: rgba(255,255,255,.2); }
.hero-logo { display: none; background: #fff; border-radius: 24px; padding: 18px; box-shadow: 0 20px 40px rgba(0,0,0,.25); transform: rotate(3deg); }
@media (min-width: 760px) {
    .hero { padding: 56px 48px; }
    .hero-inner { grid-template-columns: minmax(0, 1fr) 240px; }
    .hero-logo { display: block; }
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }

.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }

.spotlight img { border-radius: var(--radius-sm); width: 100%; background: #fff; }

/* ---------------------------------------------------------------- auth pages */

.auth-card { max-width: 440px; margin: 0 auto; }
.auth-card .auth-logo { width: 84px; height: 84px; border-radius: 20px; background: #fff; padding: 10px; margin: 0 auto 14px; box-shadow: var(--shadow); object-fit: contain; }
.auth-card h1 { text-align: center; font-size: 1.6rem; }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 24px; }

/* ---------------------------------------------------------------- footer */

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 36px 0 24px; margin-top: auto; }
body.has-tabbar .site-footer { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { body.has-tabbar .site-footer { padding-bottom: 24px; } }

.sponsors-title { text-align: center; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 750; margin-bottom: 18px; }
.sponsors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 900px; margin: 0 auto; }
@media (min-width: 640px) { .sponsors { grid-template-columns: repeat(5, 1fr); gap: 14px; } }
.sponsor {
    display: grid; place-items: center; aspect-ratio: 1 / 1;
    background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--line); padding: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.sponsor:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.sponsor img { max-height: 100%; width: auto; object-fit: contain; }

.footer-grid { display: grid; gap: 24px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-grid h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.footer-grid address { font-style: normal; color: var(--ink-2); }
.socials { display: flex; gap: 8px; }
.socials a { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.socials a:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.footer-bottom { margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .85rem; }
.footer-bottom a { color: var(--muted); }

/* ---------------------------------------------------------------- toasts */

.toasts {
    position: fixed; z-index: 80; left: 12px; right: 12px;
    top: calc(var(--topbar-h) + 10px);
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
@media (min-width: 640px) { .toasts { left: auto; right: 20px; width: 380px; } }
.toast {
    pointer-events: auto;
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-left: 4px solid var(--brand);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .toast-icon { color: var(--danger); }
.toast-icon { margin-top: 3px; }
.toast-body { flex: 1 1 auto; min-width: 0; }
.toast-title { font-weight: 700; font-size: .92rem; }
.toast-msg { font-size: .9rem; color: var(--ink-2); }
.toast-close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; font-size: 1rem; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- modal dialogs */

dialog.modal {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0; border: 0; border-radius: calc(var(--radius) + 4px);
    background: var(--surface); color: var(--ink);
    box-shadow: var(--shadow-lg);
}
dialog.modal.modal-wide { width: min(1024px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 14, 24, .55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; flex: 1 1 auto; min-width: 0; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* Bottom sheet on phones. */
@media (max-width: 639px) {
    dialog.modal, dialog.modal.modal-wide {
        width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0;
        max-height: 92dvh;
        padding-bottom: env(safe-area-inset-bottom);
    }
    dialog.modal[open] { animation: sheet-in .25s ease; }
    @keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
}

.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- map (GPX viewer) */

.map { height: min(60dvh, 560px); width: 100%; border-radius: var(--radius-sm); background: var(--surface-2); }
.elevation { margin-top: 12px; }
.map-info { margin-top: 10px; }

/* ---------------------------------------------------------------- error page */

.error-code { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 900; line-height: 1; color: var(--brand-soft); -webkit-text-stroke: 2px var(--brand); letter-spacing: -.04em; }

.mainnav a i { display: none; }

/* ---------------------------------------------------------------- event detail */

.event-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "info" "signup" "weather" "files" "talk"; }
@media (min-width: 960px) {
    .event-layout {
        grid-template-columns: minmax(0, 1fr) 360px;
        grid-template-rows: auto auto auto 1fr;
        grid-template-areas: "info signup" "weather signup" "files signup" "talk signup";
        align-items: start;
    }
    .event-layout .signup { position: sticky; top: calc(var(--topbar-h) + 16px); }
}

.prose h3 { margin-top: 1.75rem; color: var(--ink); }
.prose ul { padding-left: 1.25rem; margin: 0 0 1rem; }
.prose li + li { margin-top: .35rem; }

@media (max-width: 420px) {
    .hide-xs { display: none; }
    .topbar .container { gap: 10px; }
    .brand-name { font-size: .95rem; }
    .topbar-actions .btn-primary.btn-sm { width: 40px; padding: 0; }
}

/* Home: intro text 1/3, sponsor spotlight 2/3. */
.home-split { align-items: start; }
@media (min-width: 760px) { .home-split { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }

/* ---------------------------------------------------------------- participant roster (event detail) */

.roster { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.roster-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px; }
.roster-item + .roster-item { border-top: 1px solid var(--line); }
.roster-item.is-me { background: var(--brand-soft); }
.roster-num { width: 20px; text-align: right; font-size: .8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.roster-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-group + .roster-group { margin-top: 18px; }
.roster-head { display: flex; align-items: center; gap: 10px; font-size: .95rem; margin: 0 0 8px; }
.roster-letter { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: .85rem; font-weight: 800; }
.roster-letter.is-none { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.roster-count { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }
.roster-empty { margin: 0; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: .88rem; text-align: center; }

/* Larger badges, e.g. the date and time under an event title. */
.badges-lg .badge { font-size: .95rem; padding: 8px 14px; gap: 8px; }
.badges-lg .badge i { font-size: .9rem; }

/* ---------------------------------------------------------------- ride groups overview */

.ride-groups + .ride-groups { margin-top: 28px; }
.ride-groups .card.is-mine { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.alert.my-group { align-items: center; font-size: 1.05rem; }
.alert.my-group .roster-letter { width: auto; min-width: 34px; height: 34px; padding: 0 8px; font-size: 1rem; }
.roster-head .roster-letter { width: auto; min-width: 26px; padding: 0 6px; }

/* ---------------------------------------------------------------- add to home screen invite */

.install-card { margin-bottom: 20px; border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: linear-gradient(135deg, var(--surface), var(--brand-soft)); }
.install-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: var(--shadow); background: #fff; flex-shrink: 0; }
.install-title { font-size: 1.05rem; margin-bottom: 4px; }
.install-steps { margin: 10px 0 0; padding-left: 1.2rem; font-size: .92rem; color: var(--ink-2); }
.install-steps li + li { margin-top: 4px; }
.install-actions { margin-top: 14px; justify-content: flex-end; flex-wrap: nowrap; }
.install-actions .btn { flex: 0 0 auto; }

/* ---------------------------------------------------------------- weather forecast (event detail) */

.weather-slot:empty { display: none; }
.weather-points { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .weather-points { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.weather-point { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.weather-when { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.weather-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.weather-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-icon-xs { display: none; }

/* Phones: the points side by side as a compact forecast strip; labels become small icons. */
@media (max-width: 639px) {
    .weather-points { grid-template-columns: repeat(var(--points, 3), minmax(0, 1fr)); gap: 8px; }
    .weather-point { padding: 10px 6px; text-align: center; }
    .weather-when { align-items: center; margin-bottom: 6px; }
    .weather-label { font-size: .66rem; letter-spacing: .03em; }
    .weather-time { font-size: .9rem; }
    .weather-main { flex-direction: column; gap: 4px; margin-bottom: 6px; }
    .weather-icon { font-size: 1.5rem; width: auto; }
    .weather-temp { font-size: 1.35rem; }
    .weather-desc { font-size: .74rem; line-height: 1.25; }
    .weather-facts dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .weather-point .weather-facts > div { display: block; }
    .weather-point .weather-facts dd { text-align: center; font-size: .74rem; line-height: 1.35; white-space: nowrap; }
    .fact-icon-xs { display: inline; color: var(--muted); margin-right: 3px; }
    .wind-gusts, .rain-mm { display: block; font-weight: 500; }
    .rain-sep { display: none; }
}
.weather-main { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.weather-icon { font-size: 1.9rem; color: var(--brand); width: 40px; text-align: center; }
.weather-temp { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.weather-desc { font-size: .88rem; color: var(--ink-2); }
.weather-facts { margin: 0; display: grid; gap: 4px; font-size: .88rem; }
.weather-facts > div { display: flex; justify-content: space-between; gap: 8px; }
.weather-facts dt { color: var(--muted); }
.weather-facts dd { margin: 0; font-weight: 600; text-align: right; }
.wind-arrow { color: var(--brand); margin-right: 2px; transition: none; }
