/* This app-wide palette used to be its own independent set of hex values —
   a visibly different, dustier rose (#d17ba0) and warmer cream (#fdf6f0)
   than the vivid palette brand.css introduced for the 2026-08-13+ redesign
   of home/auth/dashboard/event/guest. Every page already loads brand.css
   (see base.php), so instead of a page-by-page repaint, the tokens below
   now alias straight into brand.css's --h-* values: one edit here brings
   every shared component that still reads --color-* (buttons, links,
   cards, flash messages, the reveal modal's frame, share buttons, the
   language switcher, the cookie banner) onto the same colors as the rest
   of the app, on every page, without renaming ~30 call sites.

   --color-girl / --color-boy are the one deliberate exception (per user
   decision, 2026-08-24): they're the actual reveal-outcome colors, matching
   the hardcoded ZONE_FILL in scratch-card.js / home-scratch.js and the
   confetti palette. That's gameplay data, not chrome — left untouched. */
:root {
    --color-bg: var(--h-paper);
    --color-surface: #ffffff;
    --color-text: var(--h-ink);
    --color-muted: var(--h-muted);
    /* Same recipe brand.css uses for its own input borders: --h-ink at 14%. */
    --color-border: rgba(32, 26, 41, 0.14);
    --color-primary: var(--h-blush);
    /* --h-blush fails as TEXT (see brand.css) — this is --h-blush-text,
       the darkened same-hue shade that clears 4.5:1 on light backgrounds. */
    --color-primary-dark: var(--h-blush-text);
    --color-girl: #ef8fb4;
    --color-boy: #7fb8e0;
    --radius: var(--radius-panel);
    --shadow: var(--elevation-panel);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--h-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

.container {
    max-width: var(--content-workspace);
    margin: 0 auto;
    padding-inline: var(--content-gutter);
}

a { color: var(--color-primary-dark); }

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block: var(--space-3);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    font-family: var(--h-display);
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--color-text);
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-nav > a,
.site-nav .link-button {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
}

