/* EHub customer portal — shared styles for every /renew page.
   Page-specific tweaks stay inline in routes/renew.mjs. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #fe7b0b;
  --primary-dark: #e56c00;
  --primary-light: #fff3e6;
  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --error-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Surfaces + status colours (all flip in dark mode below) */
  --page-bg: #e8e8e8;
  --surface: #ffffff;
  --surface-raised: rgba(255,255,255,0.98);
  --surface-glass: rgba(255,255,255,0.95);
  --card-ring: rgba(255,255,255,0.8);
  --city-fade: rgba(232, 232, 232, 0.5);
  --primary-light-hover: #ffe6cc;
  --info-bg: #dbeafe;  --info-fg: #1e40af;  --info-border: #93c5fd;
  --warning-fg: #92400e;  --warning-border: #fcd34d;
  --error-fg: #991b1b;  --error-border: #fca5a5;  --error-strong: #dc2626;  --error-soft-fg: #7f1d1d;  --error-soft-border: #fecaca;
  --success-fg: #065f46;  --success-border: #6ee7b7;
  --pickup-bg: #fff7ed;  --pickup-border: #fb923c;  --pickup-fg: #9a3412;  --pickup-strong: #7c2d12;  --pickup-chip: rgba(255,255,255,0.5);
  color-scheme: light dark;
}

/* ═══ DARK MODE — follows the phone/computer setting automatically ═══
   The grey scale flips (backgrounds dark, text light); the council
   orange, the photo banner and orange title bars stay as they are. */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #161a22;
    --gray-100: #1d222c;
    --gray-200: #2a303c;
    --gray-300: #3a4150;
    --gray-400: #6b7385;
    --gray-500: #9aa2b2;
    --gray-600: #b4bbc8;
    --gray-700: #cfd4dd;
    --gray-800: #e3e6ec;
    --gray-900: #f3f4f7;
    --page-bg: #0b0d12;
    --surface: #12151c;
    --surface-raised: rgba(18,21,28,0.98);
    --surface-glass: rgba(18,21,28,0.92);
    --card-ring: rgba(255,255,255,0.06);
    --city-fade: rgba(11, 13, 18, 0.55);
    --primary-light: rgba(254,123,11,0.16);
    --primary-light-hover: rgba(254,123,11,0.26);
    --success-light: rgba(16,185,129,0.16);
    --error-light: rgba(239,68,68,0.15);
    --warning-light: rgba(245,158,11,0.15);
    --info-bg: rgba(59,130,246,0.16);  --info-fg: #93c5fd;  --info-border: rgba(147,197,253,0.35);
    --warning-fg: #fcd34d;  --warning-border: rgba(252,211,77,0.35);
    --error-fg: #fca5a5;  --error-border: rgba(252,165,165,0.35);  --error-strong: #f87171;  --error-soft-fg: #fecaca;  --error-soft-border: rgba(254,202,202,0.25);
    --success-fg: #6ee7b7;  --success-border: rgba(110,231,183,0.35);
    --pickup-bg: rgba(251,146,60,0.12);  --pickup-border: rgba(251,146,60,0.5);  --pickup-fg: #fdba74;  --pickup-strong: #fed7aa;  --pickup-chip: rgba(0,0,0,0.25);
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--page-bg);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
}

/* Animated City Canvas */
#cityCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
/* Loading overlay - update these styles */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
}
.loading-overlay.show {
  display: flex;
}

.city-fade {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--city-fade) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Header */
.portal-header {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 3px solid var(--primary);
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.portal-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(254, 123, 11, 0.3);
}

.portal-logo svg { width: 20px; height: 20px; fill: white; }
/* Council seal (public/img/owtc-seal.png) replaces the old orange tile */
.portal-logo { width: 40px; height: 40px; background: none; box-shadow: none; border-radius: 50%; flex-shrink: 0; }
.portal-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
@media (max-width: 480px) { .portal-logo { width: 36px; height: 36px; } }

