/* PottisGutta: "snackpose" theme. Mobile first: base styles are for a phone, wider screens only get a centered column. */

:root {
    --red: #d62828;
    --yellow: #ffd23f;
    --ink: #2b1b0e;
    --paper: #ffffff;
    --muted: #5e4a36;
    --danger: #a40000;
    --shadow: 4px 4px 0 var(--ink);
    --radius: 16px;
}

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

[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--yellow);
    color: var(--ink);
    font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.4;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

h1, h2 { line-height: 1.15; margin: 0 0 8px; font-weight: 900; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 10px; }

a { color: var(--red); font-weight: 700; }

img { max-width: 100%; }

/* ---- Top bar ---- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--red);
    border-bottom: 3px solid var(--ink);
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}

.brand {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: inline-block;
    transform: rotate(-1.5deg);
    text-shadow: 2px 2px 0 var(--ink);
}

.logout { margin: 0; }
.logout .link-btn { color: #fff; }

main {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* ---- Cards ---- */

.card {
    display: block;
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 16px;
    color: var(--ink);
    text-decoration: none;
    overflow-wrap: anywhere;
}

a.card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.result { display: grid; gap: 2px; }
.empty { text-align: center; }
.danger { border-color: var(--danger); }
.feed-title { margin-bottom: 2px; }

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    background: var(--red);
    color: #fff;
    border: 3px solid var(--ink);
    border-radius: 999px;
    box-shadow: 3px 3px 0 var(--ink);
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-alt { background: var(--paper); color: var(--ink); }
.btn-danger { background: var(--danger); }

.link-btn {
    min-height: 44px;
    padding: 0 4px;
    background: none;
    border: 0;
    color: var(--red);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- Forms ---- */

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 24px; height: 24px; }
.stack { display: grid; gap: 12px; margin-bottom: 12px; }
label { display: grid; gap: 4px; font-weight: 700; }

input[type="text"], input[type="search"], input[type="email"], input[type="password"], input:not([type]), textarea {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    background: var(--paper);
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: 12px;
    font: inherit;
    font-size: 16px; /* 16px stops iOS from zooming into the field */
    font-weight: 400;
}

input[type="file"] { min-height: 44px; font: inherit; font-weight: 400; }

:focus-visible { outline: 3px dashed var(--red); outline-offset: 2px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar input { flex: 1; min-width: 0; }

.form-errors, .field-validation-error, .validation-summary-errors { color: var(--danger); font-weight: 700; }
.validation-summary-errors ul { margin: 0 0 4px; padding-left: 20px; }
.validation-summary-valid { display: none; }

.flash {
    background: var(--paper);
    border: 3px dashed var(--ink);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

/* ---- Stars ---- */

.stars { color: var(--red); font-size: 1.15rem; white-space: nowrap; }
.stars-empty { color: #c9a58a; }
.stars-num { color: var(--ink); font-weight: 900; font-size: 1rem; }

.star-input { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.star-input legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 44px;
    padding: 0 10px;
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 999px;
    font-weight: 900;
    cursor: pointer;
}
.star-input input:checked + label { background: var(--red); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.star-input input:focus-visible + label { outline: 3px dashed var(--red); outline-offset: 2px; }

/* ---- Content bits ---- */

.muted { color: var(--muted); }
.comment { font-style: italic; }
.thumb, .hero { display: block; border: 3px solid var(--ink); border-radius: 12px; margin-top: 8px; }
.hero { width: 100%; max-height: 260px; object-fit: cover; margin: 0 0 10px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.user-row form { margin: 0 0 0 auto; }
.badge { background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; font-size: 0.8rem; font-weight: 900; }

#scan-video { width: 100%; max-height: 50vh; object-fit: cover; border: 3px solid var(--ink); border-radius: 12px; margin: 8px 0; background: var(--ink); }

/* ---- Bottom navigation ---- */

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--ink);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.tabbar a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 64px;
    padding: 0 10px;
    color: var(--yellow);
    font-weight: 900;
    text-decoration: none;
    border-radius: 999px;
}

.tabbar a.active { color: #fff; text-decoration: underline; text-underline-offset: 6px; }

.tabbar a.fab {
    width: 60px; height: 60px;
    min-width: 60px;
    margin-top: -30px;
    padding: 0;
    background: var(--red);
    color: #fff;
    border: 3px solid var(--yellow);
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    box-shadow: 0 0 0 3px var(--ink);
}

/* ---- Bigger screens just get a centered column ---- */

@media (min-width: 700px) {
    body { padding-bottom: 110px; }
    .tabbar { max-width: 640px; left: 50%; right: auto; width: 100%; transform: translateX(-50%); border-radius: 24px 24px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    .brand { transform: none; }
    .btn:active, a.card:active { transform: none; }
}

/* File picker button matches the other buttons */
input[type="file"]::file-selector-button {
    min-height: 44px;
    margin-right: 10px;
    padding: 0 16px;
    background: var(--paper);
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: 999px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

/* ---- Flavor profile ---- */

.flavor-input { border: 0; margin: 0; padding: 0; }
.flavor-input legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.flavor-group { margin-bottom: 8px; }
.group-label { margin: 8px 0 2px; font-size: 0.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; }
.flavor-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 2px 4px 2px 0;
    padding: 0 14px;
    background: var(--paper);
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.chip.main { font-weight: 900; }
.flavor-input input:checked + .chip { background: var(--red); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.flavor-input input:focus-visible + .chip { outline: 3px dashed var(--red); outline-offset: 2px; }

.flavor-stat { margin-bottom: 10px; }
.flavor-line { display: flex; justify-content: space-between; margin: 0; font-weight: 900; }
.bar { height: 16px; background: #ffe9a0; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; margin: 2px 0 4px; }
.bar i { display: block; height: 100%; background: var(--red); }
.flavor-subs { margin: 0; font-size: 0.9rem; }
