/* go.parkeze.com. The neutral tokens are reserve.parkeze.com's
   (src/tokens.css), so a guest who knew the old pages sees the same card and
   badge. The brand is the record's (logbook decision 26): the page sets
   --pkz-brand-primary, --pkz-brand-on-primary, --pkz-brand-primary-text and
   --pkz-brand-primary-dark on :root, and they are mapped here onto --brand
   (buttons, the pass's edge), --brand-fg (text on them) and --brand-link
   (links and focus: primary_text on light, primary_dark on dark). The
   fallbacks are Parkeze's record. System fonts only: nothing to download
   before the text shows. */

:root {
  --background: 210 20% 98%;
  --foreground: 222 47% 11%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 42%;
  --border: 214 32% 88%;
  --input: 214 32% 80%;
  --card: 0 0% 100%;
  --destructive: 0 72% 45%;
  --brand: var(--pkz-brand-primary, #10b981);
  --brand-fg: var(--pkz-brand-on-primary, #000000);
  --brand-link: var(--pkz-brand-primary-text, #0b8059);
  --radius: 12px;
  color-scheme: light dark;
}

/* A page whose operator logo has no dark version stays light (.light-only on
   <html>, set by the layout): the logo was drawn for a light background, and
   the page is the operator's. Every dark rule below is scoped the same way. */
:root.light-only {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-only) {
    --background: 222 47% 11%;
    --foreground: 210 40% 98%;
    --muted: 217 33% 17%;
    --muted-foreground: 215 20% 70%;
    --border: 217 33% 22%;
    --input: 217 33% 32%;
    --card: 222 47% 14%;
    --destructive: 0 84% 70%;
    --brand-link: var(--pkz-brand-primary-dark, #10b981);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: var(--brand-link);
}

:focus-visible {
  outline: 2px solid var(--brand-link);
  outline-offset: 2px;
}

.page {
  max-width: 28rem;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Header and footer --- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 0 20px;
}

.site-header picture {
  display: flex;
  min-width: 0;
}

/* The operator's wordmark leads the page, alone: its alt text is the name. */
.brand-wordmark {
  display: block;
  height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.brand-mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

/* A legacy record's logo is any shape; it keeps the mark's height. */
.brand-legacy {
  width: auto;
  max-width: 160px;
}

.site-name {
  font-size: 1.125rem;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-footer {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.site-footer a {
  color: hsl(var(--muted-foreground));
}

.support a,
.legal a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Parkeze's signature: the mark at the text's height and the words, muted,
   never larger than the operator's identity, and shown on phones too. */
.powered-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.powered-by:hover {
  text-decoration: underline;
}

.powered-by-mark {
  width: 1.25em;
  height: 1.25em;
  object-fit: contain;
}

/* --- Cards --- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 16px;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.muted {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

.message h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.message p + p,
.message p + form {
  margin-top: 12px;
}

.message p {
  color: hsl(var(--muted-foreground));
}

/* --- The pass --- */

.pass {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pass.is-inactive .primary-value,
.pass.is-inactive .fields dd {
  color: hsl(var(--muted-foreground));
}

.pass-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pass-head h1 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.badge {
  flex-shrink: 0;
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.tone-positive { background: #dcfce7; color: #166534; }
.tone-warning { background: #fef3c7; color: #92400e; }
.tone-negative { background: #fee2e2; color: #b91c1c; }
.tone-neutral { background: #f1f5f9; color: #475569; }

@media (prefers-color-scheme: dark) {
  :root:not(.light-only) .tone-positive { background: #14532d; color: #bbf7d0; }
  :root:not(.light-only) .tone-warning { background: #78350f; color: #fde68a; }
  :root:not(.light-only) .tone-negative { background: #7f1d1d; color: #fecaca; }
  :root:not(.light-only) .tone-neutral { background: #334155; color: #e2e8f0; }
}

.label,
.fields dt,
.back-fields dt {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.primary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.primary-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.fields dd,
.back-fields dd {
  font-size: 0.9375rem;
  font-weight: 500;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.back-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.back-fields dd {
  font-weight: 400;
}

.barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

/* The symbol keeps a white field in dark mode too: scanners need the contrast. */
.qr {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  border-radius: 8px;
  background: #ffffff;
}

.barcode-text {
  font: 600 1.125rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  text-align: center;
}

.barcode figcaption {
  font: 0.875rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: hsl(var(--muted-foreground));
  text-align: center;
  overflow-wrap: anywhere;
}

/* --- Notices and announcements --- */

.notice {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.9375rem;
}

.notice-negative {
  border-color: hsl(var(--destructive) / 0.4);
  background: hsl(var(--destructive) / 0.08);
}

.announcements {
  border: 1px solid color-mix(in srgb, var(--brand-link) 30%, transparent);
  background: color-mix(in srgb, var(--brand-link) 6%, transparent);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.announcement > .icon {
  margin-top: 3px;
  color: var(--brand-link);
}

.announcement-text {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
}

.announcement-subject {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.announcement-body {
  color: hsl(var(--muted-foreground));
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.announcement-until {
  margin-top: 2px;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.announcements-more {
  display: flex;
  flex-direction: column;
}

.announcements-more summary {
  margin-left: 26px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-link);
  cursor: pointer;
}

.announcements-more[open] summary {
  margin-bottom: 10px;
}

.announcements-more .announcement + .announcement {
  margin-top: 10px;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.icon-button {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -6px -6px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.icon-button:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* --- The form --- */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-card > .muted {
  margin: -6px 0 14px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.required {
  color: hsl(var(--destructive));
}

.optional {
  font-weight: 400;
  color: hsl(var(--muted-foreground));
}

.field input,
.field select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid hsl(var(--input));
  border-radius: 8px;
  background: hsl(var(--background));
  color: inherit;
  /* 16px keeps iOS Safari from zooming in on focus. */
  font: inherit;
  font-size: 16px;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--brand-link);
  outline-offset: 0;
  border-color: transparent;
}

.field input.plate {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.field input.plate::placeholder {
  text-transform: none;
}

.hint {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.error {
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--destructive));
}

.has-error input,
.has-error select {
  border-color: hsl(var(--destructive));
}

.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid hsl(var(--destructive) / 0.4);
  border-radius: 8px;
  background: hsl(var(--destructive) / 0.08);
  font-size: 0.875rem;
}

.alert:focus {
  outline: 2px solid hsl(var(--destructive));
  outline-offset: 2px;
}

/* --- The flow: the summary, then one screen per step --- */

/* The form's first submit button, there only so Enter in a field continues
   (src/render/pass.ts): rendered, so every browser presses it, but unseen. */
.default-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.flow,
.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.next-card h2 {
  font-size: 1.0625rem;
  margin-bottom: 4px;
}

.next-card .muted {
  margin-bottom: 16px;
}

.next-card h2 + .button {
  margin-top: 12px;
}

/* The issuer's note for the guest, on the summary's card. */
.note {
  padding: 12px;
  border-radius: 8px;
  background: hsl(var(--muted));
}

.note-text {
  margin-top: 2px;
  font-size: 0.9375rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.step-card {
  padding: 20px 16px;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.progress-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.progress-bar {
  display: flex;
  gap: 6px;
}

.progress-bar span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: hsl(var(--border));
}

.progress-bar span.done {
  /* The readable brand: the primary on light, primary_dark on dark. */
  background: var(--brand-link);
}

.card h2.step-title {
  font-size: 1.375rem;
  line-height: 1.25;
  margin-bottom: 6px;
}

.step-title:focus {
  outline: none;
}

.step-description {
  margin-bottom: 20px;
}

.step-title + .form,
.step-title + .alert {
  margin-top: 16px;
}

.flow-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 10px;
}

.notice-positive {
  border-color: #86efac;
  background: #f0fdf4;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-only) .notice-positive {
    border-color: #166534;
    background: #052e16;
  }
}

/* A screen slides in from the side it comes from: forward from the right,
   and from the left when the script marks a step back. */
@media (prefers-reduced-motion: no-preference) {
  .screen {
    animation: screen-in 0.22s ease-out;
  }

  .flow.is-back .screen {
    animation-name: screen-back;
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@keyframes screen-back {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}

/* --- Pickers --- */

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

fieldset.field legend {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
}

/* The box behind Other shows once Other is chosen: by the class the Worker
   and the script set, and by :has() where a browser without the script
   supports it. One that supports neither shows it always, which still works. */
.other {
  display: none;
  margin-top: 10px;
}

.field.is-other .other,
.field:has(option[value='__other__']:checked) .other,
.field:has(input[value='__other__']:checked) .other {
  display: block;
}

@supports not selector(:has(a)) {
  .other {
    display: block;
  }
}

.other label {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 8px;
}

.swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* The radio stays in the page for keyboards and screen readers; the chip is what shows. */
.swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px hsl(var(--input));
  color: #ffffff;
}

.swatch-light .swatch-chip {
  color: #111111;
}

.swatch-chip > svg:first-child {
  width: 100%;
  height: 100%;
}

.swatch-empty {
  fill: none;
  stroke: hsl(var(--muted-foreground));
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.swatch-plus {
  stroke: hsl(var(--muted-foreground));
  stroke-width: 2;
  stroke-linecap: round;
}

.swatch-check {
  position: absolute;
  width: 20px;
  height: 20px;
  display: none;
}

.swatch input:checked + .swatch-chip {
  box-shadow: 0 0 0 2px hsl(var(--card)), 0 0 0 4px var(--brand-link);
}

.swatch input:checked + .swatch-chip .swatch-check {
  display: block;
}

/* Other's chip has nothing to tick: its plus turns to the brand's color. */
.swatch input[value='__other__']:checked + .swatch-chip .swatch-check {
  display: none;
}

.swatch input[value='__other__']:checked + .swatch-chip .swatch-plus {
  stroke: var(--brand-link);
}

.swatch input:focus-visible + .swatch-chip {
  outline: 2px solid var(--brand-link);
  outline-offset: 4px;
}

.swatch-label {
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  color: hsl(var(--muted-foreground));
  overflow-wrap: anywhere;
}

.swatch input:checked ~ .swatch-label {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.has-error .swatch-chip {
  box-shadow: 0 0 0 1px hsl(var(--destructive));
}

/* A searchable list, as the script draws it over the plain select. */
.combo {
  position: relative;
}

.combo input[type='search'] {
  padding-right: 40px;
}

.combo input[type='search']::-webkit-search-cancel-button {
  display: none;
}

.combo-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.combo-toggle svg {
  width: 16px;
  height: 16px;
}

.combo-list {
  margin: 6px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 264px;
  overflow-y: auto;
  border: 1px solid hsl(var(--input));
  border-radius: 10px;
  background: hsl(var(--card));
  -webkit-overflow-scrolling: touch;
}

.combo-option {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.combo-option.is-active {
  background: hsl(var(--muted));
}

.combo-option[aria-selected='true'] {
  font-weight: 600;
  color: var(--brand-link);
}

.combo-option[aria-selected='true']::after {
  content: '';
  flex-shrink: 0;
  width: 12px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}

.combo-other {
  color: hsl(var(--muted-foreground));
}

.combo-empty {
  padding: 10px 12px;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* --- Buttons --- */

.button,
.wallet-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button-brand {
  border: 0;
  background: var(--brand);
  color: var(--brand-fg);
}

.button-brand:hover {
  filter: brightness(0.95);
}

.button-brand[aria-disabled='true'] {
  opacity: 0.6;
  cursor: progress;
}

.button-secondary {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
}

.button-secondary:hover {
  background: hsl(var(--muted));
}

.message .button-secondary {
  width: auto;
  display: inline-flex;
}

.wallet,
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Black, as both providers' own badges are, and with a light edge in dark mode. */
.wallet-button {
  border: 1px solid #000000;
  background: #000000;
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-only) .wallet-button {
    border-color: hsl(0 0% 100% / 0.35);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .wallet-button,
  .icon-button {
    transition: background-color 0.15s, filter 0.15s;
  }
}

/* --- The pay pages (decision 74) --- */

.pay .form {
  margin: 16px 0;
}

.field legend {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  padding: 0;
}

fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
}

.field input.short {
  max-width: 6em;
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 8em;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5em, 1fr));
  gap: 8px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  cursor: pointer;
  background: hsl(var(--card));
}

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--brand-link);
  outline-offset: 2px;
}

.choice-label {
  font-weight: 600;
}

.choice-price {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}

.fees {
  margin: 16px 0 0;
}

.fee {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid hsl(var(--border));
}

.fee dt,
.fee dd {
  margin: 0;
}

.fee-total {
  border-bottom: 0;
  font-weight: 700;
  font-size: 18px;
  padding-top: 10px;
}

.quote-what {
  margin: 12px 0 0;
}

.card-frame {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  margin: 12px 0 4px;
  background: transparent;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
  font-size: 15px;
}

.cf-turnstile {
  margin: 12px 0;
}

.small {
  font-size: 13px;
}
