/* Palette: a warm taproom rather than the near-black the other apps use --
 * brown-grey surfaces, cream text, amber for anything that matters. Light
 * enough to sit in without glare, dark enough to read a photo against.
 *
 * Everything below refers to these; no raw hex outside this block, so the
 * scheme can be re-tuned in one place. --bg is also read by auth.js's login
 * gate. */
:root {
    --bg: #29231f;
    --surface: #3c332a;
    --surface-hi: #483d31;
    --border: #574c40;

    --text: #f0e9df;          /* warm off-white, not pure #fff */
    --text-strong: #fffaf2;
    --muted: #c9bcaa;
    --dim: #a89a87;          /* lightest tone that still clears 4.5:1 on --surface */

    --amber: #f0a92a;         /* the beer, and every accent */
    --amber-deep: #e09a3c;
    --link: #e0a95f;

    --danger: #a8473c;
    --danger-bg: #3d2724;
    --danger-text: #f0a08f;
    --ok: #4f8f4a;
    --ok-bg: #24331f;
    --ok-text: #9fd18f;

    --star-dim: #5a4f43;
    --well: #221e1b;          /* recessed: image backdrops */
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.5;
            padding: 0 0 2rem 0;
        }
        a { color: var(--link); text-decoration: none; }
        a:hover { text-decoration: underline; }

        .nav {
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            padding: 0.75rem 1rem;
            display: flex;
            gap: 1.5rem;
            align-items: center;
            flex-wrap: wrap;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .nav .brand {
            font-weight: 700;
            font-size: 1.1rem;
            color: var(--amber);
            margin-right: auto;
        }
        .nav a { color: var(--muted); font-size: 0.9rem; }
        .nav a:hover { color: var(--text-strong); text-decoration: none; }

        .container { max-width: 1200px; margin: 0 auto; padding: 1rem; }

        .stats {
            display: flex;
            gap: 1rem;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
        }
        .stat-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 1rem 1.25rem;
            flex: 1;
            min-width: 140px;
        }
        .stat-card .label { font-size: 0.8rem; color: var(--dim); text-transform: uppercase; }
        .stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--text-strong); }

        .btn {
            display: inline-block;
            padding: 0.5rem 1.25rem;
            border: none;
            border-radius: 6px;
            font-size: 0.9rem;
            cursor: pointer;
            text-decoration: none;
            font-weight: 500;
        }
        .btn:hover { text-decoration: none; opacity: 0.9; }
        /* Dark text on amber: white on this would fail contrast. */
        .btn-primary { background: var(--amber-deep); color: var(--bg); }
        .btn-danger { background: var(--danger); color: var(--text-strong); }
        .btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

        .form-group { margin-bottom: 1rem; }
        .form-group label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
        .form-group input, .form-group select, .form-group textarea {
            width: 100%;
            padding: 0.6rem 0.8rem;
            background: var(--well);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text);
            font-size: 1rem;
        }
        .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
            outline: none;
            border-color: var(--amber);
        }
        .form-group textarea { min-height: 80px; resize: vertical; }
        .form-row { display: flex; gap: 1rem; }
        .form-row .form-group { flex: 1; }

        .alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
        .alert-error { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger-text); }
        .alert-success { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--ok-text); }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .page-header h1 { font-size: 1.5rem; color: var(--text-strong); }

        .empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--dim);
        }
        .empty-state p { margin-bottom: 1rem; }

        @media (max-width: 480px) {
            .stat-card .value { font-size: 1.4rem; }
            .form-row { flex-direction: column; gap: 0; }
        }

        /* --- static-app additions --- */
        .view { display: none; }
        .view.active { display: block; }
        .loading { text-align: center; color: var(--dim); padding: 2rem; }
        .nav a.active { color: var(--amber); }
        .badge { background:var(--amber-deep); color:var(--bg); border-radius:10px; padding:0 .4rem; font-size:.75rem; }

/* ---- login gate (see auth.js) ---- */
.login-gate {
    position: fixed;
    inset: 0;
    background: var(--bg, #111);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.login-box {
    width: 100%;
    max-width: 22rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.login-box h1 { margin: 0 0 .5rem; font-size: 1.25rem; }
.login-box label { font-size: .8rem; opacity: .75; }
.login-box input {
    padding: .6rem .7rem;
    font-size: 1rem; /* >=16px stops iOS zooming the page on focus */
    border-radius: .4rem;
    border: 1px solid var(--border);
    background: var(--well);
    color: inherit;
}
.login-box button {
    margin-top: .5rem;
    padding: .65rem;
    font-size: 1rem;
    border-radius: .4rem;
    cursor: pointer;
    border: none;
    background: var(--amber-deep);
    color: var(--bg);
    font-weight: 600;
}
.login-box button[disabled] { opacity: .6; cursor: default; }
.login-error { color: var(--danger-text); min-height: 1.2em; margin: .25rem 0 0; font-size: .85rem; }

/* ---- pint tracker ---- */
.beer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.beer-card .thumb {
    width: 84px;
    height: 84px;
    flex: 0 0 84px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--well);
    cursor: zoom-in;
}
.beer-card .thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: default;
}
.beer-body { flex: 1; min-width: 0; }
.beer-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.beer-card .name { font-weight: 600; color: var(--text-strong); font-size: 1.05rem; }
.beer-card .meta { font-size: 0.85rem; color: var(--dim); }
.beer-card .notes { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; word-wrap: break-word; }

.stars { color: var(--amber); font-size: 0.9rem; letter-spacing: 1px; }
.stars .dim { color: var(--star-dim); }

.brand-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
}
.brand-row:hover { text-decoration: none; border-color: var(--amber); background: var(--surface-hi); }
.brand-row .name { font-weight: 600; color: var(--text-strong); flex: 1; min-width: 0; }
.brand-row .count { color: var(--amber); font-weight: 600; }
.brand-row .avg { color: var(--amber); font-size: 0.85rem; min-width: 3.5rem; text-align: right; }
.brand-row .meta { font-size: 0.8rem; color: var(--dim); min-width: 8rem; text-align: right; }

/* The upload preview is a local blob, so it can be any orientation/size. */
.photo-preview {
    margin-top: 0.6rem;
    max-width: 100%;
    max-height: 260px;
    border-radius: 6px;
    display: block;
}

/* What was read out of the photo's EXIF: the date and place it was taken. */
.photo-meta {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--dim);
    line-height: 1.4;
}

.photo-meta.busy {
    opacity: 0.7;
    font-style: italic;
}

.map-link {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
}

.map-link:hover {
    color: var(--amber);
}

/* iPhone-only help, hidden elsewhere. Collapsed until it is needed. */
.ios-tip {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
}

.ios-tip summary {
    cursor: pointer;
    color: var(--amber);
}

.ios-tip ol {
    margin: 0.6rem 0;
    padding-left: 1.2rem;
}

.ios-tip li,
.ios-tip p {
    margin: 0.35rem 0;
    line-height: 1.45;
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(24, 20, 18, 0.94);
    z-index: 900;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

@media (max-width: 480px) {
    .brand-row .meta { display: none; }
    .beer-card .thumb { width: 64px; height: 64px; flex-basis: 64px; }
}
