/* usdiqd.com staging frontend — Direction 2 (Fintech Dark).
 * Everything derives from tokens.css. */

* { box-sizing: border-box; margin: 0; }

html { background: var(--bg); scroll-behavior: smooth; }
body {
  background:
    radial-gradient(80rem 40rem at 50% -14rem, var(--accent-soft), transparent),
    linear-gradient(180deg, var(--bg2), var(--bg) 40rem);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.75;
  min-height: 100vh;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---- ticker strip ---- */
.ticker {
  overflow: hidden; white-space: nowrap; direction: ltr;
  border-block-end: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(8px);
  font-size: var(--step--1);
}
.ticker .in { display: inline-block; padding-block: 6px; animation: tick 38s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker span { margin-inline: 18px; color: var(--muted); }
.ticker b { color: var(--text); font-weight: 700; }
.ticker .up { color: var(--accent); }

/* ---- header ---- */
header.site {
  max-width: 720px; margin-inline: auto; padding: var(--sp-4) var(--sp-4) var(--sp-2);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; direction: ltr; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: var(--on-accent); font-weight: 800; font-size: .95rem;
  box-shadow: 0 0 24px -4px var(--accent-glow);
}
.brand .iq { color: var(--accent); }
.brand .dc { color: var(--muted); font-weight: 500; }
.beta {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 1px var(--sp-2); margin-inline-start: var(--sp-2); font-weight: 600;
}
nav.locales { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
nav.locales a {
  color: var(--muted); text-decoration: none; font-size: var(--step--1); font-weight: 600;
  border-radius: var(--r-pill); padding: 3px 13px;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
nav.locales a.on { background: var(--accent); color: var(--on-accent); }
nav.locales a:not(.on):hover { color: var(--text); }

main { max-width: 720px; margin-inline: auto; padding: 0 var(--sp-4) var(--sp-7); }

/* ---- cards ---- */
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--sp-5); margin-block-end: var(--sp-4);
  transition: border-color var(--dur) var(--ease);
}
@media (prefers-reduced-motion: no-preference) {
  main .card { animation: fadeUp .5s cubic-bezier(.2, .7, .3, 1) backwards; }
  main .card:nth-of-type(2) { animation-delay: .05s; }
  main .card:nth-of-type(3) { animation-delay: .10s; }
  main .card:nth-of-type(4) { animation-delay: .15s; }
  main .card:nth-of-type(5) { animation-delay: .20s; }
  main .card:nth-of-type(6) { animation-delay: .25s; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
}
.sect { color: var(--muted); font-size: var(--step--1); font-weight: 700; display: flex; gap: var(--sp-2); align-items: center; }
.sect::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); flex: none; }
.gold-card .sect::before { background: var(--gold); box-shadow: 0 0 10px var(--gold-glow); }
.chead { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-block-end: var(--sp-3); }
.srcline { color: var(--muted); font-size: var(--step--1); margin-block-start: var(--sp-3); }

/* ---- hero ---- */
.hero { text-align: center; padding: var(--sp-6) var(--sp-4) var(--sp-5); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto 15% -60px; height: 120px; border-radius: 50%;
  background: var(--accent-glow); filter: blur(60px); opacity: .5; pointer-events: none;
}
.live {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  font-size: var(--step--1); font-weight: 700; letter-spacing: .02em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--r-pill); padding: 3px 14px; margin-block-end: var(--sp-3);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.6s ease-in-out infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
.live.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.live.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 40%, transparent);  background: var(--bad-soft); }
.live .upd { color: var(--muted); font-weight: 500; }
.hero .big {
  font-size: var(--step-hero); font-weight: 800; line-height: 1.12; letter-spacing: 1px;
  text-shadow: 0 0 44px var(--accent-glow);
}
/* the rate as one equation: $100 = 151,739 IQD — unit and value share a baseline
 * and bump together when the rate changes */
