/* QuovoPay — Design System tokens & components */

:root {
  --canvas: #F2F3F0;
  --surface: #FFFFFF;
  --surface-warm: #FAFAF8;
  --brand-900: #12271F;
  --brand-800: #173528;
  --brand-700: #1B4D3E;
  --brand-600: #22624F;
  --brand-500: #2D7A63;
  --brand-50: #E9F0EC;
  --brass-600: #9A7B3F;
  --brass-500: #B08A45;
  --brass-100: #EBDFC7;
  --ink-900: #161917;
  --ink-700: #3A3D3A;
  --ink-500: #6B6E69;
  --ink-400: #8E918B;
  --border: #E4E2DA;
  --border-strong: #D2CFC4;
  --success: #2F6F4E;
  --warning: #B5822E;
  --error: #A93226;
  --shadow-sm: 0 1px 2px rgba(22, 25, 23, 0.05);
  --shadow-md: 0 6px 20px -6px rgba(22, 25, 23, 0.10);
  --shadow-lg: 0 16px 40px -12px rgba(22, 25, 23, 0.14);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-micro: 150ms ease-out;
  --transition-panel: 180ms ease-out;
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-500);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-700);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Wordmark lockup */
.qp-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.qp-wordmark__glyph {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.qp-wordmark__text {
  font-family: 'Schibsted Grotesk', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.qp-wordmark__quovo {
  color: var(--brand-700);
}

.qp-wordmark__pay {
  color: var(--ink-900);
}

/* Verified seal — signature element */
.qp-seal {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qp-seal__circle {
  border-radius: 50%;
  background: var(--brass-100);
  border: 1.5px solid var(--brass-600);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qp-seal__circle::before {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--brass-500);
  opacity: 0.65;
}

.qp-seal--sm .qp-seal__circle {
  width: 20px;
  height: 20px;
}

.qp-seal--sm .qp-seal__circle::before {
  inset: 2px;
}

.qp-seal--sm .qp-seal__circle svg {
  width: 10px;
  height: 10px;
}

.qp-seal--md .qp-seal__circle {
  width: 32px;
  height: 32px;
}

.qp-seal--md .qp-seal__circle::before {
  inset: 3px;
}

.qp-seal--md .qp-seal__circle svg {
  width: 14px;
  height: 14px;
}

.qp-seal--lg .qp-seal__circle {
  width: 48px;
  height: 48px;
}

.qp-seal--lg .qp-seal__circle::before {
  inset: 4px;
}

.qp-seal--lg .qp-seal__circle svg {
  width: 22px;
  height: 22px;
}

.qp-seal__circle svg {
  color: var(--brass-600);
  position: relative;
  z-index: 1;
}

.qp-seal__label {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-600);
  line-height: 1;
}

.qp-seal--sm .qp-seal__label {
  display: none;
}

.qp-seal--animate .qp-seal__circle,
.qp-seal--animate-ready.qp-seal--animate .qp-seal__circle {
  animation: qp-seal-stamp 320ms ease-out forwards;
}

@keyframes qp-seal-stamp {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Engraved rule — major section divider */
.qp-engraved-rule {
  position: relative;
  height: 7px;
  margin: 0;
  border: none;
  background: transparent;
}

.qp-engraved-rule::before,
.qp-engraved-rule::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
}

.qp-engraved-rule::before {
  top: 0;
  background: var(--border-strong);
}

.qp-engraved-rule::after {
  top: 3px;
  background: var(--brass-600);
  opacity: 0.3;
}

.qp-engraved-rule--centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.qp-engraved-rule--centered::before,
.qp-engraved-rule--centered::after {
  position: static;
  flex: 1;
  height: 1px;
}

.qp-engraved-rule--centered::before {
  background: var(--border-strong);
}

.qp-engraved-rule--centered::after {
  background: var(--brass-600);
  opacity: 0.3;
  margin-top: -4px;
}

.qp-engraved-rule__glyph {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid var(--brass-600);
  opacity: 0.5;
  background: var(--brass-100);
}

/* Buttons */
.qp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-micro), border-color var(--transition-micro), color var(--transition-micro), box-shadow var(--transition-micro), transform var(--transition-micro);
}

.qp-btn--primary {
  background: var(--brand-700);
  color: #fff;
}

.qp-btn--primary:hover {
  background: var(--brand-600);
}

.qp-btn--secondary {
  background: var(--surface);
  color: var(--ink-900);
  border-color: var(--border);
}

.qp-btn--secondary:hover {
  border-color: var(--border-strong);
}

.qp-btn--ghost {
  background: transparent;
  color: var(--ink-700);
}

.qp-btn--ghost:hover {
  background: var(--surface-warm);
}

.qp-btn--on-dark {
  background: #fff;
  color: var(--brand-900);
}

.qp-btn--on-dark:hover {
  background: var(--brand-50);
}

.qp-btn--added {
  background: var(--brand-700);
  color: #fff;
  border-color: var(--brand-700);
}

/* Form inputs */
.qp-input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-micro), box-shadow var(--transition-micro);
  min-height: 44px;
}

.qp-input::placeholder {
  color: var(--ink-400);
}

.qp-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-50);
  outline: none;
}

.qp-input--error {
  border-color: var(--error);
}

.qp-input--error:focus {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--error);
}

.qp-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
}

