/* =========================================================================
   currency.ae — styles.css
   Premium fintech aesthetic: deep emerald base, cyan→violet accents,
   gold used sparingly. Mobile-first. Numbers are the heroes.
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Emerald base (near-black greens) */
  --bg:            #04120f;
  --bg-2:          #061a16;
  --surface:       #082019;
  --surface-2:     #0b2a22;
  --surface-3:     #0f342a;
  --border:        #14453a;
  --border-soft:   #123c31;

  /* Text */
  --text:          #eafff7;
  --text-muted:    #8fb7ab;
  --text-dim:      #5f8579;

  /* Accents */
  --cyan:          #22d3ee;
  --violet:        #8b5cf6;
  --emerald:       #10b981;
  --gold:          #e8c874;
  --gold-deep:     #d4af37;
  --up:            #34d9a6;
  --down:          #ff8a8a;
  --amber:         #e6b566;   /* calm, muted — for the "stale/delayed" state */

  /* Gradients */
  --grad-accent:   linear-gradient(100deg, var(--cyan), var(--violet));
  --grad-text:     linear-gradient(100deg, #5eead4, #22d3ee 40%, #a78bfa);

  /* Shape & motion */
  --radius:        18px;
  --radius-sm:     12px;
  --radius-lg:     26px;
  --tap:           48px;               /* min tap target, exceeds 44px */
  --ease:          cubic-bezier(0.22, 1, 0.36, 1);
  --shadow:        0 20px 60px -20px rgba(0, 0, 0, 0.7);

  --wrap:          1080px;
  --font-ui:       'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---- Reset-ish ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* The HTML `hidden` attribute must always win. Without this, author rules like
   `.banner { display: flex }` override the UA `[hidden] { display: none }`, so
   toggling `.hidden` in JS wouldn't actually hide the element. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Monospace numerals with fixed-width figures — precise, tabular. */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.grad {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Ambient background aura — pure CSS radial glows, no images. */
.bg-aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 78% -5%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(55% 40% at 10% 5%, rgba(34, 211, 238, 0.12), transparent 60%),
    radial-gradient(80% 60% at 50% 110%, rgba(16, 185, 129, 0.10), transparent 60%),
    var(--bg);
}

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
}
/* The Dirham Coin logo mark — a minted, flippable 3D coin (gold rim, emerald
   face, the UAE dirham symbol). Flips are driven by JS (main.js); the motion
   here is GPU-only (transform/opacity). */
.coin {
  /* display:inline-block so width/height apply even outside a flex context.
     (In the header it's a flex item, but being explicit avoids surprises.) */
  display: inline-block;
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
  perspective: 700px;
}
.coin__inner {
  /* MUST be block: these are <span>s (valid inside the logo <a>), and an
     inline span ignores width/height:100%, which collapses the coin to 0×0
     and hides it (notably in Safari). */
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.2, 0.75, 0.2, 1);
}
.coin__face {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  box-shadow: 0 5px 14px -5px rgba(0, 0, 0, 0.7);
}
.coin__svg { display: block; width: 100%; height: 100%; }
.coin__face--back { transform: rotateY(180deg); }
/* A soft specular sheen drifting slowly across the minted face. */
.coin__sheen {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 34%,
    rgba(255, 255, 255, 0.34) 48%,
    transparent 62%
  );
  mix-blend-mode: screen;
  animation: coinSheen 6.5s ease-in-out infinite;
}
@keyframes coinSheen {
  0%, 100% { transform: translateX(-45%); }
  50%      { transform: translateX(45%); }
}
.brand__lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.06;
}
.brand__word {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.brand__dot { color: var(--gold); }
.brand__tagline {
  display: none; /* mobile: hidden here, lives in the hero instead */
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.site-nav a {
  position: relative;
  padding: 4px 2px;
  white-space: nowrap; /* "World rates" must never wrap to two lines */
  transition: color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--text); }
/* Active nav item gets a sparing gold underline (scroll-spy adds .is-active). */
.site-nav a.is-active { color: var(--text); }
.site-nav a.is-active::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
}

/* =========================================================================
   Banner (rates unavailable)
   ========================================================================= */
/* Calm, demoted "rates unavailable" notice. It sits BELOW the hero and never
   shouts — muted amber text, a hairline border, no filled background. */
