/* Public gift (/g) and staff (/s) pages. Phone first, same type and colours as the app. */
:root {
    --bg: #f2f2f2;
    --card: #fff;
    --text: #000;
    --muted: #777;
    --line: #e5e5e5;
    --accent: #ffc107;
    --ok: #12a150;
    --bad: #ff286c;
    --radius: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000;
        --card: #121212;
        --text: #fff;
        --muted: #aaa;
        --line: #2a2a2a;
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.45 "Inter", sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

h1 {
    font: 500 32px/1.2 "Sora", sans-serif;
    letter-spacing: -0.6px;
    margin: 4px 0 12px;
}

h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 24px 0 8px;
}

.promo h2 { margin-top: 0; }

.eyebrow { font-weight: 600; margin-bottom: 12px; }
.business { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.center { text-align: center; }

.message {
    font-size: 19px;
    margin: 0 0 20px;
}

.badge {
    display: inline-block;
    background: var(--accent);
    color: #000;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 15px;
    font-weight: 500;
}

.state {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0 8px;
    font-weight: 500;
}

/* White even in dark mode: scanners read dark on light best. */
.qr {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin: 24px auto 12px;
    width: 240px;
}

.qr svg { display: block; width: 100%; height: auto; }

.code {
    font: 500 32px/1.2 "Sora", sans-serif;
    letter-spacing: 3px;
    text-align: center;
    user-select: all;
}

.facts, .terms {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
}

.facts li {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.facts .icon { width: 24px; text-align: center; }

.terms li {
    color: var(--muted);
    font-size: 15px;
    padding: 2px 0;
}

.terms li::before { content: "•  "; }

.stores { display: flex; gap: 12px; margin-top: 16px; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--text);
    color: var(--card);
    font: 500 17px "Inter", sans-serif;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
}

.button.secondary { background: var(--line); color: var(--text); }
.button:disabled { opacity: 0.5; cursor: default; }

/* Staff page */
.code_input {
    width: 100%;
    min-height: 60px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: 500 28px "Sora", sans-serif;
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
    margin: 12px 0;
}

.code_input:focus { outline: none; border-color: var(--text); }

.row { display: flex; gap: 12px; }

#camera {
    display: none;
    width: 100%;
    border-radius: 12px;
    margin-top: 12px;
    background: #000;
}

.result { display: none; }
.result.ok { border: 3px solid var(--ok); }
.result.bad { border: 3px solid var(--bad); }
.result .verdict { font-weight: 600; font-size: 19px; }
.result.ok .verdict { color: var(--ok); }
.result.bad .verdict { color: var(--bad); }

.warning {
    background: #fff3cd;
    color: #000;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 16px 0 0;
    font-size: 15px;
}

/* Gift page (/g): charcoal like the app, with the voucher as a white ticket. */
body.gift {
    --bg: #f1f2f6;
    --card: #fff;
    --text: #000;
    --muted: #6e7385;
    --line: #e5e5e5;
    --charcoal: #222;
    --yellow: #fde24d;
    --on-charcoal-muted: #adadad;
    background: var(--charcoal);
    color: #fff;
    font-family: "Poppins", "Inter", sans-serif;
}

.gift h1, .gift .code { font-family: "Poppins", "Sora", sans-serif; }
.gift h1 { font-weight: 600; font-size: 28px; letter-spacing: -0.3px; }
.gift .card { color: var(--text); }
.gift .badge { background: var(--yellow); }
.gift .muted { color: var(--muted); }
.gift .promo .muted { color: var(--on-charcoal-muted); }

.gift .button {
    background: var(--yellow);
    color: var(--charcoal);
    border-radius: 999px;
    font: 500 18px "Poppins", sans-serif;
}

.stage { text-align: center; padding: 24px 0 8px; }
.stage .message { color: var(--on-charcoal-muted); }

