/* ============================================================================
   av-exchange.css — /exchange/:id/ on the living layer.
   One template, 23 exchanges. Built on av-tokens + av-components.
   Monochrome + orange accent only. Day/night via data-theme.
   ========================================================================== */

/* ── Hero ────────────────────────────────────────────────────────────────── */

.av-xchg-hero {
  position: relative;
  overflow: hidden;
  padding: calc(64px + var(--av-space-10)) 0 var(--av-space-9);
  text-align: center;
}

.av-xchg-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 560px;
  max-width: 120vw;
  background: radial-gradient(ellipse at center, rgba(252, 114, 19, 0.09) 0%, transparent 68%);
  pointer-events: none;
}

.av-xchg-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--av-space-5);
}

.av-xchg-hero__title {
  font-family: var(--av-font-display);
  font-size: clamp(2.1rem, 5.5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--av-text);
  margin: 0 0 var(--av-space-5);

  opacity: 0;
  transform: translateY(22px);
  animation: av-rise 0.75s var(--av-ease-out) 0.1s forwards;
}

.av-xchg-hero__sub {
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  color: var(--av-text-muted);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto var(--av-space-6);

  opacity: 0;
  transform: translateY(16px);
  animation: av-rise 0.7s var(--av-ease-out) 0.24s forwards;
}

.av-xchg-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--av-space-3);
  flex-wrap: wrap;

  opacity: 0;
  transform: translateY(12px);
  animation: av-rise 0.65s var(--av-ease-out) 0.38s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .av-xchg-hero__title,
  .av-xchg-hero__sub,
  .av-xchg-hero__actions {
    opacity: 1;
    transform: none;
    animation: none;
  }
}


/* ── Resource links (article list) ──────────────────────────────────────── */

.av-xchg-resources {
  display: flex;
  gap: var(--av-space-8);
  flex-wrap: wrap;
  align-items: flex-start;
}

.av-xchg-resources__video {
  flex: 1 1 320px;
  min-width: 0;
}

.av-xchg-resources__video .av-xchg-ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--av-radius-lg);
  overflow: hidden;
  border: 1px solid var(--av-border);
}

.av-xchg-resources__video .av-xchg-ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.av-xchg-resource-links {
  flex: 1 1 280px;
  min-width: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--av-space-4);
}

.av-resource-link {
  display: flex;
  align-items: center;
  gap: var(--av-space-3);
  color: var(--av-text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.15s;
  padding: var(--av-space-3) var(--av-space-4);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  background: var(--av-surface);
}

.av-resource-link:hover {
  color: var(--av-text);
  border-color: var(--av-orange);
}

.av-resource-link svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--av-orange);
}


/* ── Why-automate feature grid ───────────────────────────────────────────── */

.av-why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--av-space-5);
  margin-bottom: var(--av-space-7);
}

.av-why-item {
  text-align: center;
  padding: var(--av-space-5);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius-lg);
  background: var(--av-surface);
}

.av-why-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(252, 114, 19, 0.10);
  color: var(--av-orange);
  margin-bottom: var(--av-space-4);
}

.av-why-icon svg {
  width: 24px;
  height: 24px;
}

.av-why-item strong {
  display: block;
  font-family: var(--av-font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--av-text);
  margin-bottom: var(--av-space-2);
}

.av-why-item p {
  font-size: 0.875rem;
  color: var(--av-text-muted);
  margin: 0;
  line-height: 1.6;
}

.av-why-lead {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.av-why-lead p {
  font-size: 1.0625rem;
  color: var(--av-text-muted);
  line-height: 1.65;
  margin: 0 0 var(--av-space-4);
}

.av-why-lead p:last-child { margin-bottom: 0; }


/* ── Platform → Autoview → Exchange flow animation ───────────────────────── */

/* Container: Mustache injects the .av-xchg-flow tree into #logo-strip */
#logo-strip {
  background: var(--av-surface);
  border-top: 1px solid var(--av-border);
  border-bottom: 1px solid var(--av-border);
  padding: var(--av-space-8) var(--av-space-5);
}

/* Root flex row — three stages + two connectors */
.av-xchg-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 960px;
  margin: 0 auto;
  flex-wrap: wrap;
  row-gap: var(--av-space-6);
}

/* ── Stages ── */
.av-xchg-flow__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--av-space-4);
}

.av-xchg-flow__stage--sources {
  gap: var(--av-space-3);
}

/* Source nodes — icon + label */
.av-xchg-flow__node {
  display: flex;
  align-items: center;
  gap: var(--av-space-3);
  padding: var(--av-space-3) var(--av-space-4);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  background: var(--av-bg);
  min-width: 160px;
}

.av-xchg-flow__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--av-elephant);
}

.av-xchg-flow__label {
  font-family: var(--av-font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--av-text-muted);
  white-space: nowrap;
}

/* ── Hub (center Autoview node) ── */
.av-xchg-flow__hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--av-space-3);
  padding: var(--av-space-5) var(--av-space-6);
  border: 1px solid rgba(252, 114, 19, 0.35);
  border-radius: var(--av-radius-lg);
  background: var(--av-bg);
  box-shadow: 0 0 24px rgba(252, 114, 19, 0.08);
  position: relative;
}