.banner {
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent);
  color: var(--amber);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 9px;
}
.banner__icon { opacity: 0.85; flex: none; }

/* =========================================================================
   Hero + Converter
   ========================================================================= */
.hero {
  position: relative;
  padding: 16px 0 10px;
  overflow: hidden; /* contain the aurora */
}
.hero__grid { position: relative; z-index: 1; }

.hero__eyebrow {
  margin: 2px 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hero__title {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 7vw, 3rem);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 18ch;
}
.hero__subline {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: clamp(0.86rem, 2.6vw, 1.02rem);
  line-height: 1.45;
  max-width: 42ch;
}

/* --- Ambient aurora: slow, low-contrast emerald/cyan drift. GPU-friendly:
   only transform + opacity animate. Disabled under reduced-motion below. --- */
.hero__aurora {
  position: absolute;
  inset: -20% -10% -30%;
  z-index: 0;
  pointer-events: none;
  filter: blur(58px) saturate(1.15);
  opacity: 0.72; /* one notch brighter than before, still ambient */
}
.hero__blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  max-width: 520px;
  max-height: 520px;
  border-radius: 50%;
  will-change: transform, opacity;
}
.hero__blob--a {
  top: -8%; left: -6%;
  background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.62), transparent 66%);
  animation: drift-a 22s ease-in-out infinite;
}
.hero__blob--b {
  top: 10%; right: -8%;
  background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.5), transparent 66%);
  animation: drift-b 27s ease-in-out infinite;
}
.hero__blob--c {
  bottom: -18%; left: 30%;
  background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.36), transparent 66%);
  animation: drift-c 32s ease-in-out infinite;
}
@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.55; }
  50%      { transform: translate3d(6%, 4%, 0) scale(1.12); opacity: 0.8; }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); opacity: 0.5; }
  50%      { transform: translate3d(-5%, 6%, 0) scale(0.92); opacity: 0.72; }
}
@keyframes drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.4; }
  50%      { transform: translate3d(4%, -5%, 0) scale(1.1); opacity: 0.62; }
}

/* The converter card */
.converter {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* A deliberate 2px accent along the very top edge: emerald → cyan → gold,
   inset to the card's rounded corners so it reads as intentional trim. */
.converter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--emerald), var(--cyan) 55%, var(--gold));
}

.converter__field { margin-bottom: 12px; }

.field-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.amount-input {
  width: 100%;
  height: 60px;
  padding: 0 16px;
  font-size: 1.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.amount-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

/* From / swap / To layout */
.converter__pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 10px;
}
.converter__field--pair { margin-bottom: 0; }

.swap {
  width: var(--tap);
  height: var(--tap);
  margin-bottom: 2px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.5s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.swap:hover {
  background: var(--surface-3);
  border-color: var(--gold); /* gold on hover — the precious-metal touch */
  box-shadow: 0 0 0 3px rgba(232, 200, 116, 0.14);
}
.swap:active { transform: scale(0.94); }
.swap__icon { font-size: 1.25rem; line-height: 1; }
.swap.is-spun { transform: rotate(180deg); }

/* Result */
.result {
  margin-top: 16px;
  padding: 18px 16px 16px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(16, 185, 129, 0.10), transparent 70%),
    var(--bg);
  border: 1px solid var(--border-soft);
}
.result__value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.result__value {
  font-size: clamp(2.1rem, 10vw, 3.2rem);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  transition: color 0.25s var(--ease);
}
/* Subtle flash when the number changes — never jarring. */
.result__value.is-updated { animation: valuePulse 0.42s var(--ease); }
/* Unmistakable-but-elegant glow when a number ticks: a bright cyan flash that
   holds briefly, then resolves back to normal. Used by the converter result,
   board rows, and pulse cards. */
@keyframes valuePulse {
  0%   { color: var(--cyan); text-shadow: 0 0 24px rgba(34, 211, 238, 0.85); }
  30%  { color: var(--cyan); text-shadow: 0 0 20px rgba(34, 211, 238, 0.7); }
  100% { color: var(--text); text-shadow: none; }
}

/* Perceptible "breathing" tick when data refreshes but the value is UNCHANGED
   (e.g. all weekend, when FX is frozen) — a clear emerald flash that holds
   briefly then settles, so a refresh is always visible. Distinct from the cyan
   glow used when a value actually changes. */
