/* Faire Market's design tokens: the Garden palette, Nunito, and Cinzel. See docs/brand/README.md.
   Organization palettes (palettes.css) override --primary, --primary-soft, --action, and --highlight. */

:root {
  --primary: #1F4E79;
  --primary-soft: #DDE8F2;
  --action: #3F7D2E;
  --brand-green: #5BA145;
  --success: #386F29;
  --success-soft: #E3F0DC;
  --highlight: #F2C230;
  --highlight-soft: #FBEDB8;
  --giving: #7A3B69;
  --giving-soft: #EBDCE6;
  --danger: #A8432F;
  --danger-soft: #F6DDD5;
  --warning: #8A5A00;
  --warning-soft: #FBEDB8;
  --page: #FAF7F0;
  --surface: #FFFFFF;
  --panel: #F3EEE3;
  --ink: #22313F;
  --muted: #6B6358;
  --line: #E7E2D6;
  --field-border: #CFC6B4;
  --radius: 8px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Cinzel", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-family: var(--font); color: var(--ink); background: var(--page); font-size: 16px; line-height: 1.5; }
body { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; }
/* Cinzel, for Faire Market's own short headlines on public pages. Never for names people type. */
.display { font-family: var(--display); font-weight: 800; color: var(--primary); letter-spacing: .02em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.code { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; letter-spacing: .08em; }
.right { text-align: right; }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Banner image strips and event-card thumbnails on public pages */
.banner-strip { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: var(--radius); }
.banner-strip.compact { max-height: 140px; }
.event-card-thumb { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: calc(var(--radius) - 2px); margin-bottom: .5rem; }
.event-card h3, .event-card p { margin: 0 0 .25rem; }

.container { max-width: 960px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding-top: .75rem; padding-bottom: .75rem; gap: 1rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a.active { font-weight: 600; color: var(--ink); }
.find-ticket { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .9rem; }
.find-ticket:hover { text-decoration: none; }
.brand { display: block; flex: none; }
.brand-logo { display: block; height: 40px; width: auto; }
@media (max-width: 560px) { .brand-logo { height: 32px; } }
/* Signed-in name in the admin top bar, opening Your profile and Sign out. */
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; color: var(--primary); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu[open] summary { color: var(--ink); }
.account-menu-items { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 10; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem;
  padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 12px rgb(0 0 0 / .08); white-space: nowrap; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2rem; }

.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--line); font-weight: 600; }
.flash-notice { background: var(--success-soft); color: var(--success); }
.flash-alert { background: var(--danger-soft); color: var(--danger); }

label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.hint-warning { color: var(--warning); font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--field-border); border-radius: var(--radius);
  font: inherit; color: var(--ink); background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 6rem; }
.field { margin-bottom: 1rem; }
.field-inline { display: flex; gap: .5rem; align-items: center; }
.field-inline label { margin: 0; }
/* A .revealed part shows only while the .reveal's checkbox is ticked. */
.reveal:not(:has(input[type=checkbox]:checked)) .revealed { display: none; }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.errors ul { margin: .25rem 0 0; padding-left: 1.25rem; }

/* :where() keeps this at a single class's weight, so .btn-secondary and
   .btn-danger also restyle <button> and <input type=submit>. */
.btn, :where(button.btn, input[type=submit]) {
  display: inline-block; padding: .6rem 1rem; border-radius: var(--radius); border: 1px solid var(--action);
  background: var(--action); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--field-border); }
