/* styles/biomes/tolls.css
   Biome 4 — The Plain of Tolls (Card Network).
   Vast salt-flat at dusk. Two ancient stylized monoliths (Visa +
   Mastercard, NEVER as logos). Deliberately no agency — you pay,
   you shrink, you pass. The lesson: Adyen does not own the schemes. */

#tolls {
  background: #2a1620;   /* fallback while SVG loads */
}

.tolls-architecture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---------- ASSEMBLY: figures + intent fade in after orientation ---------- */

.toll-figure,
#tolls-intent,
#tolls-value {
  opacity: 0;
  transition: opacity 1600ms ease;
}
#tolls.assembled .toll-figure,
#tolls.assembled #tolls-intent,
#tolls.assembled #tolls-value {
  opacity: 1;
}

/* ---------- VALUE HUD ----------
   The persistent Vitality HUD (engine/vitality.js, styles/vitality.css)
   subsumes this per-biome readout. Hide the in-scene box to avoid
   duplication and visual collision at top-right where the HUD lives.
   Element + IDs kept in markup for back-compat. */

#tolls-value { display: none; }
/* (legacy .tolls-value-label / #tolls-value-amount / .tolls-fee-flash
    rules removed — superseded by styles/vitality.css) */

/* ---------- INTENT CARD ---------- */

#tolls-intent {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 4;
  transform: translateX(-50%);
  /* `left` is its own slow transition (1200ms) so the card slides
     laterally to face each toll figure during ACT 6/7. `bottom`
     stays slow (2800ms) for the final upward "passage" beat. */
  transition: bottom 2800ms ease,
              transform 2800ms ease,
              left 1200ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* APPROACH states — card slides toward each toll figure for the
   exchange beat. Stacks with .shrunk-N (which applies to the inner
   .tolls-intent-card) so the card's lateral position is independent
   of its size. */
#tolls-intent.approaching-left      { left: 32%; }
#tolls-intent.approaching-right     { left: 68%; }
#tolls-intent.approaching-far-left  { left: 14%; }
#tolls-intent.approaching-far-right { left: 86%; }
#tolls-intent.approaching-center    { left: 50%; }

/* Extra toll figures (cross_border + marketplace) are hidden by
   default; the biome JS adds .scenario-active per-figure for the
   current scenario only. */
.toll-figure-extra { opacity: 0; transition: opacity 1600ms ease; }
.toll-figure-extra.scenario-active { opacity: 0.95; }
/* When the scene assembles, only scenario-active extras fade in
   alongside the main two figures. */
#tolls.assembled .toll-figure-extra.scenario-active { opacity: 0.95; }
.tolls-intent-card {
  width: 80px;
  height: 52px;
  background:
    linear-gradient(135deg, rgba(184, 224, 255, 0.55) 0%, rgba(120, 180, 220, 0.4) 100%);
  border: 1.5px solid rgba(184, 224, 255, 0.95);
  border-radius: 4px;
  box-shadow:
    0 0 24px  6px rgba(184, 224, 255, 0.35),
    0 0 60px 20px rgba(184, 224, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    var(--intent-trust-shadow);
  transition: transform 1400ms cubic-bezier(0.5, 0, 0.3, 1);
  position: relative;
}
.tolls-intent-card::before,
.tolls-intent-card::after {
  /* small chip + stripe — barely visible packet detail */
  content: '';
  position: absolute;
}
.tolls-intent-card::before {
  left: 10px; top: 14px;
  width: 14px; height: 10px;
  background: rgba(255, 240, 220, 0.4);
  border-radius: 1px;
}
.tolls-intent-card::after {
  right: 10px; bottom: 8px; left: 30px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}
.tolls-intent-card.shrunk-1 { transform: scale(0.88); }
.tolls-intent-card.shrunk-2 { transform: scale(0.74); }
.tolls-intent-card.shrunk-3 { transform: scale(0.62); }

#tolls-intent.passing {
  bottom: 48%;
  transform: translateX(-50%) scale(0.92);
}

/* ---------- TOLL FIGURE STATES ----------
   Three states across the exchange:
     default — dark monolith, no glow
     .collecting — transient orange-warm glow during the toll moment
     .fed — permanent post-toll teal glow + recolored body, signalling
            "this scheme has been satisfied." The teal is distinct
            from the Adyen green (#0abf53) — that color is reserved
            for moments when Adyen actively HELPS the player. The teal
            here means "the scheme took its cut and is now sated." */

