/* The currency converter pages (/currency, /currency/<from>-<to>, generated by
   scripts/build-currency.mjs), on the site's tokens. Loads after data.css and
   before site.css and blog.css, so a rule that competes with those carries an
   extra class. */

.blog-head.cx-head { padding-top: 104px; padding-bottom: 0; }
@media (min-width: 900px) { .blog-head.cx-head { padding-top: 136px; } }
.cx-head .data-lead b { color: var(--text); font-weight: 800; }
.cx-page .data-body { padding-top: 4px; }

.cx [hidden], .cx-page [hidden] { display: none !important; }

/* ---------- the converter ---------- */

.cx { margin: 26px 0 8px; }
.cx-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--border-hi); border-radius: 22px;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  box-shadow: 0 30px 70px -44px rgba(0, 0, 0, 0.9);
}
@media (min-width: 640px) { .cx-card { padding: 24px; } }

.cx-row { display: flex; align-items: flex-end; gap: 10px; }
.cx-field { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.cx-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.cx-amount, .cx-out {
  width: 100%; min-height: 60px; padding: 10px 16px;
  border: 1px solid var(--border-hi); border-radius: 15px;
  font-family: var(--mono); font-size: clamp(21px, 6vw, 28px); font-weight: 700; line-height: 1.2;
  direction: ltr; text-align: right; font-variant-numeric: tabular-nums;
}
.cx-amount { background: var(--bg); color: var(--text); caret-color: var(--accent); }
.cx-amount:focus { outline: none; border-color: rgba(45, 212, 191, 0.6); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }
.cx-out {
  display: flex; align-items: center; justify-content: flex-end;
  background: rgba(45, 212, 191, 0.07); border-color: rgba(45, 212, 191, 0.28); color: var(--accent);
  white-space: nowrap; overflow-x: auto; scrollbar-width: none;
}
.cx-out::-webkit-scrollbar { display: none; }

.cx-cur {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  width: 112px; min-height: 60px; padding: 8px 12px;
  border: 1px solid var(--border-hi); border-radius: 15px; background: var(--card-hi);
  color: var(--text); font-family: var(--sans); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.cx-cur:hover { border-color: #3b4a61; background: #1a2231; }
.cx-cur:focus-visible, .cx-swap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cx-cur[aria-expanded="true"] { border-color: var(--accent); }
.cx-flag { font-size: 20px; line-height: 1; }
.cx-code { font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.cx-cur .cx-name { display: none; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-size: 14px; font-weight: 500; color: var(--muted); }
@media (min-width: 680px) { .cx-cur { width: 250px; } .cx-cur .cx-name { display: block; } }
.cx-chev { flex: 0 0 auto; margin-inline-start: auto; width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: rotate 0.2s; }
.cx-cur[aria-expanded="true"] .cx-chev { rotate: 180deg; stroke: var(--accent); }

.cx-swap-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.cx-swap-row::before, .cx-swap-row::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.cx-swap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border-hi); background: var(--card-hi); color: var(--accent);
  cursor: pointer; transition: border-color 0.2s, transform 0.25s;
}
.cx-swap:hover { border-color: var(--accent); }
.cx-swap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: rotate 0.3s; }
.cx-swap.is-flipped svg { rotate: 180deg; }
@media (prefers-reduced-motion: reduce) { .cx-swap svg, .cx-chev { transition: none; } }

.cx-meta { margin-top: 16px; font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.7; }
.cx-meta span[dir="ltr"] { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.cx-asof { margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--faint); line-height: 1.6; }
.cx-dot { margin-inline: 8px; color: var(--faint); }

/* The currency list. */
.cx-panel {
  position: absolute; inset-inline-end: 10px; z-index: 30;
  width: min(400px, calc(100% - 20px));
  padding: 10px;
  border: 1px solid var(--border-hi); border-radius: 18px; background: #0f1520;
  box-shadow: 0 28px 60px -14px rgba(0, 0, 0, 0.8);
}
.cx-search {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border-hi); border-radius: 12px; background: var(--bg);
  color: var(--text); font-family: var(--sans); font-size: 16px; font-weight: 500;
}
.cx-search::placeholder { color: var(--faint); }
.cx-search:focus { outline: none; border-color: rgba(45, 212, 191, 0.6); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }
.cx-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(340px, 50vh); overflow-y: auto; overscroll-behavior: contain; }
.cx-list-head { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; color: var(--faint); }
.cx-opt { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer; font-size: 15px; color: var(--text); }
.cx-opt-name { flex: 1 1 auto; min-width: 0; }
.cx-opt .cx-code { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cx-opt:hover, .cx-opt.is-active { background: rgba(45, 212, 191, 0.1); }
.cx-opt[aria-selected="true"] .cx-opt-name { color: var(--accent); font-weight: 700; }
.cx-empty { padding: 14px 10px 6px; font-size: 14px; color: var(--muted); }

/* ---------- the hub ---------- */

.cx-quick { margin-top: 24px; }
.cx-quick-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--muted); }
.cx-quick ul.data-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }

.cx-group-title { margin: 26px 0 10px; font-size: 15px; font-weight: 800; color: var(--muted); }
.data-section ul.cx-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.data-section ul.cx-tiles li { margin: 0; padding: 0; }
.data-section ul.cx-tiles li::before { content: none; }
.cx-tile {
  display: flex; flex-direction: column; gap: 3px; height: 100%;
  padding: 13px 14px 12px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--card);
  color: var(--text); line-height: 1.4; transition: border-color 0.2s;
}
.cx-tile:hover { border-color: var(--accent); color: var(--text); }
.cx-tile-name { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; }
.cx-tile-name .cx-flag { font-size: 18px; }
.cx-tile-val { margin-top: 4px; font-family: var(--mono); font-size: clamp(18px, 4.8vw, 21px); font-weight: 700; color: var(--accent); }
.cx-tile-sub { font-size: 12.5px; color: var(--faint); }

/* ---------- a pair ---------- */

.cx-tips { display: grid; gap: 10px; margin-top: 14px; }
.cx-tip {
  margin: 0; padding: 14px 16px;
  border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); border-radius: 14px;
  background: var(--card); font-size: 15.5px; line-height: 1.75; color: #cbd3df;
}
.cx-tip-title { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 800; color: var(--accent); }
.cx-tip b:not(.cx-tip-title) { color: var(--text); }
.cx-tip.is-k { border-inline-start-color: var(--amber); }
.cx-tip.is-k .cx-tip-title { color: var(--amber); }

.cx-tables { display: grid; gap: 22px; }
@media (min-width: 760px) { .cx-tables { grid-template-columns: 1fr 1fr; gap: 18px; } }
.cx-table-title { margin: 0 0 10px; font-size: 17px; font-weight: 800; line-height: 1.4; color: var(--text); }
.data-table.cx-table th.num { font-weight: 700; color: var(--text); }
.data-table.cx-table caption { white-space: normal; line-height: 1.6; }
.data-table.cx-table td, .data-table.cx-table th { width: 50%; }
.data-table.cx-table td.num, .data-table.cx-table thead th:last-child { text-align: left; }

.cx-reading { margin-top: 4px; }