.eq { display: flex; align-items: baseline; justify-content: center; gap: 12px; flex-wrap: wrap; direction: ltr; }
.eqfrom {
  font-weight: 800; font-size: var(--step-1); color: var(--accent);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: var(--r-pill); padding: 1px 15px;
}
.eqeq { color: var(--muted); font-weight: 600; font-size: var(--step-2); }
.equnit { color: var(--muted); font-weight: 700; font-size: var(--step-1); }
.eq.bump { animation: bump .5s var(--ease); }
@keyframes bump { 35% { transform: scale(1.02); } }
.hero .unit { color: var(--muted); font-size: var(--step-0); margin-block-start: 2px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-block-start: var(--sp-5); }
@media (max-width: 560px) { .statgrid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--line); border-radius: var(--r-tile); padding: var(--sp-2);
}
.stat .k { color: var(--muted); font-size: .74rem; }
.stat .v { font-weight: 800; font-size: 1.06rem; }
.stat .v.up { color: var(--accent); }
.stat .s { color: var(--muted); font-size: .7rem; }

/* ---- loading skeleton: quiet pulsing blocks, never a fake number ---- */
#content.skel :is(#m-per100, #m-buy, #m-sell, #o-per100, #gap-pct) {
  color: transparent !important;
  background: var(--line);
  display: inline-block;
  min-inline-size: 5ch;
  border-radius: 6px;
  animation: skel-pulse 1.4s var(--ease) infinite;
  user-select: none;
  text-shadow: none;
}
@keyframes skel-pulse { 50% { opacity: .45; } }

/* ---- city board ---- */
table.board { width: 100%; border-collapse: collapse; }
table.board td { padding: 9px 6px; border-block-end: 1px solid var(--line); font-size: .92rem; }
table.board tr:last-child td { border-block-end: 0; }
table.board td.cn { color: var(--muted); }
table.board td.n { text-align: left; font-weight: 700; white-space: nowrap; }
table.board tr { transition: background-color var(--dur) var(--ease); }
table.board tr:hover { background: var(--accent-soft); }
.cur { color: var(--muted); font-size: .72em; font-weight: 600; }

/* ---- calculator ---- */
.fl { color: var(--muted); font-size: .78rem; font-weight: 600; display: block; margin-block-end: 4px; }
.calcrow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-block-start: var(--sp-3); }
@media (max-width: 560px) { .calcrow { grid-template-columns: 1fr; } }
.finp {
  display: flex; align-items: center; gap: var(--sp-2);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1.5px solid var(--line); border-radius: var(--r-tile); padding: 11px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.finp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.finp input {
  border: 0; background: transparent; color: var(--text); font: inherit;
  font-weight: 700; font-size: 1.12rem; width: 100%; outline: none;
}
.finp .cur { font-size: .85rem; font-weight: 700; }
select {
  width: 100%; background: color-mix(in srgb, var(--bg) 60%, transparent);
  color: var(--text); border: 1.5px solid var(--line); border-radius: var(--r-tile);
  padding: 11px 14px; font: inherit;
}

/* ---- metals ---- */
.metals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 560px) { .metals { grid-template-columns: 1fr; } }
.metals .card { margin-block-end: 0; }
.metal .mv { font-size: var(--step-3); font-weight: 800; margin-block: 2px; }
.gold-card .mv { color: var(--gold); }
.metal .ms { color: var(--muted); font-size: .78rem; }

/* ---- chart ---- */
.tfs { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; flex-wrap: wrap; }
.tfs button {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: .78rem; font-weight: 600; border-radius: var(--r-pill);
  padding: 3px 12px; cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tfs button:not(.on):hover { color: var(--text); }
.tfs button.on { background: var(--accent); color: var(--on-accent); }
#chart { width: 100%; height: auto; display: block; direction: ltr; cursor: crosshair; touch-action: pan-y; }

/* ---- notice / failure ---- */
.notice {
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  background: var(--bad-soft); border-radius: var(--r-card);
  padding: var(--sp-4) var(--sp-5); color: var(--text); font-size: var(--step--1);
  margin-block-end: var(--sp-4);
}
.notice a { color: var(--accent); }

.note { color: var(--muted); font-size: var(--step--1); }

/* ---- sticky mini rate bar ---- */
.minibar {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4);
  align-items: baseline; justify-content: center;
  padding: var(--sp-2) var(--sp-5);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--line);
  font-size: var(--step--1);
  transform: translateY(-100%);
  transition: transform var(--dur) var(--ease);
}
.minibar.show { transform: translateY(0); }
.minibar .num { font-weight: 800; }
.minibar .lbl { color: var(--muted); }

footer.site {
  max-width: 720px; margin-inline: auto; padding: var(--sp-4) var(--sp-4) var(--sp-6);
  color: var(--muted); font-size: .78rem; border-block-start: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
}
footer.site a { color: var(--muted); }
