/*
 * StrideMate
 *
 * Design direction (CLAUDE.md § Design direction): clean and uncluttered,
 * closer to a native app than a dashboard. Metric cards, not tables.
 *
 * Layout rule that matters for later translation: nothing is sized to the
 * width of its English text. Buttons and labels grow with their content,
 * because German runs roughly 30% longer.
 *
 * Typeface: the brand is Satoshi. It is not loaded here — a webfont means
 * either a third-party CDN (a GDPR problem and an extra round trip on 4G) or
 * self-hosting a licensed file we do not have yet. The system stack below is
 * the stand-in; drop the licensed woff2 into assets/fonts and add the
 * @font-face when it is bought.
 */

:root {
    --mint:      #7EE7B8;
    --sky:       #63D5FF;
    --lavender:  #D6C8FF;
    --coral:     #FF8FB8;
    --peach:     #FFE4A3;
    --off-white: #F8FAFC;
    --charcoal:  #222831;

    --ink:        var(--charcoal);
    --ink-muted:  #5D6470;
    --ink-faint:  #8A9099;
    --surface:    #FFFFFF;
    --background: var(--off-white);
    --line:       #E7EAEF;
    --danger:     #C2385F;

    --gradient: linear-gradient(120deg, var(--mint) 0%, var(--sky) 100%);

    --radius:    14px;
    --radius-lg: 20px;
    --gap:       16px;

    --font: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

body.has-nav { padding-bottom: 78px; }

.page {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 20px 32px;
}

/* ------------------------------------------------------------- typography */

.h1 {
    margin: 0 0 8px;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.h2 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}

.lede {
    margin: 0 0 20px;
    color: var(--ink-muted);
}

.note {
    margin: 20px 0 0;
    font-size: 0.9rem;
    color: var(--ink-faint);
}

.note a { color: var(--ink-muted); }

a { color: var(--ink); text-decoration-color: var(--line); }

.page__header { margin-bottom: 24px; }

/* ------------------------------------------------------------------ brand */

.auth { padding-top: 8vh; }

.brand { margin-bottom: 32px; }

/*
 * The logo is a JPEG, so it carries its own near-white background (#FEFEFE)
 * rather than transparency, which would otherwise read as a pale box against
 * the page (#F8FAFC). Multiply blends the light background away and leaves the
 * gradient badge untouched — no re-cutting the asset. Replace this with the
 * transparent PNG or SVG when brand supplies one.
 */
.brand__mark {
    display: block;
    height: auto;
    width: 100%;
    /* The lockup is wide (737x162, ~4.5:1), so it needs more width than a
       squarer mark would to stay legible. */
    max-width: 240px;
    mix-blend-mode: multiply;
}

.brand__tagline {
    margin: 10px 0 0;
    color: var(--ink-faint);
    font-size: 0.95rem;
}

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

.form { margin: 0 0 8px; }

.form--inline { margin-top: 32px; }

.field { margin-bottom: 22px; }

.field--consent {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.field__label,
.field > .field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 600;
}

.field__input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input:focus {
    outline: none;
    border-color: var(--sky);
    box-shadow: 0 0 0 3px rgba(99, 213, 255, 0.25);
}

/* Short inputs stay short in any language — they hold a number, not a word. */
.field__input--short { max-width: 9rem; }

.field__input--area { resize: vertical; min-height: 84px; }

.field__hint {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--ink-faint);
}

.field__error {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--danger);
}

/* Choice chips wrap rather than truncate — longer translations just reflow. */
.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
}

.choice input { accent-color: var(--sky); margin: 0; }

.choice:has(input:checked) {
    border-color: var(--mint);
    box-shadow: inset 0 0 0 1px var(--mint);
}

.choice__label { font-size: 0.92rem; }

.photo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--line);
}

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

.button {
    display: inline-block;
    padding: 13px 22px;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    /* No fixed width. The label decides. */
}

.button--primary {
    color: var(--charcoal);
    background: var(--gradient);
}

.button--primary:active { filter: brightness(0.96); }

.button--ghost {
    color: var(--ink-muted);
    background: transparent;
    border-color: var(--line);
}

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

.alert {
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 0.92rem;
}

.alert--error {
    color: var(--danger);
    background: #FDEEF3;
    border: 1px solid #F6D4DF;
}

.alert--success {
    background: #EAFBF3;
    border: 1px solid #C9F0DF;
}

/* Development-only affordance. Deliberately unlovely so it is never mistaken
   for production UI. */
.alert--dev {
    background: var(--peach);
    border: 1px dashed #D8B45C;
}

.alert--dev p { margin: 0 0 10px; }
.alert--dev p:last-child { margin-bottom: 0; }

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

.metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.metric {
    flex: 1 1 100px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-align: center;
}

.metric__value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.metric__value--text { font-size: 1.05rem; }

.metric__label {
    display: block;
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--ink-faint);
}

/* ----------------------------------------------------------------- feed */

.feed__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}

.feed {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card__link {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: inherit;
}

.card__when {
    margin: 0 0 4px;
    font-size: 0.82rem;
    color: var(--ink-faint);
}

.card__summary {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}

.card__meta {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ink-muted);
}

/*
 * A run outside the user's filters. Greyed, never hidden — the spec is
 * explicit that hard filtering hides the community from beginners and stops
 * improving runners noticing they have outgrown their settings.
 *
 * Muted with colour and a flat background rather than `opacity`, so the text
 * keeps its contrast ratio and stays readable.
 */
.card--muted {
    background: transparent;
    border-style: dashed;
}

.card--muted .card__summary,
.card--muted .card__when,
.card--muted .card__meta {
    color: var(--ink-faint);
}

.card--muted .card__summary { font-weight: 500; }

.card__filter-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 14px;
    border-top: 1px dashed var(--line);
}

.card__filter-note p {
    margin: 0;
    flex: 1 1 auto;
    font-size: 0.84rem;
    color: var(--ink-faint);
}

.button--small {
    padding: 8px 14px;
    font-size: 0.84rem;
}

/* Paired inputs (min/max ranges). Stack on narrow screens so a longer
   translated label never squashes the field. */
.field-pair {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.field-pair__item {
    flex: 1 1 120px;
    min-width: 0;
}

/* ---------------------------------------------------------- participants */

.section-heading { margin: 28px 0 10px; }

.people {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.person {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.person__name { font-weight: 600; }

.person__meta {
    font-size: 0.85rem;
    color: var(--ink-faint);
}

/* --------------------------------------------------------------- tab bar */

.tabbar {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar__item {
    flex: 1;
    padding: 14px 4px;
    text-align: center;
    text-decoration: none;
    color: var(--ink-faint);
    font-size: 0.78rem;
}

.tabbar__item.is-active { color: var(--ink); font-weight: 600; }

.tabbar__item.is-disabled { opacity: 0.4; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