.portal-title { flex: 1; }
.portal-title h1 { font-size: 14px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.3px; }
.portal-title span { font-size: 11.5px; color: var(--gray-500); }

/* Main container */
.portal-container {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Card with flip animation */
.flip-container {
  perspective: 1200px;
  width: 100%;
  max-width: 420px;
}

.flip-card {
  position: relative;
  width: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-front, .flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform: rotateY(180deg);
  background: var(--surface-raised);
  border-radius: 24px;
}

/* Premium Card */
.portal-card {
  background: var(--surface-raised);
  border-radius: 24px;
  box-shadow:
    0 25px 50px -12px rgba(0,0,0,0.15),
    0 0 0 1px var(--card-ring) inset;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 18px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20%, 20%); }
}

.card-header h2 { font-size: 18px; font-weight: 700; margin-bottom: 3px; position: relative; letter-spacing: -0.5px; }
.card-header p { font-size: 13px; opacity: 0.9; position: relative; }
.card-body { padding: 20px; }

/* Steps indicator */
.steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(to bottom, var(--gray-50), var(--surface));
}
.step {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.step.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  width: 26px;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(254, 123, 11, 0.4);
}
.step.completed {
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Form elements */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.form-hint { font-size: 11.5px; color: var(--gray-500); margin-top: 6px; }

/* License number field ("OW-" + digits) reads as ONE field: a single
   border and focus ring on the group, a thin divider after the prefix.
   (Separate borders on each part got clipped at the rounded corners.) */
.input-group {
  display: flex;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), 0 4px 12px rgba(0,0,0,0.08);
}
.input-prefix {
  background: var(--gray-100);
  border-right: 1.5px solid var(--gray-200);
  padding: 11px 13px;
  font-weight: 700;
  color: var(--primary);
  font-size: 15px;
  display: flex;
  align-items: center;
  transition: border-color 0.2s;
}
.input-group:focus-within .input-prefix { border-right-color: var(--primary-light-hover); }
.input-group .input-field { border: none; border-radius: 0; min-width: 0; }
.input-group .input-field:focus { box-shadow: none; }
.input-field {
  flex: 1;
  border: 2px solid var(--gray-200);
  padding: 11px 13px;
  font-size: 15px;
  transition: all 0.2s;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--gray-900);
}
.input-field.full {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), 0 4px 12px rgba(0,0,0,0.08);
}
.input-field::placeholder { color: var(--gray-400); }

/* PIN input */
.pin-inputs { display: flex; gap: 10px; justify-content: center; }
.pin-digit {
  width: 46px;
  height: 54px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  transition: all 0.2s;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.pin-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: -0.2px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 8px 24px rgba(254, 123, 11, 0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(254, 123, 11, 0.45);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.btn-secondary:hover {
  background: var(--gray-200);
  transform: translateY(-2px);
}

/* Year selector */
.year-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.year-option { position: relative; }
.year-option input { position: absolute; opacity: 0; pointer-events: none; }
.year-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.year-option label:hover {
  border-color: var(--gray-300);
  transform: translateY(-2px);
}
.year-option label span:first-of-type { font-size: 21px; font-weight: 700; color: var(--gray-800); }
.year-option label span:nth-of-type(2) { font-size: 10px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.year-option label span:last-of-type { font-size: 12px; color: var(--primary); font-weight: 600; margin-top: 3px; }
.year-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 8px 24px rgba(254, 123, 11, 0.2);
  transform: translateY(-2px);
}
.year-option input:checked + label span:first-of-type { color: var(--primary); }

/* Summary */
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total {
  font-weight: 700;
  font-size: 16px;
  color: var(--gray-900);
  padding-top: 12px;
  border-top: 2px solid var(--gray-200);
  margin-top: 12px;
}
.summary-label { color: var(--gray-600); }
.summary-value { font-weight: 600; color: var(--gray-800); }

/* Bank info */
.bank-info {
  background: linear-gradient(135deg, var(--gray-50), var(--surface));
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0;
  border: 1px solid var(--gray-200);
}
.bank-info-title {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.bank-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12.5px; }
.bank-label { color: var(--gray-500); }
.bank-value { font-weight: 600; color: var(--gray-800); font-family: 'SF Mono', Monaco, monospace; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: linear-gradient(135deg, var(--gray-50), var(--surface));
}
.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}
.upload-area.has-file {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-light);
}
.upload-icon { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--gray-400); }
.upload-area.has-file .upload-icon { color: var(--success); }
.upload-text { font-size: 13px; color: var(--gray-600); }
.upload-text strong { color: var(--primary); }
.upload-preview { max-width: 200px; max-height: 150px; margin: 16px auto; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Alerts */
.alert {
  padding: 11px 13px;
  border-radius: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.alert-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--warning-light); color: var(--warning-fg); border: 1px solid var(--warning-border); }
