/* ===== Design tokens =====
   Palette pulled from wet forest light + anodized fork hardware:
   ink (canopy shadow) / surface (moss) / send (fork red) / fern (highlight green) / amber (dust warning) / paper (fog)
*/
:root {
    --ink: #0b0f0c;
    --surface: #16211a;
    --surface-2: #1f2f24;
    --line: #2a3d2e;
    --moss: #6d8870;
    --fern: #8fae7c;
    --send: #e04a2f;
    --send-dark: #b5391f;
    --amber: #d6a24c;
    --paper: #ece7d8;
    --paper-dim: #a8b3a3;

    --font-display: 'Teko', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

[x-cloak] {
    display: none !important;
}

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

h1, h2, h3 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.01em;
    font-weight: 600;
    color: var(--paper);
    margin: 0 0 0.75rem;
}

h1 { font-size: 2.1rem; line-height: 0.95; }
h2 { font-size: 1.5rem; line-height: 0.95; }
h3 {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--moss);
    margin: 1.5rem 0 0.6rem;
}

.container {
    max-width: 940px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 4rem;
}

/* ===== Top bar (authenticated shell) ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: var(--paper);
    font-size: 1.3rem;
    font-weight: 600;
}

.brand-tab {
    display: inline-block;
    width: 11px;
    height: 15px;
    background: var(--send);
    transform: rotate(-6deg);
    flex-shrink: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.8rem;
    color: var(--paper-dim);
    font-family: var(--font-mono);
}

/* ===== Buttons & forms (shared) ===== */
form label {
    display: block;
    margin-bottom: 0.9rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--paper-dim);
}

input, textarea, select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--paper);
    font-size: 1rem;
    font-family: var(--font-body);
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--send);
    outline-offset: 1px;
}

.btn {
    appearance: none;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.2rem;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.btn-primary {
    background: var(--send);
    color: #180b08;
}

.btn-primary:active {
    background: var(--send-dark);
    color: var(--paper);
}

.btn-ghost {
    background: transparent;
    color: var(--paper-dim);
    border: 1px solid var(--line);
}

.btn-ghost:active {
    border-color: var(--moss);
}

.btn-small {
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
}

.error-banner {
    background: rgba(224, 74, 47, 0.12);
    border: 1px solid var(--send);
    color: #ffb8a3;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.loading {
    color: var(--paper-dim);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.mono {
    font-family: var(--font-mono);
}

/* ===== Hero shell (login / register) ===== */
.hero-shell {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.hero-media {
    position: absolute;
    inset: 0;
    background-image: url('../images/hero-freeride.jpg');
    background-size: cover;
    background-position: center 32%;
    filter: saturate(0.85) contrast(1.08) brightness(0.8);
    transform: scale(1.04);
}

.hero-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(11, 15, 12, 0.35) 0%, rgba(11, 15, 12, 0.55) 38%, rgba(11, 15, 12, 0.96) 82%, var(--ink) 100%);
}

.hero-grain {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 8vh 1.5rem 5vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2.5rem;
    align-items: end;
}

.hero-brand .eyebrow {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--fern);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.hero-wordmark {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3.4rem, 8vw, 6rem);
    line-height: 0.82;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--paper);
    margin: 0 0 1rem;
}

.hero-wordmark .accent {
    color: var(--send);
}

.hero-tagline {
    color: var(--paper-dim);
    max-width: 34ch;
    font-size: 0.98rem;
    line-height: 1.55;
    margin: 0;
}

.auth-card {
    background: rgba(22, 33, 26, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(236, 231, 216, 0.12);
    border-radius: var(--radius);
    padding: 1.5rem 1.5rem 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.auth-card h2 {
    font-size: 1.6rem;
}

.switch-link {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--paper-dim);
}

@media (max-width: 820px) {
    .hero-shell {
        align-items: stretch;
    }

    .hero-content {
        grid-template-columns: 1fr;
        padding-top: 12vh;
        align-items: stretch;
        gap: 2rem;
    }

    .hero-brand {
        text-align: left;
    }
}

/* ===== Inline forms ===== */
.inline-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form input {
    flex: 1;
    min-width: 160px;
    margin-top: 0;
}

.empty-hint {
    color: var(--paper-dim);
    font-size: 0.9rem;
}

/* ===== Garage grid (bike dashboard) ===== */
.garage-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.85rem;
}