.toll-figure {
  transition: filter 800ms ease;
}
.toll-figure polygon,
.toll-figure rect {
  transition: fill 1200ms ease, opacity 1200ms ease;
}
.toll-figure.collecting {
  filter: drop-shadow(0 0 22px rgba(255, 130, 90, 0.6));
}
.toll-figure.fed {
  filter: drop-shadow(0 0 28px rgba(120, 220, 180, 0.55));
}
.toll-figure.fed polygon { fill: #1a2d28; }
.toll-figure.fed rect    { fill: rgba(120, 220, 180, 0.45); opacity: 1; }

/* ---------- PER-ROUND GEOGRAPHIC TINT ----------
   Cross-border specifically uses Round 1 = international (US arms) and
   Round 2 = local (BR arms). The two pairs are visually identical
   monoliths by default — players don't FEEL the geographic split the
   narration is teaching. Tint Round 1 toward a cool foreign-blue and
   Round 2 toward a warm local-amber so the eye reads them as different
   "places" before the voice line lands. The tint applies on the resting
   state only; .collecting / .fed override with their own filters.
   Applied via [data-round] set by 04_tolls.js. */
.toll-figure[data-round="1"]:not(.collecting):not(.fed) polygon {
  fill: #1a2434;            /* cooler cobalt — foreign */
}
.toll-figure[data-round="2"]:not(.collecting):not(.fed) polygon {
  fill: #2a2018;            /* warmer umber — local */
}
/* Subtle inner lights pick up the same tonal split */
.toll-figure[data-round="1"]:not(.collecting):not(.fed) rect {
  fill: rgba(140, 180, 220, 0.32);
}
.toll-figure[data-round="2"]:not(.collecting):not(.fed) rect {
  fill: rgba(220, 180, 130, 0.32);
}

/* ---------- EXCHANGE BUBBLE ----------
   Spatial readout near each figure during the toll. Anchored to the
   figure's vertical line so the player's eye snaps from the card →
   the bubble → the figure. Bubble auto-removes after 2200ms. */
.tolls-exchange-bubble {
  position: absolute;
  z-index: 5;
  padding: 10px 18px;
  background: rgba(20, 8, 12, 0.95);
  border: 1px solid rgba(255, 168, 100, 0.65);
  border-radius: 2px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
  animation: tolls-bubble-appear 2200ms ease-out forwards;
  white-space: nowrap;
}
.tolls-exchange-bubble.left      { left: 32%; top: 38%; transform: translateX(-50%); }
.tolls-exchange-bubble.right     { left: 68%; top: 38%; transform: translateX(-50%); }
.tolls-exchange-bubble.far-left  { left: 14%; top: 42%; transform: translateX(-50%); }
.tolls-exchange-bubble.far-right { left: 86%; top: 42%; transform: translateX(-50%); }
.tolls-exchange-bubble.center    { left: 50%; top: 52%; transform: translateX(-50%); }

.teb-ask {
  display: block;
  font-size: 0.55rem;
  color: rgba(255, 168, 100, 0.7);
  margin-bottom: 4px;
}
.teb-amount {
  display: block;
  font-size: 1.05rem;
  color: rgba(255, 200, 160, 1);
  text-shadow: 0 0 12px rgba(255, 144, 80, 0.55);
}

@keyframes tolls-bubble-appear {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.92); }
  18%  { opacity: 1; transform: translateX(-50%) translateY(0)   scale(1); }
  78%  { opacity: 1; transform: translateX(-50%) translateY(0)   scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(1); }
}

/* ---------- CONTINUOUS HORIZON HAZE ----------
   Low-opacity warm radial gradient drifting horizontally over 22s.
   Separate from .tolls-dust (event-based, fast); this is background
   *air*. Loops back so the desert reads as a living place even
   between toll moments. */
.tolls-haze {
  position: absolute;
  top: 56%;
  left: -30%;
  width: 80%;
  height: 12%;
  background: radial-gradient(ellipse 50% 100% at 50% 50%,
    rgba(255, 168, 100, 0.045) 0%,
    rgba(255, 168, 100, 0.025) 40%,
    transparent                80%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 1600ms ease;
  animation: tolls-haze-drift 22s linear infinite;
}
#tolls.assembled .tolls-haze { opacity: 1; }
@keyframes tolls-haze-drift {
  0%   { transform: translateX(0); }
  100% { transform: translateX(160vw); }
}

/* ---------- AMBIENT DUST (engine/ambient.js) ---------- */

.tolls-dust {
  position: absolute;
  left: -120px;
  width: 240px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(232, 200, 180, 0.35) 50%,
    transparent 100%);
  filter: blur(1px);
  z-index: 2;
  pointer-events: none;
  animation: tolls-dust-cross 4500ms linear forwards;
}
@keyframes tolls-dust-cross {
  0%   { opacity: 0;    transform: translateX(0); }
  20%  { opacity: 0.85; }
  100% { opacity: 0;    transform: translateX(120vw); }
}

@media (prefers-reduced-motion: reduce) {
  #tolls-intent { transition-duration: 600ms; }
  .tolls-intent-card { transition-duration: 400ms; }
  .toll-figure, #tolls-intent, #tolls-value { transition-duration: 300ms; }
  .toll-figure polygon, .toll-figure rect { transition-duration: 400ms; }
  .tolls-fee-flash { animation-duration: 600ms; }
  .tolls-dust { animation-duration: 1500ms; }
  .tolls-exchange-bubble { animation-duration: 900ms; }
  .tolls-haze { animation: none; }
}

/* ---------- MOBILE (C7) ----------
   The exchange bubbles overlap the intent card on narrow viewports.
   Shrink them, scale down the intent card, and reduce monolith
   widths so the no-agency choreography still reads. */
@media (max-width: 520px) {
  .tolls-exchange-bubble {
    font-size: 0.62rem;
    padding: 8px 10px;
  }
  .teb-amount { font-size: 0.9rem; }
  .tolls-intent-card {
    width: 64px;
    height: 42px;
  }
  #tolls-value { font-size: 0.85rem; }
}
