/* DETAILED — shared web styling for the public pages and the staff portal.
   Refined-minimal: near-black canvas, one restrained green, technical/mono
   accents echoing the wallet card. Design tokens first, then components. */

:root {
  color-scheme: dark;

  /* Canvas + surfaces (slightly green-warmed blacks for depth, not flat #000) */
  --bg: #0a0c0b;
  --surface: #121613;
  --surface-2: #171c18;
  --border: #262d28;
  --border-strong: #333c36;

  /* Ink */
  --text: #f3f6f4;
  --muted: #9aa49e;
  --faint: #6c756f;

  /* One brand green — matches the wallet card (rgb 108,186,74) */
  --brand: #6cba4a;
  --brand-bright: #86d264;
  --brand-ink: #08150a;   /* text on a green fill */
  --brand-glow: rgba(108, 186, 74, .16);
  --danger: #ff9b9b;

  --font-sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Sharp, architectural corners throughout (dots stay round; see .dot). */
  --r-sm: 0;
  --r: 0;
  --r-lg: 0;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .8);
  --ring: 0 0 0 3px var(--brand-glow);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* Floor at the primary design width (375px, spec FR-8.3): below this the whole
     page scrolls horizontally as a unit instead of squashing/clipping content
     (the brand lockup is ~325px wide and clips on narrower viewports). */
  min-width: 375px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: var(--bg);
  /* atmosphere: one soft green glow up top, never a flat field */
  background-image:
    radial-gradient(120% 80% at 50% -20%, var(--brand-glow), transparent 60%),
    radial-gradient(90% 60% at 50% 120%, rgba(255, 255, 255, .03), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}

/* faint film grain for a premium, non-digital surface */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  width: 100%;
  max-width: 27rem;
}
/* The welcome page scrolls (FR-8.3): opt this body out of the vertical
   centering the short pages and the staff portal keep, so a tall page grows
   downward instead of clipping above the fold. Everything else is untouched. */
body.page-scroll { justify-content: flex-start; }
.main--wide { max-width: 32rem; }

/* ---- Welcome page (signup__*) — scrolling public landing (FR-1, FR-8) --- */
.signup__hero { margin-bottom: 1.4rem; }
.signup__steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}
.signup__steps li { margin: .5rem 0; }

/* terms disclosure — an accordion that reads as a control, not a static notice */
.signup__terms {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  margin: 1.6rem 0;
}
.signup__terms > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .95rem 1.05rem;
  border-left: 3px solid var(--brand);
  transition: background .15s ease;
}
.signup__terms > summary::-webkit-details-marker { display: none; }
.signup__terms > summary::marker { content: ""; }
.signup__terms > summary:hover { background: var(--surface-2); }
.signup__terms > summary:focus-visible { outline: none; box-shadow: var(--ring); }
.signup__terms-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.signup__terms-title { font-weight: 700; }
/* the "VER TODO ⌄ / OCULTAR ⌃" cue — the affordance that makes it obviously tappable */
.signup__terms-cue {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex: none;
  color: var(--brand);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.signup__terms-cue-close { display: none; }
.signup__terms[open] .signup__terms-cue-open { display: none; }
.signup__terms[open] .signup__terms-cue-close { display: inline; }
.signup__terms-chevron {
  width: .48rem;
  height: .48rem;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s ease;
}
.signup__terms[open] .signup__terms-chevron { transform: translateY(1px) rotate(-135deg); }
.signup__terms > summary:hover .signup__terms-cue { color: var(--brand-bright); }
.signup__terms-key { color: var(--muted); font-size: .88rem; }
.signup__rules { margin: 0; padding: .2rem 1.05rem 1.05rem 2.4rem; }
.signup__rules li { margin: .35rem 0; color: var(--muted); font-size: .92rem; }

/* acceptance checkbox row */
.signup__accept {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-top: 1.4rem;
}
.signup__accept input {
  width: 1.15rem;
  height: 1.15rem;
  margin: .15rem 0 0;
  flex: none;
  accent-color: var(--brand);
}
.signup__accept label {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
}
.signup__recover { margin-top: 1rem; }

/* ---- Brand lockup ---------------------------------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 2rem;
}
.brand__mark { height: 42px; width: auto; display: block; }
.brand__sep { width: 1px; height: 38px; background: var(--border-strong); }
/* The venue lockup is a stacked square — mark above two lines of type — so it
   carries more height than the horizontal DETAILED wordmark beside it, or its
   type falls below legibility on a phone. Capped at 62px: the source artwork is
   119x131, so anything taller drops under 2x and softens on a retina screen.
   Raising this needs a larger original, not a bigger number. */
.brand__venue { height: 62px; width: auto; display: block; }

/* ---- Typography ------------------------------------------------------ */
h1 {
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 .6rem;
}
h2 {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2rem 0 .6rem;
}
p { margin: 0 0 1rem; }
.lead { color: var(--muted); font-size: 1rem; margin-bottom: 1.6rem; }
.muted { color: var(--muted); font-size: .9rem; }
.mono { font-family: var(--font-mono); letter-spacing: -0.02em; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-bright); }