.av-xchg-flow__av-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

[data-theme="light"] .av-xchg-flow__av-mark {
  filter: brightness(0);
}

.av-xchg-flow__hub-label {
  font-family: var(--av-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--av-text);
  letter-spacing: -0.01em;
}

.av-xchg-flow__hub-label--orange {
  color: var(--av-orange);
}

/* ── Exchange card (right node) ── */
.av-xchg-flow__exchange-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--av-space-3);
  padding: var(--av-space-5) var(--av-space-6);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius-lg);
  background: var(--av-bg);
  min-width: 160px;
}

/* Exchange logo — monochrome filter (same pattern as homepage marquee) */
#broker-logo,
.av-xchg-flow__broker-logo {
  width: auto;
  height: 56px;
  max-width: 140px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

[data-theme="light"] #broker-logo,
[data-theme="light"] .av-xchg-flow__broker-logo {
  filter: brightness(0);
  opacity: 0.85;
}

.av-xchg-flow__exchange-name {
  font-family: var(--av-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--av-text-muted);
}

.av-xchg-flow__visit-btn {
  margin-top: var(--av-space-2);
  font-size: 0.8125rem;
}

/* ── Connectors ── */
.av-xchg-flow__connector {
  position: relative;
  flex: 0 0 64px;
  height: 2px;
  margin: 0 var(--av-space-2);
  align-self: center;
}

/* Connector baseline track */
.av-xchg-flow__line {
  position: absolute;
  inset: 0;
  background: var(--av-border);
  border-radius: 1px;
}

/* Traveling pulse dot — orange signal bead animating left → right */
.av-xchg-flow__pulse {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--av-orange);
  box-shadow: 0 0 8px rgba(252, 114, 19, 0.6);
  animation: av-flow-pulse 2s var(--av-ease-out) infinite;
}

.av-xchg-flow__pulse--delayed {
  animation-delay: 1s;
}

@keyframes av-flow-pulse {
  0%   { left: -5px;  opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { left: calc(100% - 5px); opacity: 0; }
}

/* Reduced-motion: hide pulse animation, keep static layout readable */
@media (prefers-reduced-motion: reduce) {
  .av-xchg-flow__pulse {
    animation: none;
    left: 50%;
    opacity: 0.45;
  }

  .av-xchg-flow__line {
    background: var(--av-orange);
    opacity: 0.3;
  }
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 680px) {
  .av-xchg-flow {
    flex-direction: column;
    align-items: center;
  }

  .av-xchg-flow__connector {
    flex: 0 0 auto;
    width: 2px;
    height: 32px;
    margin: 0;
    align-self: center;
  }

  .av-xchg-flow__pulse {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: av-flow-pulse-v 2s var(--av-ease-out) infinite;
  }

  .av-xchg-flow__pulse--delayed {
    animation-delay: 1s;
  }

  @keyframes av-flow-pulse-v {
    0%   { top: -5px;  opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: calc(100% - 5px); opacity: 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    .av-xchg-flow__pulse {
      animation: none;
      top: 50%;
      opacity: 0.45;
    }
  }
}


/* ── How It Works steps ──────────────────────────────────────────────────── */

.av-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--av-space-6);
  text-align: center;
}

.av-step {
  padding: var(--av-space-6);
}

.av-step__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(252, 114, 19, 0.10);
  color: var(--av-orange);
  margin-bottom: var(--av-space-4);
}

.av-step__icon svg {
  width: 28px;
  height: 28px;
}

.av-step h3 {
  font-family: var(--av-font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--av-text);
  margin: 0 0 var(--av-space-3);
}

.av-step p {
  font-size: 0.9rem;
  color: var(--av-text-muted);
  margin: 0;
  line-height: 1.6;
}


/* ── Supported Features table ────────────────────────────────────────────── */

.av-feature-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--av-radius-lg);
  overflow: hidden;
  border: 1px solid var(--av-border);
  font-size: 0.9375rem;
}

.av-feature-table thead {
  background: var(--av-coal);
  color: #ffffff;
}

[data-theme="light"] .av-feature-table thead {
  background: #333333;
}

.av-feature-table thead th {
  padding: var(--av-space-4) var(--av-space-5);
  font-family: var(--av-font-display);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
  text-align: left;
}

.av-feature-table thead th:nth-child(2) {
  text-align: center;
}

.av-feature-table tbody tr {
  border-bottom: 1px solid var(--av-border);
  transition: background 0.12s;
}

.av-feature-table tbody tr:nth-child(even) {
  background: var(--av-surface);
}

.av-feature-table tbody tr:last-child {
  border-bottom: none;
}

.av-feature-table tbody tr:hover {
  background: var(--av-surface-raise);
}

.av-feature-table td {
  padding: var(--av-space-4) var(--av-space-5);
  color: var(--av-text-muted);
  vertical-align: middle;
  line-height: 1.55;
}

.av-feature-table td:first-child { color: var(--av-text); }
.av-feature-table td:nth-child(2) { text-align: center; }

