/* ==========================================================================
   In-person ("fair") checkout — /fair.html

   Optimised for one thing: a person standing at a stall, on a phone, in
   sunlight, with a queue behind them. Everything is oversized, high-contrast
   and reachable with a thumb. The whole flow is two taps.
   ========================================================================== */

.fair-body {
    margin: 0;
    min-height: 100dvh;
    background: var(--cream, #fffbeb);
    font-family: var(--font-body, system-ui, sans-serif);
    color: var(--charcoal, #292524);
    -webkit-text-size-adjust: 100%;
}

.fair {
    max-width: 30rem;
    margin: 0 auto;
    padding: max(1rem, env(safe-area-inset-top)) 1.15rem
             max(1.25rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-height: 100dvh;
    justify-content: center;
}

.fair__head { text-align: center; }

.fair__cover {
    width: 96px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(41, 37, 36, 0.18);
}

.fair__title {
    margin: 0.7rem 0 0.15rem;
    font-family: var(--font-display, sans-serif);
    font-size: clamp(1.35rem, 6vw, 1.7rem);
    line-height: 1.15;
}

.fair__sub {
    margin: 0;
    font-size: 0.95rem;
    color: var(--charcoal-soft, #57534e);
}

.fair__label {
    margin: 0 0 0.6rem;
    font-family: var(--font-display, sans-serif);
    font-size: 1.05rem;
    text-align: center;
}

/* Quantity — four big targets, then a stepper for anything unusual. */
.fair__qty-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.fair__qty-btn {
    min-height: 4rem;
    border: 2px solid rgba(41, 37, 36, 0.14);
    border-radius: 16px;
    background: #fff;
    font-family: var(--font-display, sans-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--charcoal, #292524);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.fair__qty-btn:active { transform: scale(0.95); }

.fair__qty-btn.is-active {
    background: var(--sun, #fde047);
    border-color: var(--charcoal, #292524);
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.45);
}

.fair__stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.7rem;
}

.fair__step {
    width: 3rem;
    height: 3rem;
    border: 2px solid rgba(41, 37, 36, 0.14);
    border-radius: 50%;
    background: #fff;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--charcoal, #292524);
    cursor: pointer;
}

.fair__step:disabled { opacity: 0.35; cursor: not-allowed; }

.fair__step-out {
    min-width: 6.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.fair__total {
    margin: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.fair__total-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--charcoal-soft, #57534e);
}

.fair__total strong {
    font-family: var(--font-display, sans-serif);
    font-size: clamp(2.2rem, 11vw, 3rem);
    line-height: 1;
}

.fair__total-note {
    font-size: 0.85rem;
    color: var(--charcoal-soft, #57534e);
}

/* The single action. Full width, thumb height, impossible to miss. */
.fair__pay {
    width: 100%;
    min-height: 4.4rem;
    border: none;
    border-radius: 999px;
    background: var(--sun, #fde047);
    color: var(--charcoal, #292524);
    font-family: var(--font-display, sans-serif);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(250, 204, 21, 0.5);
    transition: transform 0.12s ease, background 0.12s ease;
}

.fair__pay:active { transform: scale(0.98); }
.fair__pay:disabled { opacity: 0.6; cursor: progress; }

.fair__msg {
    margin: 0;
    min-height: 1.2em;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--charcoal-soft, #57534e);
}

.fair__msg.is-error { color: #9b1c1c; }

.fair__fine {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #8a827c;
}

/* ---- Paid confirmation — deliberately unmissable across a market stall ---- */
.fair-done {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eafaf0;
    padding: 1.5rem;
}

.fair-done[hidden] { display: none; }

.fair-done__inner { text-align: center; max-width: 22rem; }

.fair-done__check {
    width: 5.5rem;
    height: 5.5rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #1c7a45;
    color: #fff;
    font-size: 3rem;
    line-height: 5.5rem;
    animation: fair-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes fair-pop {
    from { transform: scale(0.3); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.fair-done__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display, sans-serif);
    font-size: 1.9rem;
    color: #14532d;
}

.fair-done__sub { margin: 0 0 1.6rem; color: #1c7a45; font-size: 1.05rem; }

.fair-done__again {
    min-height: 3.4rem;
    padding: 0 1.8rem;
    border: 2px solid #1c7a45;
    border-radius: 999px;
    background: transparent;
    color: #14532d;
    font-family: var(--font-display, sans-serif);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .fair__qty-btn, .fair__pay { transition: none; }
    .fair-done__check { animation: none; }
}

/* Quiet way back to the full checkout, for anyone who lands here by mistake. */
.fair__back {
    margin: 0;
    text-align: center;
    font-size: 0.85rem;
}

.fair__back a {
    color: var(--charcoal-soft, #57534e);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

/* The shared language toggle is fixed top-right; keep it clear of the layout. */
.fair-body #langToggle {
    z-index: 60;
}

/* Language toggle on pages without the site nav (see createFloatingToggle). */
.lang-toggle--floating {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    z-index: 60;
    min-height: 40px;
    padding: 0 0.85rem;
    border: 1px solid rgba(41, 37, 36, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: var(--font-display, sans-serif);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--charcoal, #292524);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(41, 37, 36, 0.14);
}

/* Stripe buy-button fallback (no STRIPE_SECRET_KEY on the server). */
.fair__buy { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.fair__buy[hidden] { display: none; }
.fair__buy-slot { width: 100%; display: flex; justify-content: center; }
.fair__buy-note { margin: 0; text-align: center; font-size: 0.82rem; color: var(--charcoal-soft, #57534e); }
