:root {
  color-scheme: light;
  --deep-ink: #121a2b;
  --ocean-blue: #2d6cdf;
  --aqua: #42d6ca;
  --soft-lavender: #eae7ff;
  --warm-cream: #fff6e6;
  --paper: #f8fbff;
  --white: #ffffff;
  --line: #bfcce0;
  --muted: #566273;
  --success: #146d51;
  --warning: #8a4b05;
  --danger: #9b1c2a;
  --shadow: 0 18px 44px rgba(18, 26, 43, 0.11);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(234, 231, 255, 0.7), rgba(255, 246, 230, 0.75)),
    var(--paper);
  color: var(--deep-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

a {
  color: var(--ocean-blue);
  font-weight: 700;
}

:focus-visible {
  outline: 3px solid var(--aqua);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--deep-ink);
  color: var(--white);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) clamp(16px, 4vw, 40px);
  border-bottom: 1px solid rgba(18, 26, 43, 0.12);
  background: rgba(248, 251, 255, 0.96);
}

.brand,
.topbar nav,
.role-nav,
.button-row,
.chip-row,
.segmented,
.hero,
.listing-body {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--deep-ink);
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.topbar nav,
.role-nav {
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.topbar nav a,
.role-nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--deep-ink);
  text-decoration: none;
}

.topbar nav a:hover,
.role-nav a:hover,
.role-nav a[aria-current="page"] {
  background: var(--soft-lavender);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-xl) 0 72px;
}

.hero {
  justify-content: space-between;
  gap: var(--space-lg);
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid rgba(18, 26, 43, 0.12);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--white), rgba(234, 231, 255, 0.86));
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 var(--space-xs);
  color: var(--ocean-blue);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: var(--space-md);
  font-size: clamp(2.3rem, 5vw, 4.7rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.12;
}

h3 {
  margin-bottom: var(--space-xs);
  font-size: 1.08rem;
}

p,
small,
.hint,
.legal-note span,
.empty-state span,
.drawer-shell span,
.alert span {
  color: var(--muted);
}

.section {
  margin-top: var(--space-xl);
}

.section-heading {
  margin-bottom: var(--space-md);
}

.swatch-grid,
.token-grid,
.primitive-grid,
.listing-grid,
.metric-grid {
  display: grid;
  gap: var(--space-md);
}

.swatch-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.token-grid,
.primitive-grid,
.listing-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: var(--space-md);
}

.route-shell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.surface-card,
.listing-card,
.search-panel,
.map-shell,
.legal-note,
.route-shell-card,
.metric-grid article,
.table-shell {
  border: 1px solid rgba(18, 26, 43, 0.13);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(18, 26, 43, 0.08);
}

.surface-card,
.search-panel,
.map-shell,
.legal-note,
.route-shell-card,
.metric-grid article,
.table-shell {
  padding: var(--space-md);
}

.route-shell-card {
  background: var(--white);
}

.route-shell-card.protected {
  border-color: rgba(155, 28, 42, 0.32);
  background: linear-gradient(135deg, var(--white), rgba(255, 246, 230, 0.72));
}

.legal-note {
  display: grid;
  gap: var(--space-xs);
  min-width: min(100%, 340px);
  background: var(--warm-cream);
}

.swatch {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.swatch code {
  font-size: 0.88rem;
  font-weight: 700;
}

.swatch.deep,
.swatch.ocean {
  color: var(--white);
}

.swatch.deep { background: var(--deep-ink); }
.swatch.ocean { background: var(--ocean-blue); }
.swatch.aqua { background: var(--aqua); color: var(--deep-ink); }
.swatch.lavender { background: var(--soft-lavender); color: var(--deep-ink); }
.swatch.cream { background: var(--warm-cream); color: var(--deep-ink); }

.spacing-stack,
.radius-row {
  display: flex;
  align-items: end;
  gap: var(--space-sm);
}

.spacing-stack span {
  width: var(--w);
  height: calc(var(--w) * 2);
  min-width: 18px;
  display: inline-flex;
  justify-content: center;
  align-items: end;
  border-radius: var(--radius-sm);
  background: var(--ocean-blue);
  color: var(--white);
  font-size: 0.72rem;
}

.radius-row span {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--soft-lavender);
  color: var(--deep-ink);
  font-weight: 800;
}

.r-sm { border-radius: var(--radius-sm); }
.r-md { border-radius: var(--radius-md); }
.r-lg { border-radius: var(--radius-lg); }
.r-xl { border-radius: var(--radius-xl); }

