/* 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, #0c875e);
  --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 {
  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;
}

/* --- 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;
  }
}