.alert-error { background: var(--error-light); color: var(--error-fg); border: 1px solid var(--error-border); }
.alert-success { background: var(--success-light); color: var(--success-fg); border: 1px solid var(--success-border); }
.alert-info { background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-border); }
.alert-pickup { background: var(--pickup-bg); color: var(--pickup-fg); border: 1px solid var(--pickup-border); }

/* Infraction card */
.infraction-card {
  background: var(--error-light);
  border: 1px solid var(--error-soft-border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.infraction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.infraction-number { font-weight: 600; color: var(--error-fg); }
.infraction-amount { font-weight: 700; color: var(--error-strong); }
.infraction-details { font-size: 12px; color: var(--error-soft-fg); }

/* Success screen */
.success-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--success), #059669);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.4);
}
@keyframes successPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.success-icon svg { width: 30px; height: 30px; color: white; }

.reference-number {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin: 16px 0;
  border: 1px solid var(--gray-200);
}
.reference-number label { display: block; font-size: 11px; color: var(--gray-500); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.reference-number strong { font-size: 19px; font-family: 'SF Mono', Monaco, monospace; color: var(--gray-800); }

/* Loading spinner */
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Profile display */
.profile-display {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--gray-50), var(--surface));
  border-radius: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.profile-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(254, 123, 11, 0.3);
}
.profile-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.profile-name { font-weight: 700; font-size: 15px; color: var(--gray-800); }
.profile-license { font-size: 13px; color: var(--primary); font-weight: 600; }
.profile-meta { font-size: 11.5px; color: var(--gray-500); margin-top: 2px; }

/* Footer */
.portal-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 14px;
  color: var(--gray-500);
  font-size: 11.5px;
}
.portal-footer a { color: var(--primary); text-decoration: none; }

.footer-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--gray-400);
  font-size: 11px;
}
.footer-secure svg { width: 14px; height: 14px; fill: var(--success); }

/* Responsive — phones (incl. ~448px-wide devices). Keep the card
   top-aligned + scrollable so tall content is never clipped off-screen,
   and tighten spacing so more fits without scrolling. */
@media (max-width: 480px) {
  .portal-container { padding: 12px 10px; min-height: 0; justify-content: flex-start; }
  .portal-header { padding: 8px 12px; }
  .portal-title h1 { font-size: 13.5px; }
  .portal-title span { font-size: 11px; }
  .card-header { padding: 14px 16px; }
  .card-header h2 { font-size: 16.5px; }
  .card-header p { font-size: 12.5px; }
  .card-body { padding: 16px; }
  .steps { padding: 10px 12px; }
  .form-group { margin-bottom: 14px; }
  .form-hint { font-size: 11.5px; margin-top: 5px; }
  .btn { padding: 12px 16px; font-size: 14px; }
  .year-options { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pin-digit { width: 44px; height: 52px; font-size: 20px; }
  .success-body { padding: 20px 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   Layout helpers used by the page templates. On phones and tablets
   they are plain blocks, so pages stack exactly as before.
   ═══════════════════════════════════════════════════════════════ */
.desk-cols, .desk-col, .form-row { display: block; }
.alt-section form .btn { margin-left: auto; margin-right: auto; }
.alt-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
}
.success-body { text-align: center; padding: 24px 20px; }
/* PIN page: the number we texted + "Not your number? Update it" */
.pin-phone {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary);
  font-family: 'SF Mono', Monaco, monospace;
}
.pin-not-mine {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 13px;
  text-decoration: none;
}
.pin-not-mine b { color: var(--primary); }
.pin-not-mine:hover { background: var(--primary-light); }

/* Identity check: "Not OW-xxxx? Start over" */
.claim-start-over { display: block; margin: -6px 0 4px; text-align: right; font-size: 12.5px; color: var(--gray-500); text-decoration: none; }
.claim-start-over b { color: var(--primary); }

/* Link to the "How to renew" guide */
.howto-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  text-decoration: none;
}
.howto-link b { font-weight: 700; }
.howto-link:hover { background: var(--primary-light-hover); }
/* "full" inputs (name, email, phone, dates) span their column on every
   screen size — previously they shrank to the browser's default width. */
