/* zrnko — the only stylesheet. Mobile-first: the app lives on a phone home screen. */

:root {
    --bg: #f7f1ea;
    --surface: #fffaf4;
    --ink: #2a1d15;
    --muted: #6b5a4e;
    --line: #e6d9cb;
    --brand: #5a3825;
    --brand-ink: #ffffff;
    --accent: #e8c9a0;
    --ok: #2f6f4e;
    --warn: #9a6a12;
    --err: #a3332a;
    --radius: 14px;
}

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

/* `hidden` must win over any component's display (.btn, .card…). */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

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

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }

/* ── Header ─────────────────────────────────────────────── */
/* In the installed iOS app the page draws under the status bar
   (black-translucent), so the header pads by the safe-area inset. */
#site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: calc(.6rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .6rem max(1rem, env(safe-area-inset-left));
    background: var(--brand);
    color: var(--brand-ink);
}

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: .02em;
}
.logo-mark { width: 30px; height: 30px; }
#site-header .logo-mark rect { fill: var(--accent); }
#site-header .logo-mark ellipse { fill: var(--brand); }
#site-header .logo-mark path { stroke: var(--accent); }

.app-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: -.4rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}
.app-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4;
                stroke-linecap: round; stroke-linejoin: round; }

.link-button {
    font: inherit;
    font-size: .95rem;
    background: none;
    border: 0;
    color: inherit;
    opacity: .85;
    cursor: pointer;
    padding: .3rem 0;
}

/* ── Layout ─────────────────────────────────────────────── */
.page {
    max-width: 32rem;
    margin: 0 auto;
    padding: 1.5rem 1rem calc(2rem + env(safe-area-inset-bottom));
}