/* The box: bobs while it waits, shakes harder and harder when tapped, then opens and the star rises out. */
.box {
    position: relative;
    display: block;
    width: 220px;
    margin: 72px auto 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.box .float {
    position: relative;
    display: block;
    aspect-ratio: 400 / 378;
    animation: bob 3s ease-in-out infinite alternate;
}

.box .float > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.box .inside, .box .star { visibility: hidden; }

.box .shadow {
    display: block;
    width: 70%;
    height: 18px;
    margin: 18px auto 0;
    border-radius: 50%;
    background: #000;
    opacity: 0.25;
    animation: shadow 3s ease-in-out infinite alternate;
}

.box .star {
    position: absolute;
    left: 28%;
    top: -16%;
    width: 44%;
    animation: bob 2.2s ease-in-out infinite alternate;
}

.box .star img {
    display: block;
    width: 100%;
    transform: translateY(60%) scale(0.4);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.2, 1.5, 0.4, 1), opacity 0.2s;
}

.stage.shaking .float { animation: shake 1.4s linear forwards; }
.stage.shaking .shadow { animation: none; }

.stage.opened .closed { visibility: hidden; }
.stage.opened .inside, .stage.opened .star { visibility: visible; }
.stage.opened .star img { transform: none; opacity: 1; }
.stage.opened .box { cursor: default; }
.stage.opened .actions { display: none; }

.sparkle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: url("/images/twinkle.svg") center / contain no-repeat;
    opacity: 0;
}

.stage.opened .sparkle { animation: twinkle 1.6s ease-in-out infinite alternate; }
.sparkle.s0 { left: -8%; top: 10%; }
.sparkle.s1 { left: 12%; top: -12%; animation-delay: -0.5s !important; }
.sparkle.s2 { left: 84%; top: -16%; animation-delay: -1s !important; }
.sparkle.s3 { left: 104%; top: 6%; animation-delay: -0.3s !important; }
.sparkle.s4 { left: -14%; top: 58%; animation-delay: -1.3s !important; }
.sparkle.s5 { left: 108%; top: 62%; animation-delay: -0.8s !important; }

.actions { max-width: 320px; margin: 0 auto; }

.skip {
    margin-top: 8px;
    padding: 12px;
    border: 0;
    background: none;
    color: var(--on-charcoal-muted);
    font: 400 15px "Poppins", sans-serif;
    text-decoration: underline;
    cursor: pointer;
}

/* Hidden until the box is opened (only with JS, so the gift is never lost). */
.js .stage.wrapped:not(.opened) ~ .ticket,
.js .stage.wrapped:not(.opened) ~ .promo { display: none; }
.stage.opened ~ .ticket { animation: rise 0.6s ease-out 0.5s both; }
.stage.opened ~ .promo { animation: rise 0.6s ease-out 0.7s both; }
.stage.instant ~ .ticket, .stage.instant ~ .promo { animation: none; }

.ticket { margin-top: 16px; }
.ticket .headline {
    font: 600 26px/1.2 "Poppins", sans-serif;
    margin: 4px 0 12px;
}