.av-status-pill {
  display: inline-block;
  padding: 0.25em 0.75em;
  border-radius: 999px;
  font-family: var(--av-font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(62, 201, 122, 0.14);
  color: var(--av-live-green);
  white-space: nowrap;
}


/* ── FAQ section (native details/summary — no Bootstrap) ─────────────────── */

.av-faq-section {
  background: var(--av-surface);
  border-top: 1px solid var(--av-border);
  border-bottom: 1px solid var(--av-border);
}

/* Constrain FAQ to a readable width — .av-container default (1200px) is too wide
   for an accordion; long Q&A lines stretch the full screen and break legibility. */
.av-faq-section .av-container {
  max-width: 800px;
}

.av-faq-group-heading {
  font-family: var(--av-font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--av-orange);
  margin: var(--av-space-7) 0 var(--av-space-3);
  padding-bottom: var(--av-space-3);
  border-bottom: 1px solid var(--av-border);
}

.av-faq-group-heading:first-child { margin-top: 0; }

.av-faq-item {
  border-bottom: 1px solid var(--av-border);
}

.av-faq-item:last-child { border-bottom: none; }

.av-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: var(--av-space-5) 0;
  font-family: var(--av-font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--av-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--av-space-4);
  user-select: none;
}

.av-faq-item summary::-webkit-details-marker { display: none; }

.av-faq-item summary::after {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23BCB9B9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.2s var(--av-ease-out);
}

.av-faq-item[open] summary::after {
  transform: rotate(180deg);
}

.av-faq-item summary:hover { color: var(--av-orange); }

.av-faq-body {
  padding: 0 0 var(--av-space-5);
  color: var(--av-text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.av-faq-body code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875em;
  background: var(--av-surface-raise);
  border: 1px solid var(--av-border);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  color: var(--av-orange);
}


/* ── CTA band ────────────────────────────────────────────────────────────── */

.av-xchg-cta {
  background: var(--av-orange);
  padding: var(--av-space-10) var(--av-space-5);
  text-align: center;
}

.av-xchg-cta h2 {
  font-family: var(--av-font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 var(--av-space-3);
}

.av-xchg-cta p {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.88);
  margin: 0 0 var(--av-space-6);
}

.av-xchg-cta .av-btn--light {
  background: #ffffff;
  color: var(--av-orange);
  border-color: #ffffff;
}

.av-xchg-cta .av-btn--light:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.88);
}


/* ── Comparable brokers grid ─────────────────────────────────────────────── */

.av-comparable {
  background: var(--av-bg);
}

.av-comparable__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--av-space-5);
  margin-top: var(--av-space-6);
}

/* Mustache renders directly into #comparable — target selector rules */
#comparable {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--av-space-5);
  margin-top: var(--av-space-6);
}

#comparable a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--av-space-2);
  text-decoration: none;
  color: var(--av-text-muted);
  font-size: 0.875rem;
  font-family: var(--av-font-display);
  font-weight: 500;
  padding: var(--av-space-4);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius-lg);
  background: var(--av-surface);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
  min-width: 100px;
}

#comparable a:hover {
  border-color: var(--av-orange);
  color: var(--av-text);
  transform: translateY(-2px);
}

#comparable img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
}


/* ── Status-pill variants ────────────────────────────────────────────────── */

/* Base .av-status-pill already defines padding/radius/font (green).
   These variants only override background + color. */
.av-status-pill--no   { background: rgba(220, 80, 80, 0.14);  color: #e06666; }
.av-status-pill--cond { background: rgba(224, 160, 48, 0.16); color: #e0a030; }


/* ── Trust strip ─────────────────────────────────────────────────────────── */

.av-xchg-trust { padding: var(--av-space-6) 0; }

.av-trust__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--av-space-6);
}

.av-trust__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 8rem;
}

.av-trust__num   { font-size: 2rem; font-weight: 700; color: var(--av-orange); }
.av-trust__label { font-size: .95rem; opacity: .8; }


/* ── Comparable card classes (data-driven template, replaces Bootstrap col-md-2/img-fluid) */

.av-comparable__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  width: 170px;
  padding: var(--av-space-4);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius-lg, 12px);
  background: var(--av-surface, #14161a);
  text-decoration: none;
  color: inherit;
  transition: transform .15s var(--av-ease-out), border-color .15s var(--av-ease-out), box-shadow .15s var(--av-ease-out);
}

.av-comparable__card:hover {
  transform: translateY(-2px);
  border-color: var(--av-orange);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

/* White tile keeps every real brand logo (mixed colorways) visible on any theme. */
.av-comparable__logo-tile {
  width: 100%;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Brand colour from the config (inline --av-tile-bg, injected by the exchange route);
     otherwise the theme-aware default so an uncoloured tile still separates from the card. */
  background: var(--av-tile-bg, var(--av-tile-bg-default, #ffffff));
  border-radius: var(--av-radius, 8px);
  padding: .7rem 1rem;
}

.av-comparable__logo { max-height: 100%; max-width: 100%; width: auto; object-fit: contain; display: block; }
.av-comparable__name { font-weight: 600; font-size: .95rem; text-align: center; }
.av-comparable__cue { font-size: .8rem; color: var(--av-orange); }