.site-footer {
    text-align: center;
    color: var(--color-muted);
    padding: 2rem 0;
    font-size: 0.85rem;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.card-narrow {
    max-width: 420px;
    margin: 2rem auto;
}

.card-danger-zone { border: 1px solid #f0c6cf; }
.card-danger-zone h2 { color: #a33f56; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.5rem 0;
}

h1, h2, h3 { font-family: var(--h-display); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; }

label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; font-size: 0.9rem; }
.radio-label, .checkbox-label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

fieldset { border: none; padding: 0; margin: 1rem 0 0; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0; }

.form-row { display: flex; gap: 1rem; }
.form-row > div { flex: 1; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    background: var(--color-primary);
    /* Dark ink on blush, not white — same reasoning as brand.css's
       .btn-primary: white on --h-blush is ~2.6:1 and fails contrast, the
       ink pairing clears ~7:1. Only matters where nothing more specific
       (.btn-primary, .btn-ghost, .btn-danger) overrides this base rule. */
    color: var(--h-night);
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.7rem 1.4rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
/* Lightens rather than darkens: the button carries dark text now, so a
   darker hover (the old --color-primary-dark) would fight the text instead
   of complementing it — same hover direction brand.css's .btn-primary uses. */
.btn:hover { background: var(--h-blush-hover); }
/* The 1.25rem top gap belongs to "submit button sitting under a form's last
   field" — scoped to that context only. Applying it to .btn-primary globally
   used to leak into flex button rows (the home hero, the final CTA) and
   throw a same-size .btn-primary/.btn-ghost pair out of vertical alignment,
   which read as "the buttons are different sizes" even though their
   padding/font-size were identical. */
form > .btn-primary { margin-top: 1.25rem; }
.btn-small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-tiny { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger { background: #c0506a; }
.btn-danger:hover { background: #a33f56; }
.link-button {
    background: none; border: none; padding: 0; color: var(--color-primary-dark);
    text-decoration: underline; cursor: pointer; font: inherit;
}
.inline-form { display: inline; }

:where(a, button, input, select, summary):focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 3px;
}

.flash { padding: 0.75rem 1rem; border-radius: var(--radius-control); margin: 1rem 0; font-size: 0.9rem; }
.flash-success { background: #e4f6ea; color: #226b3d; }
.flash-error { background: #fbe6e9; color: #9b2d3f; }

.muted { color: var(--color-muted); }

.event-list { list-style: none; padding: 0; margin: 0; }
.event-list-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.25rem; margin-bottom: 0.75rem;
}

.tally-bar {
    display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--color-border);
}
.tally-bar-girl { background: var(--color-girl); }
.tally-bar-boy { background: var(--color-boy); }

/* Share widget (event manage page): a URL chip for visual confirmation /
   manual select-all, two primary pill actions (Copy, native Share), and a
   row of platform icons for one-tap sharing to a specific place. */
.share-widget { margin-top: 0.75rem; }

.share-link-display {
    display: flex; align-items: center; gap: 0.6rem;
    min-height: 2.75rem;
    background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-pill);
    padding: 0.55rem 1rem; margin-bottom: 1rem;
}
.share-link-icon { width: 1rem; height: 1rem; fill: var(--color-muted); flex-shrink: 0; }
.share-link-input {
    flex: 1; min-width: 0; border: none; background: transparent; padding: 0;
    font-size: 0.85rem; color: var(--color-text); text-overflow: ellipsis;
}
.share-link-input:focus { outline: none; }
.share-link-display:focus-within { border-color: var(--focus-color); box-shadow: var(--focus-ring); }

.share-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; border: none; border-radius: var(--radius-pill);
    padding: 0.65rem 1.25rem; font-size: 0.9rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.share-btn:hover { transform: translateY(-1px); }
/* Same dark-ink-on-blush treatment as the base .btn, and the same reason:
   white text here would be ~2.6:1 against --h-blush and fail contrast. */
.share-btn-primary { background: var(--color-primary); color: var(--h-night); }
.share-btn-primary:hover { background: var(--h-blush-hover); }
.share-btn-icon { display: inline-flex; width: 1.1rem; height: 1.1rem; position: relative; }
.share-btn-icon svg { width: 1.1rem; height: 1.1rem; fill: currentColor; position: absolute; inset: 0; transition: opacity 0.15s ease, transform 0.15s ease; }
.share-btn-icon .icon-done { opacity: 0; transform: scale(0.5); }
.share-btn.is-copied { background: #2f9e5c; }
.share-btn.is-copied .icon-default { opacity: 0; transform: scale(0.5); }
.share-btn.is-copied .icon-done { opacity: 1; transform: scale(1); }

.share-icons { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; position: relative; }
.share-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem; padding: 0; border-radius: var(--radius-pill); border: none;
    background: var(--color-surface); box-shadow: var(--shadow); color: var(--color-text);
    cursor: pointer; text-decoration: none; flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.share-icon-btn svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.share-icon-btn:hover { transform: translateY(-2px); }
.share-icon-whatsapp:hover { background: #25d366; color: #fff; }
.share-icon-facebook:hover { background: #1877f2; color: #fff; }
.share-icon-x:hover { background: #000; color: #fff; }
.share-icon-instagram:hover { background: #e4405f; color: #fff; }
.share-icon-email:hover { background: var(--color-text); color: #fff; }

.share-toast {
    font-size: 0.8rem; font-weight: 600; color: var(--color-primary-dark);
    opacity: 0; transform: translateY(-2px); transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
}
.share-toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 600px) {
    .share-btn { flex: 1; justify-content: center; }
}

/* Language switcher: a native <details>/<summary> disclosure — works with
   zero JS (the browser handles open/close and the links underneath are real
   navigations), styled to look like a proper dropdown. language-switcher.js
   only adds a "close when you click outside it" enhancement on top, since
   that's the one thing <details> doesn't give us for free. */
.lang-switcher { position: relative; font-size: 0.85rem; }
.lang-switcher-trigger {
    display: flex; align-items: center; gap: 0.4rem; cursor: pointer; list-style: none;
    min-height: 2.75rem; padding: 0.35rem 0.75rem; border-radius: var(--radius-pill); border: 1px solid var(--color-border);
    color: var(--color-text); user-select: none;
}
.lang-switcher-trigger::-webkit-details-marker { display: none; }
.lang-switcher-trigger::after {
    content: ''; width: 0.4rem; height: 0.4rem; margin-left: 0.1rem;
    border-right: 2px solid var(--color-muted); border-bottom: 2px solid var(--color-muted);
    transform: rotate(45deg); transition: transform 0.15s ease;
}
.lang-switcher[open] .lang-switcher-trigger::after { transform: rotate(-135deg); }
.lang-switcher-current { font-weight: 600; }
.lang-switcher-flag {
    width: 20px; height: 15px; object-fit: cover; border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); flex-shrink: 0; display: block;
}

.lang-switcher-menu {
    position: absolute; top: calc(100% + 0.4rem); inset-inline-end: 0; z-index: 40;
    display: flex; flex-direction: column; gap: 0.1rem;
    min-width: 200px; max-height: 320px; overflow-y: auto;
    background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 0.4rem;
}
.lang-switcher-option {
    display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.4rem 0.6rem; border-radius: var(--radius-control);
    color: var(--color-text); text-decoration: none; font-size: 0.85rem;
}
.lang-switcher-option:hover { background: var(--color-bg); }
.lang-switcher-option.is-active { background: var(--color-border); font-weight: 600; }

@media (max-width: 600px) {
    .lang-switcher-menu { inset-inline: 0 auto; }
}

/* Guest-facing pages. The vote-option styling moved to guest.css with the
   2026-08-15 redesign — it's rendered only on /e/{slug}, which is the only
   page that loads that file. What stays here is the scratch card's geometry,
   which is deliberately left where it was: see the warning at the top of
   guest.css. */

.reveal-stage {
    max-width: 760px; margin: 1.5rem auto; text-align: center;
}
.scratch-wrapper {
    position: relative; width: 100%; max-width: 720px; aspect-ratio: 3 / 4; margin: 1.5rem auto;
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.scratch-wrapper canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* The reveal result pops up as its own modal over everything (card, page,
   audio toggle) rather than replacing the scratch card in place — matches
   the reference app this feature was modeled on. */
.reveal-modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(32, 26, 41, 0.75);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    animation: reveal-modal-backdrop-in 0.25s ease;
}
/* The [hidden] attribute selector's specificity beats the bare-class rule
   above regardless of source order, so toggling `hidden` in JS reliably
   hides this — without it, the UA stylesheet's own [hidden]{display:none}
   loses the tie to the class rule's `display: flex` and the backdrop shows
   up empty on every page load. */
.reveal-modal-backdrop[hidden] { display: none; }
.reveal-modal {
    width: 100%; max-width: 380px;
    background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 2rem 1.75rem; text-align: center;
    animation: reveal-modal-pop-in 0.3s ease;
}
.reveal-modal-icon { font-size: 3.5rem; line-height: 1; margin-bottom: 0.5rem; }
.reveal-modal-heading { font-size: 1.8rem; font-weight: 800; margin: 0 0 0.5rem; }
.reveal-modal-heading.girl { color: var(--outcome-girl-text); }
.reveal-modal-heading.boy { color: var(--outcome-boy-text); }
.reveal-modal-message { font-size: 1.05rem; color: var(--color-text); margin: 0 0 1.5rem; }
.reveal-modal-close { width: 100%; }

@keyframes reveal-modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes reveal-modal-pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }

.tap-to-start-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(32, 26, 41, 0.75); color: #fff; font-size: 1.2rem; font-weight: 600;
    border-radius: var(--radius); cursor: pointer; text-align: center; padding: 1rem;
}

.audio-toggle {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
    width: 3rem; height: 3rem; border-radius: 999px; border: none;
    background: var(--color-surface); box-shadow: var(--shadow);
    font-size: 1.3rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Card-game templates size themselves from the template's own picture (see
   config/card_templates.php `image_width`/`image_height`, set inline as
   `aspect-ratio` per template) rather than the fixed 3:4 single-canvas
   shape above — the picture *is* the design, there's no CSS-generated
   background standing in for it (see CLAUDE.md, "Scratch-Card Templates
   (Games)"). */
.scratch-wrapper.card-game { aspect-ratio: auto; }
.card-game-instruction {
    max-width: 720px; margin: 0 auto 0.75rem; font-weight: 600; color: var(--color-muted);
    text-align: center; font-size: 1.05rem;
}

/* .card-zones fills the picture exactly (same box, no extra padding/inset)
   so each zone's top/left/width/height — percentages measured directly off
   the picture file, see config/card_templates.php — line up with where the
   artwork actually draws its scratchable shapes. */
.card-zones { position: absolute; inset: 0; }
.card-zone { position: absolute; transition: opacity 0.25s ease; }
/* Hearts unlock left-to-right as each prior one is fully scratched (see
   scratch-card.js) — dim the ones not reachable yet so it reads as "not
   yet available" instead of just being unresponsive. */
.card-zone.locked { opacity: 0.45; }
.card-zone.locked canvas { pointer-events: none; cursor: not-allowed; }
.card-zone--heart,
.card-zone--heart canvas {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
    -webkit-mask-position: center; mask-position: center;
}

/* The card-template picker's styles moved to event.css with its 2026-08-15
   redesign — it's rendered only on the create and manage pages, which are the
   only two that load that file. See "Event page design" in CLAUDE.md. */

.music-picker { display: flex; align-items: center; gap: 0.6rem; }
.music-picker select { width: auto; flex: 1; }
/* Same round icon-button look as .audio-toggle on the reveal page, minus the
   fixed positioning — this one sits inline next to the music select instead
   of floating over the card. */
.music-preview-btn {
    flex-shrink: 0;
    width: 3rem; height: 3rem; border-radius: 999px; border: none;
    background: var(--color-surface); box-shadow: var(--shadow);
    font-size: 1.3rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* The generic .hero band was removed on 2026-08-15. It was kept for the guest
   vote page, which no longer uses it; the only remaining `.hero` element is
   the landing page's, and home.css defines that one completely. */

@media (max-width: 600px) {
    .site-header-inner { flex-wrap: wrap; }
    .site-nav { width: 100%; justify-content: flex-start; gap: var(--space-3); }
    .form-row { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