select.qp-input {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E918B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

textarea.qp-input {
  resize: vertical;
  min-height: 120px;
}

/* Filter chips */
.qp-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-700);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  transition: background var(--transition-micro), border-color var(--transition-micro), color var(--transition-micro);
  white-space: nowrap;
}

.qp-chip:hover {
  background: var(--surface-warm);
  border-color: var(--border-strong);
}

.qp-chip[aria-pressed='true'] {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fff;
}

.qp-chip[aria-pressed='true']:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
}

/* Provider cards */
.qp-provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-panel), box-shadow var(--transition-panel), transform var(--transition-panel);
}

.qp-provider-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.qp-provider-card.is-hidden {
  display: none;
}

/* Skeleton loading */
.qp-skeleton {
  background: linear-gradient(90deg, var(--surface-warm) 25%, #ecece8 50%, var(--surface-warm) 75%);
  background-size: 200% 100%;
  animation: qp-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes qp-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .qp-skeleton {
    animation: none;
    background: var(--surface-warm);
  }

  .qp-provider-card:hover {
    transform: none;
  }

  .qp-category-card:hover {
    transform: none;
  }
}

.qp-skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.qp-skeleton-card .qp-skeleton {
  height: 12px;
  margin-bottom: 12px;
}

.qp-skeleton-card .qp-skeleton--title {
  height: 20px;
  width: 60%;
  margin-bottom: 16px;
}

.qp-skeleton-card .qp-skeleton--short {
  width: 40%;
}

.qp-listings.is-loading .qp-provider-card {
  display: none;
}

.qp-listings.is-loading .qp-skeleton-grid {
  display: grid;
}

.qp-listings:not(.is-loading) .qp-skeleton-grid {
  display: none;
}

/* Compare tray */
.qp-compare-launcher {
  position: relative;
}

.qp-compare-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: var(--brand-700);
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

.qp-compare-badge:empty,
.qp-compare-badge[data-count='0'] {
  display: none;
}

.qp-compare-tray {
  position: fixed;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-panel) ease-out, opacity var(--transition-panel) ease-out;
}

.qp-compare-tray[hidden] {
  display: block !important;
  pointer-events: none;
  opacity: 0;
}

@media (max-width: 767px) {
  .qp-compare-tray {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
  }

  .qp-compare-tray.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .qp-compare-tray[hidden]:not(.is-open) {
    transform: translateY(100%);
  }
}

@media (min-width: 768px) {
  .qp-compare-tray {
    top: 72px;
    right: 0;
    width: min(400px, 100vw);
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transform: translateX(100%);
  }

  .qp-compare-tray.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .qp-compare-tray[hidden]:not(.is-open) {
    transform: translateX(100%);
  }
}

.qp-compare-tray__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.qp-compare-tray__body {
  padding: 16px 24px 24px;
}

.qp-compare-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.qp-compare-item:last-child {
  border-bottom: none;
}

/* Comparison ledger table */
.qp-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.qp-compare-table th,
.qp-compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.qp-compare-table thead th {
  background: var(--surface-warm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  text-align: left;
}

.qp-compare-table tbody th[scope='row'] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  font-weight: 600;
  color: var(--ink-900);
  text-align: left;
  min-width: 140px;
  box-shadow: 1px 0 0 var(--border);
}

.qp-compare-table td {
  background: var(--surface);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.qp-compare-table tbody tr:nth-child(even) td {
  background: var(--surface-warm);
}

.qp-compare-table tbody tr:nth-child(even) th[scope='row'] {
  background: var(--surface-warm);
}

.qp-compare-table .qp-cell-empty {
  color: var(--ink-400);
}

/* Header scrolled state */
.qp-header.is-scrolled {
  box-shadow: var(--shadow-sm);
}

/* Step connector (how it works) */
.qp-step-connector {
  display: none;
}

@media (min-width: 768px) {
  .qp-step-connector {
    display: block;
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-top: 28px;
  }
}

.qp-step-marker {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--border);
  border-radius: 9999px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Category card */
.qp-category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-panel), box-shadow var(--transition-panel), transform var(--transition-panel);
  min-height: 44px;
}

.qp-category-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.qp-category-card:focus-visible {
  box-shadow: var(--focus-ring);
}

.qp-category-card--dashed {
  border-style: dashed;
}

/* Disclaimer blocks */
.qp-disclaimer {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-500);
}

.qp-disclaimer--legal {
  max-width: 72ch;
}

/* Mobile nav */
.qp-mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(22, 25, 23, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-panel);
}

.qp-mobile-nav.is-open {
  opacity: 1;
  pointer-events: auto;
}

.qp-mobile-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px;
  transform: translateX(100%);
  transition: transform var(--transition-panel) ease-out;
  overflow-y: auto;
}

.qp-mobile-nav.is-open .qp-mobile-nav__panel {
  transform: translateX(0);
}

.qp-overlay {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(22, 25, 23, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-panel);
}

.qp-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Section reveal animation */
.qp-reveal {
  opacity: 0;
  transform: translateY(12px);
}

.qp-reveal.is-visible {
  animation: qp-reveal 400ms ease-out forwards;
}

@keyframes qp-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .qp-reveal {
    opacity: 1;
    transform: none;
  }

  .qp-reveal.is-visible {
    animation: none;
  }
}

/* Unverified label */
.qp-unverified {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-400);
}

/* Empty state */
.qp-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-500);
}

.qp-empty-state__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0 0 8px;
}

/* Feature panel on home */
.qp-feature-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .qp-feature-panel {
    padding: 32px;
  }
}