/* The bring-a-friend bonus, under the headline (also on the staff page). */
.friend {
    display: inline-block;
    background: var(--yellow, #fde24d);
    color: #222;
    border-radius: 999px;
    padding: 4px 12px;
    margin: 0 0 12px;
    font-weight: 600;
    font-size: 14px;
    text-wrap: pretty;
}

.friend[hidden] { display: none; }

/* The tear line, with a half-circle bite out of each edge. */
.perforation {
    position: relative;
    height: 28px;
    margin: 16px -24px 0;
}

.perforation::before {
    content: "";
    position: absolute;
    left: 28px;
    right: 28px;
    top: 50%;
    border-top: 2px dashed #dadde5;
}

.perforation::after {
    content: "";
    position: absolute;
    left: -14px;
    right: -14px;
    top: 0;
    height: 28px;
    background:
        radial-gradient(circle at 14px 14px, var(--charcoal) 14px, transparent 14.5px) left / 28px 28px no-repeat,
        radial-gradient(circle at 14px 14px, var(--charcoal) 14px, transparent 14.5px) right / 28px 28px no-repeat;
}

.gift .promo { padding: 8px 4px; }
.gift .promo h2 { font-size: 19px; }
.gift .stores { flex-direction: column; }

@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-12px); } }
@keyframes shadow { from { transform: scale(1); opacity: 0.25; } to { transform: scale(0.85); opacity: 0.18; } }
@keyframes twinkle { from { opacity: 0.2; transform: scale(0.7) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(-4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Starts gentle and builds, like the app's opening. */
@keyframes shake {
    0% { transform: none; }
    3.6% { transform: rotate(-1.8deg) translateX(-1.2px) scale(1.004); }
    7.1% { transform: rotate(2.1deg) translateX(1.4px) scale(1.007); }
    10.7% { transform: rotate(-2.4deg) translateX(-1.5px) scale(1.011); }
    14.3% { transform: rotate(2.6deg) translateX(1.7px) scale(1.014); }
    17.9% { transform: rotate(-2.9deg) translateX(-1.9px) scale(1.018); }
    21.4% { transform: rotate(3.2deg) translateX(2.1px) scale(1.021); }
    25% { transform: rotate(-3.5deg) translateX(-2.2px) scale(1.025); }
    28.6% { transform: rotate(3.8deg) translateX(2.4px) scale(1.029); }
    32.1% { transform: rotate(-4.1deg) translateX(-2.6px) scale(1.032); }
    35.7% { transform: rotate(4.4deg) translateX(2.8px) scale(1.036); }
    39.3% { transform: rotate(-4.6deg) translateX(-3.0px) scale(1.039); }
    42.9% { transform: rotate(4.9deg) translateX(3.1px) scale(1.043); }
    46.4% { transform: rotate(-5.2deg) translateX(-3.3px) scale(1.046); }
    50% { transform: rotate(5.5deg) translateX(3.5px) scale(1.050); }
    53.6% { transform: rotate(-5.8deg) translateX(-3.7px) scale(1.054); }
    57.1% { transform: rotate(6.1deg) translateX(3.9px) scale(1.057); }
    60.7% { transform: rotate(-6.4deg) translateX(-4.0px) scale(1.061); }
    64.3% { transform: rotate(6.6deg) translateX(4.2px) scale(1.064); }
    67.9% { transform: rotate(-6.9deg) translateX(-4.4px) scale(1.068); }
    71.4% { transform: rotate(7.2deg) translateX(4.6px) scale(1.071); }
    75% { transform: rotate(-7.5deg) translateX(-4.8px) scale(1.075); }
    78.6% { transform: rotate(7.8deg) translateX(4.9px) scale(1.079); }
    82.1% { transform: rotate(-8.1deg) translateX(-5.1px) scale(1.082); }
    85.7% { transform: rotate(8.4deg) translateX(5.3px) scale(1.086); }
    89.3% { transform: rotate(-8.6deg) translateX(-5.5px) scale(1.089); }
    92.9% { transform: rotate(8.9deg) translateX(5.6px) scale(1.093); }
    96.4% { transform: rotate(-9.2deg) translateX(-5.8px) scale(1.096); }
    100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .box .float, .box .shadow, .box .star, .stage.opened .sparkle { animation: none; }
    .stage.opened .sparkle { opacity: 1; }
    .box .star img { transition: none; }
    .stage.opened ~ .ticket, .stage.opened ~ .promo { animation: none; }
}

/* The app's Terms of Use and Privacy Policy (/app/...), shown inside the app. */
.legal main { padding: 8px 4px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { color: #e6e6e6; font-size: 16px; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin: 6px 0; }
.legal li ul { margin-top: 6px; }
.legal strong { color: #fff; font-weight: 600; }
.legal a { color: var(--yellow); }
.legal .updated { color: var(--on-charcoal-muted); font-size: 14px; }
.legal .placeholder { background: rgba(253, 226, 77, 0.18); color: var(--yellow); border-radius: 4px; padding: 0 4px; }

/* The ticket's head: the business's photo across the top with its logo on it. */
.ticket_head { position: relative; margin: -24px -24px 12px; padding: 24px 24px 0; }
.ticket.has_hero .ticket_head { padding: 0; margin-bottom: 40px; }
.ticket_head .hero { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.ticket_head .logo {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--charcoal); color: #fff; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font: 600 24px "Poppins", sans-serif;
    border: 3px solid #fff;
}
.ticket.has_hero .ticket_head .logo { position: absolute; left: 20px; bottom: -28px; width: 64px; height: 64px; }
.ticket_head .logo img { width: 100%; height: 100%; object-fit: cover; }
.known_for { color: var(--text); font-weight: 500; margin-top: 2px; }
.ticket .about { margin: 0 0 8px; }