.btn-secondary:hover { background: var(--panel); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--action); border-color: var(--action); }
.btn-lg { padding: .9rem 1.4rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn svg { vertical-align: -3px; margin-right: .35rem; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.link-button { background: none; border: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
form.inline { display: inline; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--line); color: var(--ink); white-space: nowrap; }
.badge-registered, .badge-paid, .badge-published { background: var(--primary-soft); color: var(--primary); }
.badge-checked_in, .badge-fulfilled, .badge-handed_over, .badge-ok { background: var(--success-soft); color: var(--success); }
.badge-void, .badge-canceled, .badge-refunded, .badge-rejected, .badge-not_found { background: var(--danger-soft); color: var(--danger); }
.badge-pending, .badge-draft { background: var(--warning-soft); color: var(--warning); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
/* A book's numbers, laid out like its tally card. */
.tally-grid { display: grid; gap: .25rem; margin-bottom: 1rem; }
.tally-cell { background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem .25rem; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; cursor: pointer; }
.tally-cell.fixed { background: var(--panel); cursor: default; }
.tally-cell .reason { font-size: .7rem; line-height: 1.2; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .8rem; }

.ticket { border: 2px solid var(--ink); border-radius: 12px; padding: 1.5rem; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; }
.ticket svg { display: block; }
@media (max-width: 560px) { .ticket { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* The ticket mockup mirrors the printed ticket: dark band, details left, QR and code right. */
.ticket-mockup { --band: #1f3a34; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; gap: 1.25rem; align-items: center; border: 1px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; padding-right: 1.25rem; position: relative; }
.ticket-band { background: var(--band); align-self: stretch; }
.ticket-details { padding: 1rem 0; }
.ticket-details p { margin: 0 0 .3rem; font-size: .9rem; }
.ticket-org { font-size: .75rem !important; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ticket-event { font-size: 1.5rem; margin: 0 0 .4rem; }
.ticket-holder { margin-top: .75rem !important; padding-top: .6rem; border-top: 1px dashed var(--line); }
.ticket-qr { text-align: center; padding: 1rem 0; }
.ticket-qr svg { display: block; margin: 0 auto; }
.ticket-code { font-family: var(--mono); font-weight: 700; font-size: .9rem; margin: .4rem 0 0; }
.ticket-side { display: grid; gap: .5rem; justify-items: start; align-content: center; min-width: 7rem; max-width: 10rem; }
.ticket-add-ons { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.ticket-add-ons:empty, .ticket-paid:empty, .ticket-side:not(:has(:not(:empty))) { display: none; }
.price-paid { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; vertical-align: .1em; background: var(--success-soft); color: var(--success); }
.ticket-paid { padding: .1rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--success-soft); color: var(--success); }
.ticket-mockup.is-void { --band: var(--danger); }
.ticket-mockup.is-void .ticket-details, .ticket-mockup.is-void .ticket-qr { text-decoration: line-through; opacity: .55; }
.ticket-mockup.is-void .ticket-paid { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 640px) {
  .ticket-mockup { grid-template-columns: minmax(0, 1fr); padding: 0 1rem 0 calc(14px + 1rem); gap: 0; }
  .ticket-band { position: absolute; left: 0; top: 0; bottom: 0; width: 14px; }
  .ticket-side { max-width: none; padding-bottom: 1rem; }
}
@media print {
  body * { visibility: hidden; }
  .ticket-mockup, .ticket-mockup * { visibility: visible; }
  .ticket-mockup { position: absolute; left: 0; top: 0; width: 5.5in; min-height: 2in; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ticket-event { font-size: 13pt; }
  .no-print { display: none !important; }
}

.tagline { font-size: 1.25rem; max-width: 40rem; margin: .5rem 0; }
.code-box { margin: 1rem 0 2rem; }
.code-box button.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--field-border); }
.code-box button.btn-secondary:hover { background: var(--panel); }
.viewfinder { max-width: 520px; display: grid; gap: .5rem; justify-items: start; }
.viewfinder video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
[hidden] { display: none !important; }

.lookup-form { display: flex; gap: .5rem; max-width: 520px; }
.lookup-form input { font-family: var(--mono); font-size: 1.15rem; text-transform: uppercase; letter-spacing: .08em; flex: 1; min-width: 0; }
@media (max-width: 560px) { .hero h1 { font-size: 1.6rem; } }

.product { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.product:last-child, .product:has(+ .checkout[hidden]) { border-bottom: none; }
.product .price { font-weight: 600; }
.qty { width: 5rem; text-align: center; }
.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; font-size: 1.15rem; font-weight: 700; }
/* Event page: Buy now turns into a stepper once chosen (cart controller); the checkout follows the list. */
.buy-now .btn { min-width: 7.5rem; }
.buy-now .add-on-stepper { gap: .5rem; }
.buy-now .add-on-step { flex: none; }
.buy-now .qty { width: 3.5rem; appearance: textfield; -moz-appearance: textfield; }
.buy-now .qty::-webkit-inner-spin-button, .buy-now .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.checkout { margin-top: 1rem; }
.checkout h3 { margin: 0 0 .75rem; }
.donate > summary { list-style: none; }
.donate > summary::-webkit-details-marker { display: none; }
.donate[open] > summary { display: none; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters a { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: .875rem; }
.filters a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { display: flex; gap: .5rem; }

/* Scanner */
.scanner { display: grid; gap: 1rem; grid-template-columns: minmax(0, 420px) 1fr; }
@media (max-width: 760px) { .scanner { grid-template-columns: 1fr; } }
.viewfinder { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1 / 1; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder canvas { display: none; }
.viewfinder .reticle { position: absolute; inset: 15%; border: 3px solid rgba(255,255,255,.8); border-radius: 12px; pointer-events: none; }
.scan-result { min-height: 200px; }
.scan-result.ok { border-color: var(--success); background: var(--success-soft); }
.scan-result.warn { border-color: var(--warning); background: var(--warning-soft); }
.scan-result.bad { border-color: var(--danger); background: var(--danger-soft); }
.scan-result h2 { font-size: 1.5rem; }
.scan-result .code { font-size: 1.2rem; }

/* Add-on cards on the ticket page */
.add-on-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.add-on-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: .75rem; min-height: 9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.add-on-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.add-on-card h3 { margin: 0 0 .25rem; }
.add-on-card .price { font-weight: 600; color: var(--muted); }
.add-on-card p { margin: 0 0 .25rem; }
.add-on-stepper { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.add-on-count { min-width: 1.5rem; text-align: center; font-weight: 700; font-size: 1.1rem; }
.add-on-hover .btn { width: 100%; }
.add-on-pay { margin-top: .25rem; }
.ticket-add-ons li.is-selected, .ticket-add-ons li.is-pending { color: var(--primary); font-style: italic; }
.ticket-paid.is-pending { background: var(--warning-soft); color: var(--warning); }
/* On pointer devices the single "Add to ticket" button shows on hover or focus; touch screens always see it. */
@media (hover: hover) {
  .add-on-hover { opacity: 0; transition: opacity .15s; }
  .add-on-card:hover .add-on-hover, .add-on-card:focus-within .add-on-hover, .add-on-card.is-selected .add-on-hover { opacity: 1; }
}
.add-on-step { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--field-border); background: var(--surface); color: var(--ink); font: inherit; font-size: 1.25rem; font-weight: 600; line-height: 1; cursor: pointer; }
.add-on-step:hover:not([disabled], [aria-disabled=true]) { background: var(--primary-soft); border-color: var(--primary); }
.add-on-step[disabled], .add-on-step[aria-disabled=true] { opacity: .4; cursor: not-allowed; }

/* Landing page: events bar, hero, one feature per row, closing call to action. */
.events-bar { background: var(--highlight); font-size: .9rem; font-weight: 700; }
.events-bar .container { padding-top: .4rem; padding-bottom: .4rem; }
.events-bar a { color: var(--ink); }
.landing-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 2rem; padding: 2.5rem 0 2rem; }
.landing-hero-text { flex: 1 1 22rem; }
.landing-hero h1 { font-size: 2.1rem; }
.landing-hero .lede { font-size: 1.1rem; color: var(--muted); }
.landing-hero-art { flex: 1 1 16rem; display: flex; justify-content: center; }
.landing-hero-art svg, .feature-art svg { max-width: 100%; height: auto; }
.landing-note { margin-top: .75rem; }
.feature { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2rem; padding: 1.75rem 0; border-top: 1px solid var(--line); }
.feature.flip { flex-direction: row-reverse; }
.feature-art { flex: 0 0 200px; display: flex; justify-content: center; }
.feature-text { flex: 1 1 18rem; }
.feature-text h2 { color: var(--primary); font-size: 1.35rem; }
.feature-text p { color: var(--muted); margin: 0; }
.landing-close { text-align: center; padding: 2.5rem 0; border-top: 1px solid var(--line); }
.landing-close h2 { font-size: 1.5rem; }
.landing-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .landing-hero h1 { font-size: 1.6rem; }
  .feature, .feature.flip { flex-direction: column; align-items: flex-start; }
  .feature-art, .feature-text { flex: none; }
  .feature-art { align-self: center; }
}

/* Shades mixed from the tokens, so an organization palette gets matching hovers and borders.
   Safari before 16.2 drops any declaration that mixes colors, so these only apply where mixing is supported;
   older browsers keep the plain colors above. */
@supports (color: color-mix(in srgb, red, red)) {
  .btn:hover, .btn-success:hover { background: color-mix(in srgb, var(--action) 85%, black); }
  .btn-secondary:hover { background: var(--panel); }
  .btn-danger { border-color: color-mix(in srgb, var(--danger) 40%, white); }
  .btn-danger:hover { background: var(--danger-soft); }
  .find-ticket:hover { background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary)); }
  .flash { border-color: color-mix(in srgb, currentColor 25%, transparent); }
}