.bike-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 0.9rem;
}

.bike-card[data-status="overdue"] { border-left-color: var(--send); }
.bike-card[data-status="due_soon"] { border-left-color: var(--amber); }
.bike-card[data-status="ok"] { border-left-color: var(--fern); }

.bike-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.bike-card-photo {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius);
    margin: -0.1rem 0 0.75rem;
}

.bike-card-name {
    font-family: var(--font-display);
    font-size: 1.65rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    color: var(--paper);
    display: block;
    line-height: 1;
}

.bike-card-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--paper-dim);
    margin-top: 0.3rem;
}

.bike-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.85rem;
}

/* ===== Signature element: worn sticker status badge ===== */
.status-sticker {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.28rem 0.6rem 0.32rem;
    transform: rotate(-2deg);
    border: 1.5px dashed rgba(11, 15, 12, 0.35);
    clip-path: polygon(2% 0%, 98% 3%, 100% 60%, 97% 100%, 3% 97%, 0% 42%);
    color: #180b08;
    white-space: nowrap;
}

.status-sticker.status-overdue { background: var(--send); }
.status-sticker.status-due_soon { background: var(--amber); }
.status-sticker.status-ok { background: var(--fern); }
.status-sticker.status-unknown {
    background: var(--surface-2);
    color: var(--paper-dim);
    border-color: rgba(236, 231, 216, 0.25);
}

/* ===== Bike detail ===== */
.back-link {
    font-size: 0.85rem;
    text-decoration: none;
    font-family: var(--font-mono);
    color: var(--paper-dim);
}

.bike-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.bike-header h1 {
    margin-bottom: 0.15rem;
}

.bike-header-info {
    flex: 1;
    min-width: 0;
}

.bike-meta {
    color: var(--paper-dim);
    font-size: 0.9rem;
    margin: 0 0 0.35rem;
}

.bike-hours {
    color: var(--paper-dim);
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.bike-photo-frame {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
}

.bike-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bike-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--paper-dim);
    padding: 0.3rem;
}