.result__value.is-tick-soft,
.board-row__rate.is-tick-soft,
.pulse-card__rate.is-tick-soft { animation: tickSoft 0.7s var(--ease); }
@keyframes tickSoft {
  0%   { color: var(--up); }
  35%  { color: var(--up); }
  100% { color: var(--text); }
}
.result__value.is-unavailable { color: var(--text-dim); }

.result__code {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.result__rate {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.rate-line__mono { color: var(--text); font-weight: 500; }
.rate-line__pair { color: var(--text); }
.result__rate.is-error { color: var(--down); }

.update-status {
  margin: 14px 2px 2px;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Visible heartbeat: on every refresh the "updated" line flashes emerald and
   gives a small pop, so the 60s cycle is unmistakable even when nothing moved. */
.update-status.is-refreshed {
  animation: statusPulse 0.9s var(--ease);
  transform-origin: left center;
}
@keyframes statusPulse {
  0%   { color: var(--up); transform: scale(1.06); }
  22%  { color: var(--up); transform: scale(1.06); }
  100% { color: var(--text-dim); transform: scale(1); }
}
/* Make the dot itself flare on refresh too (it's re-rendered each second, so we
   drive the flare from the container class, not the dot's own state). */
.update-status.is-refreshed .status-dot {
  box-shadow: 0 0 10px 2px rgba(52, 217, 166, 0.9);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
}
/* Fresh data: green, with a clearly-visible expanding pulse ring. */
.status-dot.is-fresh {
  background: var(--emerald);
  box-shadow: 0 0 8px 1px rgba(52, 217, 166, 0.7);
  animation: pulse 2s var(--ease) infinite;
}
/* Stale/delayed data: amber, static (calm, matches the demoted banner). */
.status-dot.is-stale {
  background: var(--amber);
  box-shadow: none;
  animation: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 8px 1px rgba(52, 217, 166, 0.7), 0 0 0 0 rgba(52, 217, 166, 0.65); }
  70%  { box-shadow: 0 0 8px 1px rgba(52, 217, 166, 0.5), 0 0 0 11px rgba(52, 217, 166, 0); }
  100% { box-shadow: 0 0 8px 1px rgba(52, 217, 166, 0.7), 0 0 0 0 rgba(52, 217, 166, 0); }
}

/* =========================================================================
   Market pulse panel (hero right column on desktop)
   ========================================================================= */
.pulse {
  margin-top: 18px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.pulse__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.pulse__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pulse__sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.pulse__list {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2x2 on mobile */
  gap: 10px;
}

.pulse-card {
  position: relative;
  padding: 11px 12px 9px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.pulse-card__head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.pulse-card__icon { font-size: 1.1rem; line-height: 1; }
.pulse-card__code {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
}
.pulse-card__chg {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.pulse-card__chg--up { color: var(--up); }
.pulse-card__chg--down { color: var(--down); }
.pulse-card__chg--flat { color: var(--text-dim); }
.pulse-card__chg {
  padding: 1px 4px;
  border-radius: 6px;
}
/* Briefly highlight the % badge when its value changes. */
.pulse-card__chg.is-bump { animation: chgBump 0.5s var(--ease); }
.pulse-card__rate {
  font-size: 1.12rem;
  font-weight: 500;
  margin: 5px 0 2px;
  transition: color 0.25s var(--ease);
}
.pulse-card__rate.is-tick { animation: valuePulse 0.42s var(--ease); }
.pulse-card.is-loading .pulse-card__rate { color: var(--text-dim); }

/* Sparkline */
.spark-wrap { position: relative; height: 30px; margin-top: 3px; }
.spark { display: block; width: 100%; height: 100%; }
.spark__line {
  stroke: #35e0ac;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke; /* keep line weight even when stretched */
  stroke-dasharray: 100;             /* pathLength=100, so this is the full line */
  stroke-dashoffset: 0;
}
/* Arrival: draw the line on from left to right, once. */
.spark__line.is-drawing { animation: sparkDraw 0.8s ease-out; }
@keyframes sparkDraw {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}
.spark-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #eafff7;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px 1px rgba(53, 224, 172, 0.9);
  animation: sparkdot 2.2s ease-in-out infinite;
}
@keyframes sparkdot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Pulse tiles are tappable (open a detail view). */
.pulse-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pulse-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pulse-card:active { transform: scale(0.985); }

/* --- Pulse detail modal (lightweight; full charts are post-launch) --- */
.pulse-detail {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.pulse-detail__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 6, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pulse-detail__card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px 20px;
  box-shadow: var(--shadow);
  animation: pdIn 0.2s var(--ease);
}
@keyframes pdIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.pulse-detail__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.pulse-detail__close:hover { border-color: var(--gold); color: var(--text); }
.pulse-detail__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-right: 40px; }
.pulse-detail__icon { font-size: 1.6rem; line-height: 1; }
.pulse-detail__title { font-weight: 600; font-size: 0.98rem; }
.pulse-detail__figure {
  font-size: clamp(1.7rem, 8vw, 2.2rem);
  font-weight: 600;
  line-height: 1.1;
}
.pulse-detail__chg { margin-top: 6px; font-family: var(--font-mono); font-size: 1rem; }
.pulse-detail__chg--up { color: var(--up); }
.pulse-detail__chg--down { color: var(--down); }
.pulse-detail__chg--flat { color: var(--text-dim); }
.pulse-detail__sparkwrap { margin-top: 18px; height: 120px; }
.pulse-detail__spark { display: block; width: 100%; height: 100%; }
.pulse-detail__note { margin: 14px 0 0; font-size: 0.74rem; color: var(--text-dim); }

/* =========================================================================
   Searchable dropdown
   ========================================================================= */
.dropdown { position: relative; }

.dropdown__trigger {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.dropdown__trigger:hover { border-color: var(--border); background: var(--surface); }
.dropdown.is-open .dropdown__trigger,
.dropdown__trigger:focus-visible {
  border-color: var(--gold); /* sparing gold accent on the selectors */
  box-shadow: 0 0 0 3px rgba(232, 200, 116, 0.18);
  outline: none;
}
.dropdown__flag { font-size: 1.3rem; line-height: 1; flex: none; }
.dropdown__code {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.dropdown__chevron {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: transform 0.2s var(--ease);
}
.dropdown.is-open .dropdown__chevron { transform: rotate(180deg); }

.dropdown__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  animation: ddIn 0.16s var(--ease);
}
@keyframes ddIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown__search {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  margin-bottom: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  outline: none;
}
.dropdown__search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 200, 116, 0.14);
}
.dropdown__search::placeholder { color: var(--text-dim); }

.dropdown__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 264px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dropdown__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dropdown__option:hover,
.dropdown__option.is-active {
  background: var(--surface-3);
}
.dropdown__option.is-selected { background: color-mix(in srgb, var(--emerald) 16%, transparent); }
.dropdown__opt-code {
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 3.4em;
}
.dropdown__opt-name {
  color: var(--text-muted);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown__empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
}

/* =========================================================================
   World rates board
   ========================================================================= */
.board-section { padding: 34px 0 30px; }

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-title {
  margin: 0;
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.board-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.board-base { min-width: 148px; }

/* Small honest footnote about the gold (PAXG) and crypto rows. */
.board-note {
  margin: 16px 2px 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 68ch;
}
.board-note strong { color: var(--text-muted); font-weight: 600; }

.board-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-width: 0; /* grid item: allow it to shrink to the track (no overflow) */
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.board-row:hover { border-color: var(--border); transform: translateY(-1px); }
.board-row__icon { font-size: 1.5rem; line-height: 1; flex: none; width: 28px; text-align: center; }
/* meta absorbs slack and truncates the name so the rate is never pushed off. */
.board-row__meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.board-row__code { font-family: var(--font-mono); font-weight: 600; font-size: 1.02rem; }
.board-row__name {
  color: var(--text-muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-row__values {
  flex: none; /* the rate + change keep their width and never clip */
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.board-row__rate {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.12rem;
  font-weight: 500;
  transition: color 0.25s var(--ease);
}
/* Brief glow when a row's rate ticks to a new value. */
.board-row__rate.is-tick { animation: valuePulse 0.42s var(--ease); }
/* Base-currency unit shown on inverted rows, e.g. gold "15,300.00 AED". */
.board-row__unit {
  margin-left: 4px;
  font-family: var(--font-ui);
  font-size: 0.62em;
  font-weight: 400;
  color: var(--text-muted);
}

.board-row__change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  min-height: 1em;
  padding: 1px 4px;
  border-radius: 6px;
}
.board-row__change--up { color: var(--up); }
.board-row__change--down { color: var(--down); }
.board-row__change--flat { color: var(--text-dim); }
.board-row__dir { font-size: 0.66rem; }
.board-row__pct { letter-spacing: -0.01em; }
/* Briefly highlight the % badge when its value changes. */
.board-row__change.is-bump { animation: chgBump 0.5s var(--ease); }
@keyframes chgBump {
  0%   { background: color-mix(in srgb, currentColor 24%, transparent); }
  100% { background: transparent; }
}

/* Skeleton loaders */
.skeleton-bar {
  display: inline-block;
  height: 0.8em;
  min-width: 48px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  color: transparent;
}
.board-row.is-skeleton .board-row__icon {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2);
  animation: shimmer 1.3s linear infinite;
  background-size: 200% 100%;
}
.board-row__code.skeleton-bar { width: 54px; margin-bottom: 6px; }
.board-row__name.skeleton-bar { width: 120px; height: 0.7em; }
.board-row__rate.skeleton-bar { width: 80px; margin-left: auto; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-2);
}
.site-footer__inner {
  display: grid;
  gap: 20px;
  padding-top: 28px;
  padding-bottom: 34px;
}
.site-footer__tag { margin: 6px 0 0; color: var(--text-muted); font-size: 0.9rem; }
/* Refined footnote: smaller, airier line-height, lighter — not a grey block. */
.site-footer__meta {
  color: color-mix(in srgb, var(--text-dim) 88%, transparent);
  font-size: 0.75rem;
  line-height: 1.65;
}
.site-footer__meta p { margin: 0 0 9px; max-width: 58ch; }
.site-footer__meta strong { color: var(--text-muted); font-weight: 600; }
.site-footer__disclaimer { color: color-mix(in srgb, var(--text-dim) 72%, transparent); }
.site-footer__legal {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

/* =========================================================================
   Responsive — tablet & desktop
   ========================================================================= */
@media (min-width: 720px) {
  .board-grid { grid-template-columns: 1fr 1fr; }
  .site-footer__inner {
    grid-template-columns: 1fr 1.4fr;
    align-items: start;
  }
  /* On desktop the tagline lives beside the wordmark; the hero eyebrow (its
     mobile home) is hidden to avoid saying it twice. */
  .brand__tagline { display: block; }
  .hero__eyebrow { display: none; }
}

@media (min-width: 900px) {
  .hero { padding: 40px 0 24px; }
  .amount-input { height: 64px; font-size: 2rem; }

  /* Two-column hero: headline + converter on the left, market pulse rail on
     the right. Mobile stays single-column (converter first) by default. */
  .hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: 30px;
    align-items: start;
  }
  .hero__main { min-width: 0; }
  .hero__main .converter { max-width: none; }
  .pulse { margin-top: 0; position: sticky; top: 76px; }
  .pulse__list { grid-template-columns: 1fr; } /* stack in the narrow rail */

  /* Denser, terminal-like rate cards (~15% less vertical padding). */
  .board-row { padding: 12px 16px; }
}

/* Board expands to 3 columns on wide screens. */
@media (min-width: 1000px) {
  .board-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* =========================================================================
   Mobile refinements (phones)
   ========================================================================= */
@media (max-width: 600px) {
  /* Header: breathing room between the logo and the nav; compact nav. */
  .site-header__inner { gap: 16px; }
  .coin { width: 34px; height: 34px; }
  .brand { gap: 9px; }
  .brand__word { font-size: 1.05rem; }
  .site-nav { gap: 16px; font-size: 0.86rem; }

  /* Converter result: give the product's answer real presence. */
  .result { padding: 22px 18px 18px; }
  .result__value { font-size: clamp(2.7rem, 14vw, 3.6rem); font-weight: 700; }
  .result__code { font-size: 1.25rem; }
  .result__rate { font-size: 1rem; margin-top: 12px; }
}

/* =========================================================================
   Accessibility & motion
   ========================================================================= */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* Fully stop decorative motion for these users. */
  .hero__blob,
  .spark-dot,
  .status-dot,
  .coin__sheen { animation: none !important; }
  .coin__inner { transition: none !important; } /* no flip */
  .hero__aurora { opacity: 0.4; } /* keep it calm and static */
}

/* Respect iOS safe areas (notch) so the sticky header/content clear it. */
@supports (padding: max(0px)) {
  .wrap {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}