.motion-sample {
  width: 64px;
  height: 14px;
  border-radius: 999px;
  background: var(--aqua);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: translateX(28px);
  }
}

.controls-demo,
.primitive-grid .surface-card {
  display: grid;
  gap: var(--space-md);
  align-content: start;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--deep-ink);
  background: var(--white);
}

.hint {
  margin-top: -10px;
  font-size: 0.9rem;
}

.button-row,
.chip-row {
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.button,
.icon-button,
.chip,
.segmented button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 800;
}

.button {
  padding: 9px 14px;
}

.button.primary {
  background: var(--ocean-blue);
  color: var(--white);
}

.button.secondary,
.chip,
.segmented button {
  background: var(--soft-lavender);
  color: var(--deep-ink);
}

.icon-button {
  width: 44px;
  border-radius: 50%;
  background: var(--warm-cream);
  color: var(--deep-ink);
  font-size: 1.18rem;
}

.chip {
  padding: 8px 12px;
}

.chip.selected,
.segmented button[aria-pressed="true"] {
  background: var(--deep-ink);
  color: var(--white);
}

.chip.static,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}

.chip.static {
  background: var(--soft-lavender);
}

.badge {
  background: rgba(20, 109, 81, 0.12);
  color: var(--success);
}

.segmented {
  width: fit-content;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.alert {
  display: grid;
  gap: 4px;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid currentColor;
  background: var(--white);
}

.alert.info {
  color: var(--ocean-blue);
}

.alert.warning {
  color: var(--warning);
  background: var(--warm-cream);
}

.alert.danger {
  margin-top: var(--space-md);
  color: var(--danger);
}

.tooltip-demo {
  position: relative;
  min-height: 52px;
  margin: 0;
}

[role="tooltip"] {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-left: var(--space-xs);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--deep-ink);
  color: var(--white);
  font-size: 0.9rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  font-weight: 700;
}

.check-row input {
  width: 22px;
  height: 22px;
}

.modal-shell,
.drawer-shell,
.toast,
.empty-state {
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.modal-shell {
  border: 2px solid var(--ocean-blue);
  background: var(--white);
}

.drawer-shell {
  display: grid;
  gap: 4px;
  border-left: 5px solid var(--aqua);
  background: var(--paper);
}

.toast {
  background: var(--deep-ink);
  color: var(--white);
  font-weight: 800;
}

.skeleton {
  display: grid;
  gap: var(--space-xs);
}

.skeleton span {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(191, 204, 224, 0.45), rgba(234, 231, 255, 0.75));
}

.empty-state {
  display: grid;
  gap: 4px;
  background: var(--paper);
  text-align: center;
}

.role-nav {
  margin-bottom: var(--space-md);
}

.role-nav a {
  border: 1px solid rgba(18, 26, 43, 0.12);
  background: var(--white);
}

.buyer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(220px, 0.95fr);
  gap: var(--space-md);
}

.search-panel {
  display: grid;
  gap: var(--space-md);
}

.map-shell {
  min-height: 210px;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(66, 214, 202, 0.2), rgba(45, 108, 223, 0.12)),
    var(--white);
}

.map-shell span {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
}

.listing-grid {
  margin-top: var(--space-md);
}

.listing-card {
  overflow: hidden;
  background: var(--white);
}

.media-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 2px;
  min-height: 156px;
  background: var(--deep-ink);
}

.media-row span {
  display: flex;
  align-items: end;
  padding: var(--space-md);
  color: var(--white);
  font-weight: 900;
  background: linear-gradient(135deg, var(--ocean-blue), var(--aqua));
}

.media-row.alt span {
  background: linear-gradient(135deg, var(--deep-ink), var(--ocean-blue));
}

.listing-body {
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
}

.listing-body p {
  margin-bottom: 0;
}

.listing-card .chip-row {
  padding: 0 var(--space-md) var(--space-md);
}

.metric-grid article {
  display: grid;
  gap: 2px;
  background: var(--white);
}

.metric-grid strong {
  font-size: 2rem;
}

.table-shell {
  overflow-x: auto;
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

caption {
  text-align: left;
  font-weight: 900;
  margin-bottom: var(--space-xs);
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(18, 26, 43, 0.12);
}

th {
  color: var(--deep-ink);
  background: var(--soft-lavender);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 760px) {
  .topbar,
  .hero,
  .listing-body {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .buyer-layout {
    grid-template-columns: 1fr;
  }

  .media-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.35rem;
  }
}