/* ---- Panel (the content surface) ------------------------------------ */
.panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 0;
  padding: clamp(1.4rem, 5vw, 2rem);
  box-shadow: var(--shadow);
}

/* ---- Forms ----------------------------------------------------------- */
form { margin: 0; }
label {
  display: block;
  margin: 1.15rem 0 .4rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
label:first-of-type { margin-top: 0; }
/* Text inputs only — checkboxes/radios must not inherit the box chrome or the
   focus-ring transition (that transition on a toggled checkbox is what flickers). */
input:not([type="checkbox"]):not([type="radio"]), textarea {
  width: 100%;
  padding: .8rem .85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--faint); }
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

/* Native checkbox: brand-tinted, no text-input chrome, keyboard-only focus ring
   (no box-shadow/transition, so repeated clicking never flickers). */
input[type="checkbox"] {
  accent-color: var(--brand);
  cursor: pointer;
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- Buttons --------------------------------------------------------- */
button, .btn {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: .9rem 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  color: var(--brand-ink);
  background: var(--brand);
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
button:hover, .btn:hover { background: var(--brand-bright); box-shadow: 0 10px 24px -12px var(--brand-glow); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--ring); }
button.secondary, .secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
}
button.secondary:hover, .secondary:hover { background: var(--surface-2); border-color: var(--brand); box-shadow: none; }

/* ---- Notices & errors ------------------------------------------------ */
.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  padding: .8rem .9rem;
  margin: 0 0 1.4rem;
  font-size: .92rem;
}
.errorlist, .error {
  color: var(--danger);
  list-style: none;
  padding: 0;
  margin: .4rem 0 0;
  font-size: .88rem;
}

/* ---- Membership code chip ------------------------------------------- */
.code {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--brand);
  background: var(--brand-glow);
  border: 1px solid var(--border);
  padding: .1rem .45rem;
}

/* ---- Wallet badges (vendor artwork: never recolour/box/dim/distort) -- */
.wallet-badges { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin-top: 1.6rem; }
.wallet-badge { display: inline-block; margin: 8px; }
.wallet-badge img { display: block; height: 48px; width: auto; }
.wallet-badge:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }

/* ---- Optional email claim (secondary to the wallet buttons, FR-5) ---- */
.claim {
  margin-top: 2.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.claim h2 { margin-top: 0; font-size: 1rem; }
.claim__notice { font-size: .82rem; color: var(--faint); margin-top: 1rem; }

/* ---- QR (staff hand-off + customer) --------------------------------- */
.qr {
  background: #fff;
  padding: .9rem;
  border-radius: var(--r);
  display: flex;
  justify-content: center;
  margin: 1.4rem auto;
  width: fit-content;
}
.qr svg, .qr img { width: 100%; height: auto; max-width: 15rem; display: block; }

/* ---- Staff portal specifics ----------------------------------------- */
.topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.link { color: var(--brand); text-decoration: none; }
.separator { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1.25rem; }
.scanner { width: 100%; aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.results { list-style: none; padding: 0; margin: 1rem 0 0; }
.results li { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.logout { margin-top: 2.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* progress meter */
.progress { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 1.25rem 0 .35rem; }
.dot { width: .85rem; height: .85rem; border-radius: 50%; border: 1.5px solid var(--brand); }
.dot.filled { background: var(--brand); box-shadow: 0 0 10px -1px var(--brand-glow); }
.count { margin-left: .5rem; font-weight: 600; font-family: var(--font-mono); }
.reward { color: var(--brand); font-weight: 700; }

/* history ledger */
.history { list-style: none; padding: 0; margin: 0; }
.history li {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: .6rem;
  align-items: baseline;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.history time, .history .date { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; }
.history .pos { color: var(--brand); font-family: var(--font-mono); font-weight: 600; }
.history .neg { color: var(--danger); font-family: var(--font-mono); font-weight: 600; }

/* dialogs */
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  width: min(23rem, 92vw);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 6, 5, .72); backdrop-filter: blur(2px); }
dialog h2 { margin-top: 0; }
.dialog-status { margin: .8rem 0 0; font-weight: 600; }
.dialog-status.pending { color: var(--muted); }
.dialog-status.ok { color: var(--brand); }
.dialog-status.error { color: var(--danger); }

/* ---- Load reveal ----------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) backwards; }
main > *:nth-child(1) { animation-delay: .02s; }
main > *:nth-child(2) { animation-delay: .09s; }
main > *:nth-child(3) { animation-delay: .16s; }

@media (prefers-reduced-motion: reduce) {
  main > *, button, .btn, input,
  .signup__terms > summary, .signup__terms-chevron {
    animation: none !important;
    transition: none !important;
  }
}