.input-field.full { width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   DESKTOP (≥ 900px wide): multi-column layout so a resident sees the
   whole step without scrolling.
   - The card widens; the page title and step dots share one compact
     orange bar.
   - Page content sits side by side in .desk-cols / .desk-col columns.
   - Footer becomes a single line and the card is centred between the
     header and footer.
   DOM order is unchanged, so the phone reading order stays the same.
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  body { display: flex; flex-direction: column; min-height: 100vh; }

  .portal-header { padding: 10px 28px; }

  .portal-container {
    flex: 1;
    width: 100%;
    max-width: 980px;
    min-height: 0;
    padding: 24px 32px;
  }
  .portal-container.is-wide { max-width: 1200px; }
  .portal-container > .portal-card { width: 100%; }

  /* Title bar: header text on the left, step dots on the right */
  .portal-card:not(.portal-card--plain) { display: grid; grid-template-columns: 1fr auto; }
  .portal-card:not(.portal-card--plain) > .card-header {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: left;
    padding: 16px 240px 16px 28px;
  }
  .portal-card > .card-header h2 { font-size: 18px; margin-bottom: 2px; }
  .portal-card > .card-header p { font-size: 13px; }
  .portal-card:not(.portal-card--plain) > .steps {
    grid-column: 2;
    grid-row: 1;
    z-index: 1;
    align-self: center;
    align-items: center;
    padding: 0 32px 0 0;
    background: none;
    counter-reset: step;
  }
  .portal-card:not(.portal-card--plain) > .steps .step {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.35);
    box-shadow: none;
  }
  .portal-card:not(.portal-card--plain) > .steps .step.completed {
    background: rgba(255,255,255,0.85);
    counter-increment: step;
  }
  .portal-card:not(.portal-card--plain) > .steps .step.active {
    width: 28px;
    background: #fff;
    counter-increment: step;
  }
  .portal-card:not(.portal-card--plain) > .steps::after {
    content: "Step " counter(step) " of 5";
    margin-left: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .portal-card > .card-body { grid-column: 1 / -1; grid-row: 2; padding: 22px 28px; }

  /* Columns */
  .desk-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk-cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Payment summary: the middle (bank + notes) column gets more room */
  .desk-cols--summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); }
  .desk-col { min-width: 0; }
  .desk-col + .desk-col { border-left: 1px solid var(--gray-200); padding-left: 32px; }
  .desk-col:not(:last-child) { padding-right: 32px; }
  .desk-cols--center > .desk-col { display: flex; flex-direction: column; justify-content: center; }
  .desk-col > :last-child { margin-bottom: 0; }
  .desk-col > .alt-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

  /* Slightly tighter components so each step fits on one screen */
  .form-group { margin-bottom: 20px; }
  .alert { margin-bottom: 14px; }
  .summary-row { padding: 10px 0; gap: 12px; }
  .summary-value { white-space: nowrap; text-align: right; }
  .bank-info { margin: 0 0 14px; padding: 14px 16px; }
  .bank-info-title { margin-bottom: 8px; }
  .bank-row { padding: 6px 0; gap: 12px; }
  .bank-label { white-space: nowrap; }
  .bank-value { text-align: right; }
  .upload-area { padding: 18px; }
  .upload-preview { max-height: 110px; margin: 8px auto; }
  .success-body { padding: 22px 28px; }
  .success-details > :first-child { margin-top: 0 !important; }

  /* One-line footer */
  .portal-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 10px 24px 14px;
  }
  .portal-footer > * + *::before { content: "·"; margin: 0 14px; color: var(--gray-400); }
  .footer-secure { margin-top: 0; }
}