.lead { color: var(--muted); margin: 0 0 1.25rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card p:last-child { margin-bottom: 0; }
.empty { color: var(--muted); text-align: center; }

.hero { padding-top: 2rem; }
.hero h1 { font-size: 2rem; }

.mt-1 { margin-top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.danger { color: var(--err); }

/* ── Flash messages ─────────────────────────────────────── */
.flashes { max-width: 32rem; margin: 1rem auto 0; padding: 0 1rem; }
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: .5rem; background: #efe5d8; }
.flash--success { background: #e3f0e8; color: var(--ok); }
.flash--warning { background: #f7ecd4; color: var(--warn); }
.flash--error   { background: #f6e1de; color: var(--err); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .35rem; }

.form-control {
    width: 100%;
    font: inherit;
    font-size: 17px;              /* ≥16px, or iOS zooms in on focus */
    padding: .75rem .9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}
.form-control:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

.code-input {
    font-size: 1.6rem;
    letter-spacing: .35em;
    text-align: center;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.form-check { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; }
.form-check input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--brand); }

.form-hint  { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.form-error { color: var(--err); font-size: .9rem; margin: .25rem 0 0; }

.btn {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    background: var(--brand);
    color: var(--brand-ink);
    border: 0;
    border-radius: 12px;
    padding: .85rem 1.4rem;
    cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn--block { display: block; width: 100%; }
.btn--quiet { background: var(--surface); color: var(--brand); border: 1px solid var(--line); }
.btn--reward { background: var(--ok); margin-bottom: 1rem; }

.install-hint p { margin: .4rem 0 .8rem; color: var(--muted); }

/* ── Bottom tab bar (signed in) ─────────────────────────── */
.page.has-tabs { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

.tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding: .55rem 0 .5rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.tabs a[aria-current] { color: var(--brand); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
            stroke-linecap: round; stroke-linejoin: round; }

/* ── Loyalty card ───────────────────────────────────────── */
.loyalty-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    color: inherit;
    text-decoration: none;
}
.loyalty-card__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.beans { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.bean {
    width: 22px; height: 28px;
    border-radius: 50%;
    border: 2px dashed var(--line);
    transform: rotate(-25deg);
}
.bean.is-full {
    border: 0;
    background: var(--brand);
    /* the crease down the middle of a coffee bean */
    background-image: linear-gradient(100deg, transparent 46%, var(--accent) 47% 53%, transparent 54%);
}
.reward-ready { font-weight: 600; color: var(--ok); }

.list-link { display: flex; justify-content: space-between; align-items: baseline; color: inherit; text-decoration: none; }

/* ── History ────────────────────────────────────────────── */
.history, .staff-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.history li, .staff-list li {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.history li > span:first-child { display: flex; flex-direction: column; }
.history-end { display: flex; align-items: center; gap: .9rem; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.is-plus { color: var(--ok); }
.delta.is-minus { color: var(--muted); }

/* ── Môj kód ────────────────────────────────────────────── */
.code-screen { text-align: center; }
.qr-frame {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0 auto;
    max-width: 18rem;
    box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(90, 56, 37, .08);
}
.qr { display: block; width: 100%; height: auto; }
.code-digits {
    font-size: 2.2rem; font-weight: 700; letter-spacing: .12em;
    font-variant-numeric: tabular-nums; margin: 1rem 0 .25rem;
}

.toast {
    position: fixed;
    left: 1rem; right: 1rem;
    bottom: calc(5rem + env(safe-area-inset-bottom));
    z-index: 20;
    max-width: 30rem;
    margin: 0 auto;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    background: var(--ok);
    color: #fff;
    font-weight: 600;
    text-align: center;
    animation: pop .25s ease-out;
}
@keyframes pop { from { transform: translateY(1rem); opacity: 0; } }

/* ── Seller ─────────────────────────────────────────────── */
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.scanner video { display: block; width: 100%; border-radius: 10px; background: #000; aspect-ratio: 1; object-fit: cover; }
.label { display: block; font-weight: 600; margin-bottom: .5rem; }
.inline-input { display: flex; gap: .5rem; }
.inline-input .form-control { flex: 1; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .25rem; }
.stats strong { display: block; font-size: 1.5rem; }
.stats span { font-size: .8rem; color: var(--muted); }

.stamp-buttons { margin-top: .75rem; }
.stamp-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: .5rem; }
.stamp-row .btn { padding-left: 0; padding-right: 0; }
.btn--big { font-size: 1.4rem; }
.program .btn--reward { margin: .25rem 0 0; }

/* ── Pre kaviarne (owner pitch) ─────────────────────────── */
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700;
           color: var(--brand); margin: 0 0 .4rem; }
.demo-card { margin: 1.25rem 0; }
.pitch { margin-top: 2.25rem; }
.pitch h2 { font-size: 1.3rem; margin-bottom: .75rem; }
.steps, .benefits { margin: 0 0 1rem; padding-left: 1.25rem; }
.steps li, .benefits li { margin-bottom: .7rem; }
.benefits { list-style: none; padding-left: 0; }
.benefits li { padding-left: 1.6rem; position: relative; }
.benefits li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.price-card { text-align: center; }
.plan-price { font-size: 2.4rem; font-weight: 800; margin: 0 0 .25rem; color: var(--brand); }
.for-cafes-link { margin-top: 2rem; }

.site-footer { max-width: 32rem; margin: 0 auto; padding: 0 1rem calc(1.5rem + env(safe-area-inset-bottom));
               text-align: center; font-size: .85rem; color: var(--muted); }
.site-footer a { color: inherit; }

/* ── A café's public page ───────────────────────────────── */
.rewards { list-style: none; margin: 0; padding: 0; }
.rewards li { display: flex; gap: .9rem; align-items: center; padding: .4rem 0; }
.rewards li + li { border-top: 1px solid var(--line); }
.rewards__count { font-size: 1.4rem; font-weight: 800; color: var(--brand); min-width: 3.2rem; }
.poster-link { margin-bottom: 1rem; }
.logo-preview, .shop-page-logo { display: block; max-width: 220px; max-height: 110px; object-fit: contain; margin-bottom: 1rem; }

/* ── Legal pages ────────────────────────────────────────── */
.legal .flash { margin-bottom: 1rem; }
.prose { line-height: 1.6; }
.prose h2 { margin-top: 1.75rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .6rem; }
.prose li ul { margin-top: .5rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 1rem 0 1.5rem; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 420px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: .5rem; } }