.bike-photo-edit {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.bike-photo-edit .bike-photo-frame {
    width: 84px;
    height: 84px;
}

.bike-photo-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.file-input-label {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

@media (max-width: 520px) {
    .bike-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .bike-photo-edit {
        flex-direction: column;
        align-items: center;
    }
}

.cell-subtext {
    display: block;
    font-size: 0.72rem;
    color: var(--paper-dim);
}

.service-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0.5rem 0 1.5rem;
    display: block;
    overflow-x: auto;
}

.service-table th, .service-table td {
    padding: 0.6rem 0.65rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.service-table th {
    color: var(--moss);
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.service-table tbody tr:hover {
    background: rgba(236, 231, 216, 0.03);
}

.interval-value {
    cursor: pointer;
    border-bottom: 1px dashed var(--moss);
    font-family: var(--font-mono);
}

.override-hint {
    font-size: 0.68rem;
    color: var(--paper-dim);
}

.interval-input {
    width: 70px;
    display: inline-block;
    margin: 0;
    padding: 0.3rem 0.4rem;
}

.interval-unit-select {
    width: auto;
    display: inline-block;
    margin: 0;
    padding: 0.3rem 0.4rem;
}

.interval-editor {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.interval-editor-actions {
    display: flex;
    gap: 0.75rem;
    font-size: 0.72rem;
}

.interval-editor-actions a {
    color: var(--paper-dim);
    text-decoration: underline;
    white-space: nowrap;
}

.interval-editor-actions a:hover {
    color: var(--paper);
}

.new-type-form {
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ===== Entry modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 5, 0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 20;
}

.modal {
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.4rem;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
}

.history-list strong {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
}

.history-list .note {
    margin: 0.25rem 0 0;
    color: var(--paper-dim);
    font-size: 0.85rem;
    white-space: normal;
}

@media (min-width: 600px) {
    .modal-backdrop {
        align-items: center;
    }

    .modal {
        border-radius: var(--radius);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   Marketing site (index.php / how-to.php / donate.php)
   ========================================================= */

.site-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ----- Header nav ----- */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-nav-panel {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.site-nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav-links a {
    text-decoration: none;
    color: var(--paper-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 0.3rem;
    position: relative;
}

.site-nav-links a:hover {
    color: var(--paper);
}

.site-nav-links a.is-active {
    color: var(--paper);
}

.site-nav-links a.is-active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    background: var(--send);
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle-label span {
    width: 22px;
    height: 2px;
    background: var(--paper);
}

@media (max-width: 760px) {
    .site-nav-panel {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 1.1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        padding: 1.25rem 1.5rem 1.5rem;
        display: none;
    }

    .site-nav-links {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-toggle:checked ~ .site-nav-panel {
        display: flex;
    }

    .nav-toggle-label {
        display: flex;
    }
}

/* ----- Homepage hero ----- */
.hero-back {
    display: inline-block;
    margin-bottom: 1.1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--paper-dim);
    text-decoration: none;
}

.hero-back:hover {
    color: var(--paper);
}

.hero-content--home {
    grid-template-columns: 1fr;
    max-width: 720px;
}

.hero-cta-row {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 1.6rem;
}

/* ----- Section scaffolding ----- */
.section {
    padding: 3.5rem 0;
}

.section-eyebrow {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--fern);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    text-transform: uppercase;
    color: var(--paper);
    margin: 0 0 1rem;
    line-height: 0.95;
}

.section-lead {
    color: var(--paper-dim);
    max-width: 60ch;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 2.25rem;
}

/* ----- Card grid (features / how-to reference cards) ----- */
.card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem 1.4rem;
}

.info-card .card-mark {
    display: inline-block;
    width: 11px;
    height: 15px;
    background: var(--send);
    transform: rotate(-6deg);
    margin-bottom: 0.9rem;
}

.info-card .card-title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--paper);
    margin: 0 0 0.45rem;
}

.info-card p {
    color: var(--paper-dim);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0;
}

/* ----- Numbered step list (real sequence: onboarding) ----- */
.step-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.75rem;
    counter-reset: step;
}

.step {
    position: relative;
}

.step-number {
    font-family: var(--font-display);
    font-size: 3rem;
    line-height: 1;
    color: var(--send);
    display: block;
    margin-bottom: 0.5rem;
}

.step-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--paper);
    margin: 0 0 0.4rem;
}

.step-text {
    color: var(--paper-dim);
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
}

/* ----- Page header band (how-to / donate) ----- */
.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 3.25rem 0 2.75rem;
}

.page-header h1 {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
}

.page-header p {
    color: var(--paper-dim);
    max-width: 56ch;
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0.75rem 0 0;
}

/* ----- Status color key (how-to) ----- */
.status-key {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin: 1.5rem 0 1rem;
}

.status-key-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.status-key-row .status-sticker {
    flex-shrink: 0;
    min-width: 118px;
    text-align: center;
    justify-content: center;
}

.status-key-row p {
    margin: 0;
    color: var(--paper-dim);
    font-size: 0.92rem;
}

/* ----- Donate page ----- */
.donate-amounts {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin: 2rem 0 1.1rem;
}

.donate-amount-btn {
    font-size: 1rem;
    padding: 0.85rem 1.7rem;
}

.donate-custom {
    font-size: 0.9rem;
    color: var(--paper-dim);
}

/* ----- Footer ----- */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 2.5rem 0;
    margin-top: 1.5rem;
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-footer-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.site-footer-links a {
    color: var(--paper-dim);
    text-decoration: none;
}

.site-footer-links a:hover {
    color: var(--paper);
}

.site-footer-note {
    color: var(--moss);
    font-size: 0.8rem;
    margin: 0.5rem 0 0;
    width: 100%;
}
