/* Shared styles for the public site: home, login, register, account.
   Placeholder palette until the brand colors in handbook/design.md are
   chosen — every color comes from these tokens. */

:root {
    --bg: #fbf7f1;
    --bg-alt: #f4eee4;
    --surface: #ffffff;
    --text: #1f2a26;
    --muted: #5e6a64;
    --line: #e9e1d4;
    --accent: #2a7a66;
    --accent-text: #ffffff;
    --accent-soft: #e2f0ea;
    --warm: #d9764f;
    --warm-soft: #fbe5d9;
    --danger: #b5432f;
    --danger-soft: #fbe4de;

    /* illustrated map */
    --map-land: #f1ebdf;
    --map-park: #d5e7cc;
    --map-water: #cde2ee;
    --map-road: #ffffff;
    --map-road-edge: #e0d6c6;
    --route: #2a7a66;

    --band-bg: #1f2a26;
    --band-text: #f4f1ea;
    --band-muted: #aab4ae;
    --band-line: #35423d;

    --shadow: 0 30px 60px -30px rgba(40, 30, 10, .35), 0 8px 20px -12px rgba(40, 30, 10, .18);
    --radius: 16px;
    --max: 1120px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141917;
        --bg-alt: #19201d;
        --surface: #1d2421;
        --text: #eef1ed;
        --muted: #a2ada7;
        --line: #2c3531;
        --accent: #63c3a9;
        --accent-text: #0e1a16;
        --accent-soft: #1d3530;
        --warm: #f0a07c;
        --warm-soft: #3b2a22;
        --danger: #f08a75;
        --danger-soft: #3a221d;

        --map-land: #1f2724;
        --map-park: #223428;
        --map-water: #1c2e39;
        --map-road: #343f3a;
        --map-road-edge: #29322e;
        --route: #63c3a9;

        --band-bg: #0e1211;
        --band-line: #252d2a;

        --shadow: 0 30px 60px -30px rgba(0, 0, 0, .7), 0 8px 20px -12px rgba(0, 0, 0, .5);
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.55;
}

a { color: inherit; }

[hidden] { display: none !important; }

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand svg { width: 28px; height: 28px; flex: none; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease, opacity .15s ease;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible,
.field input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}

.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

.btn-ghost:hover { border-color: var(--muted); }

.btn-lg { min-height: 54px; padding: 0 28px; font-size: 17px; }

.btn-block { width: 100%; }

.btn[disabled] { opacity: .6; cursor: progress; }

/* Pulsing "sharing" dot — the brand's core motif (SharingIndicator in app) */

.dot {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
    from { opacity: .6; transform: scale(1); }
    to   { opacity: 0;  transform: scale(2.8); }
}

/* Forms (login, register) */

.auth-main {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 40px 20px 64px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.auth-card .sub {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 16px;
}

.field { margin-bottom: 18px; }

.field label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
}

.field label .opt { color: var(--muted); font-weight: 400; }

.field input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;   /* keeps iOS from zooming in on focus */
}

.field input:focus { border-color: var(--accent); }

.field .hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.password-wrap { position: relative; }

.password-wrap input { padding-right: 64px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.password-toggle:hover { color: var(--text); }

.form-error {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 15px;
}

.form-error a { font-weight: 600; }

.auth-switch {
    margin: 22px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.auth-switch a { color: var(--accent); font-weight: 600; }

.auth-note {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* Footer */

.site-footer {
    padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}

.site-footer .wrap {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 420px) {
    .nav-actions .nav-optional { display: none; }   /* e.g. "Log in" on home: still reachable in the page itself */
    .auth-card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .dot::after { animation: none; }
}