/* Desktop screens with little height (e.g. 1366×768 laptops, ~650px of
   page once the browser bar is counted): same columns, tighter spacing,
   so every step still fits without scrolling. */
@media (min-width: 900px) and (max-height: 820px) {
  .portal-header { padding: 7px 28px; }
  .portal-container { padding: 8px 32px; }
  .portal-card:not(.portal-card--plain) > .card-header { padding: 12px 240px 12px 28px; }
  .portal-card--plain > .steps { padding: 8px; }
  .portal-card > .card-body { padding: 18px 28px; }
  .form-group { margin-bottom: 12px; }
  .alert { margin-bottom: 10px; padding: 9px 12px; }
  .profile-display { margin-bottom: 10px; }
  .summary-row { padding: 7px 0; }
  .bank-info { padding: 10px 14px; margin-bottom: 10px; }
  .bank-row { padding: 4px 0; }
  .upload-area { padding: 14px; }
  .upload-icon { width: 32px; height: 32px; margin-bottom: 4px; }
  .success-icon { width: 52px; height: 52px; margin-bottom: 10px; }
  .success-icon svg { width: 26px; height: 26px; }
  .reference-number { margin: 10px 0; padding: 10px; }
  .alt-section { margin-top: 18px; padding-top: 16px; }
  .portal-footer { padding: 6px 24px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   MOTION — makes the renewal feel like one continuous experience.
   - Enter: header fades in, the card rises into place, then its
     contents fade up in a gentle stagger (left column first).
   - Exit: js/transitions.js adds .portal-leaving before a portal link or
     form moves on, so the card fades away instead of blinking.
   - Step dots: the current step's pill grows in; finished dots fade in.
   Only opacity/transform are animated (GPU-friendly on phones), and
   `backwards` fill mode hands control back to hover effects afterwards.
   Everything is switched off for people who ask for reduced motion.
   ═══════════════════════════════════════════════════════════════ */
@keyframes portal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes portal-rise {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes portal-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes portal-step-grow { from { width: 12px; opacity: 0.4; } }

#cityCanvas { animation: portal-fade-in 0.9s ease-out backwards; }
.portal-header { animation: portal-fade-in 0.45s ease-out backwards; }
.portal-container > .portal-card,
.portal-container > .license-card-3d {
  animation: portal-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s backwards;
}
.portal-card > .card-header > * { animation: portal-fade-up 0.5s ease-out 0.2s backwards; }
.portal-card > .card-header > p { animation-delay: 0.28s; }
.steps .step.completed { animation: portal-fade-in 0.4s ease-out 0.25s backwards; }
.steps .step.active { animation: portal-step-grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s backwards; }
.portal-footer { animation: portal-fade-in 0.6s ease-out 0.5s backwards; }

/* Card contents: staggered fade-up, column by column */
.card-body .desk-col > * {
  animation: portal-fade-up 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(0.22s + var(--i, 0) * 0.07s);
}
.card-body .desk-col + .desk-col > * { animation-delay: calc(0.34s + var(--i, 0) * 0.07s); }
.card-body .desk-col + .desk-col + .desk-col > * { animation-delay: calc(0.46s + var(--i, 0) * 0.07s); }
.card-body .desk-col > :nth-child(2) { --i: 1; }
.card-body .desk-col > :nth-child(3) { --i: 2; }
.card-body .desk-col > :nth-child(4) { --i: 3; }
.card-body .desk-col > :nth-child(5) { --i: 4; }
.card-body .desk-col > :nth-child(6) { --i: 5; }
.card-body .desk-col > :nth-child(n+7) { --i: 6; }

/* The success checkmark keeps its own "pop" (after the card has risen) */
.card-body .desk-col > .success-icon {
  animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s backwards;
}

/* Exit: fade the page content away before the next page loads */
html.portal-leaving .portal-container > *,
html.portal-leaving .howto,
html.portal-leaving .portal-footer {
  opacity: 0;
  transform: translateY(-10px) scale(0.99);
  transition: opacity 0.24s ease-in, transform 0.24s ease-in;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TOWN PHOTO BANNER (views/heroBanner.mjs) — clock tower + Town Council
   building from owtc.org. Phones load the 960px copy, desktops 1920px.
   The page's card overlaps the banner's bottom edge.
     --hero-h       banner height
     --hero-overlap how far the card rises onto the photo
   ═══════════════════════════════════════════════════════════════ */
.portal-hero {
  --hero-h: 96px;
  position: relative;
  z-index: 1;
  height: var(--hero-h);
  background-color: #1d2b6b;
  background-image:
    linear-gradient(180deg, rgba(8, 18, 60, 0.18) 0%, rgba(8, 18, 60, 0.5) 100%),
    url("/img/owtc-town-960.jpg");
  background-size: cover;
  background-position: center 42%;
  color: #fff;
}
@media (min-width: 900px) {
  .portal-hero {
    background-image:
      linear-gradient(180deg, rgba(8, 18, 60, 0.18) 0%, rgba(8, 18, 60, 0.5) 100%),
      url("/img/owtc-town-1920.jpg");
  }
}
/* Front door (start page, guide): about a third of the screen */
.portal-hero--tall {
  --hero-h: clamp(176px, 30vh, 340px);
  animation: portal-fade-in 0.6s ease-out backwards;
}
/* Later steps: a thin strip so those screens still fit */
.portal-hero--slim { --hero-h: 84px; }

.portal-hero-text {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 20px 0;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}
.portal-hero-eyebrow {
  display: block;
  color: #ffd60a; /* the council site's yellow */
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.portal-hero-title {
  display: block;
  margin-top: 4px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

/* The card rises onto the photo; content no longer centres vertically */
.portal-hero + .portal-container,
.portal-hero + .howto {
  position: relative;
  z-index: 2;
  margin-top: calc(-1 * var(--hero-overlap));
}
.portal-hero + .portal-container { min-height: 0; justify-content: flex-start; padding-top: 0; }
.portal-hero + .howto { padding-top: 0; }
.portal-hero--tall + .portal-container,
.portal-hero--tall + .howto { --hero-overlap: clamp(70px, 12vh, 140px); }
.portal-hero--slim + .portal-container,
.portal-hero--slim + .howto { --hero-overlap: 50px; }

@media (min-width: 900px) {
  .portal-hero-text { padding-top: 30px; }
  .portal-hero-eyebrow { font-size: 13px; }
  .portal-hero-title { font-size: 28px; }
  .portal-hero--slim { --hero-h: 96px; }
}
/* Phones: slightly shorter so the whole start page fits one screen */
@media (max-width: 480px) {
  .portal-hero--tall { --hero-h: clamp(168px, 26vh, 240px); }
  .portal-hero-text { padding-top: 16px; }
}
/* Short desktop screens (e.g. 1366×768 laptops): a bit shorter */
@media (min-width: 900px) and (max-height: 820px) {
  .portal-hero--tall { --hero-h: clamp(176px, 28vh, 260px); }
  .portal-hero-text { padding-top: 22px; }
  .portal-hero-title { font-size: 24px; }
  .portal-hero--slim { --hero-h: 76px; }
  .portal-hero--slim + .portal-container { --hero-overlap: 46px; }
}
