/*
 * Invoice payment portal.
 *
 * Colours are placeholders drawn from the Acura Grand Prix of Long Beach palette
 * (red / navy / white) and should be replaced once the official brand values arrive
 * with the logo. Every foreground/background pair below clears 4.5:1.
 */

:root {
  --brand-red: #d6001c;
  --brand-navy: #0b1b3a;
  --ink: #18181b;
  --ink-muted: #52525b;
  --line: #d4d4d8;
  --line-strong: #a1a1aa;
  --surface: #ffffff;
  --surface-sunken: #f4f4f5;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --warning: #a16207;
  --warning-bg: #fefce8;
  --focus: #2563eb;
  --radius: 8px;
  --gap: 1rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 1rem 3rem;
  background: var(--surface-sunken);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Visible only on keyboard focus, so keyboard users can jump the masthead. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-navy);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

.masthead {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 0 1rem;
  text-align: center;
}

.masthead__logo {
  /* Never scale a 200px-wide raster past its intrinsic size -- it only gets softer.
     Shrinking on narrow screens is fine, so cap rather than fix the width. */
  width: 200px;
  max-width: 100%;
  height: auto;
}

.masthead__title {
  margin: 0.75rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-navy);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.banner {
  max-width: 640px;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.banner--warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: #713f12;
}

main {
  max-width: 640px;
  margin: 0 auto;
}

/* --- Cards ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 0 0 1rem;
}

.card__legend {
  padding: 0 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--brand-navy);
}

/* --- Fields ------------------------------------------------------------ */

.field {
  margin-bottom: var(--gap);
  flex: 1 1 12rem;
  min-width: 0;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.field--narrow {
  flex: 0 1 9rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.req {
  color: var(--brand-red);
}

.optional {
  font-weight: 400;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

input,
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  /* Never remove this. A payment form has to be completable by keyboard alone. */
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

input[readonly] {
  background: var(--surface-sunken);
  color: var(--ink-muted);
}

input.is-invalid,
select.is-invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* Brief highlight so an auto-filled city/state is visibly a change, not a surprise. */
input.is-autofilled {
  background: var(--success-bg);
  transition: background 0.6s ease-out;
}

.uppercase {
  text-transform: uppercase;
}

.hint {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.hint--block {
  margin: 0 0 1rem;
}

.error {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--danger);
}

/* --- Amount ------------------------------------------------------------ */

.amount-input {
  display: flex;
  align-items: center;
}

.amount-input__prefix {
  padding: 0.625rem 0.5rem 0.625rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--surface-sunken);
  font-weight: 600;
}

.amount-input input {
  border-radius: 0 6px 6px 0;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

/* --- Postal lookup ----------------------------------------------------- */

.lookup-input {
  position: relative;
}

.lookup-input__spinner {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand-navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- Hosted card fields ------------------------------------------------ */

/* Chase renders an iframe into these, so they need an explicit height: an empty
   iframe container would otherwise collapse and the field would look missing. */
.hosted-field {
  min-height: 2.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.secure-note {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* --- Submit ------------------------------------------------------------ */

.field--captcha {
  margin: 1rem 0;
}

.pay-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand-red);
  color: #fff;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
}

.pay-button:hover:not(:disabled) {
  background: #b30017;
}

.pay-button:disabled {
  background: var(--line-strong);
  cursor: not-allowed;
}

.secondary-button {
  margin-top: 1rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.disclaimer {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: center;
}

/* --- Error summary ----------------------------------------------------- */

.summary {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-bg);
}

.summary__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--danger);
}

.summary__list {
  margin: 0;
  padding-left: 1.25rem;
}

.summary__list a {
  color: var(--danger);
}

/* --- Result ------------------------------------------------------------ */

.result {
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.result--approved {
  border-color: var(--success);
  background: var(--success-bg);
}

.result--declined {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.result--warning {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.result__title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.result__details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}

.result__details dt {
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.result__details dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.result__note {
  margin: 0;
  font-size: 0.9375rem;
}

/* --- Footer ------------------------------------------------------------ */

.site-footer {
  max-width: 640px;
  margin: 2rem auto 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.site-footer__brand {
  font-weight: 600;
  color: var(--brand-navy);
}

/* --- Print ------------------------------------------------------------- */

@media print {
  body { background: #fff; }
  .masthead, .banner, .site-footer { }
  .secondary-button, .skip-link { display: none; }
  .result { border: 1px solid #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
