/* ==========================================================================
   PortRisk — Premium Redesign · Design System
   Brand palette preserved: accent #a855f7 on #0d0f1a. Elevated, animated, glass.
   ========================================================================== */

/* ── Мягкие кросс-переходы между страницами (Chrome View Transitions) ──────────
   Плавный фейд вместо резкой перезагрузки — при навигации и переключении валюты.
   Браузеры без поддержки просто игнорируют; prefers-reduced-motion уважается
   нативно (анимация пропускается). */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .28s; }

:root {
  /* Brand (from your design system) */
  --accent:        #a855f7;
  --accent-2:      #7c3cff;
  --accent-3:      #c4b0ff;
  --accent-dim:    rgba(168, 85, 247, 0.14);
  --accent-glow:   rgba(168, 85, 247, 0.45);

  /* Surfaces */
  --bg:            #0a0b12;
  --bg-2:          #0d0f1a;
  --surface:       rgba(255, 255, 255, 0.045);
  --surface-2:     rgba(255, 255, 255, 0.065);
  --surface-hover: rgba(255, 255, 255, 0.085);
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text:   #f8fafc;
  --text-2: rgba(255, 255, 255, 0.68);
  --text-3: rgba(255, 255, 255, 0.44);

  /* Signals */
  --up:      #4ade80;
  --down:    #f87171;
  --warn:    #fcd34d;
  --crit-bg: rgba(239, 68, 68, 0.14);

  /* Radius */
  --r-card: 18px;
  --r-btn:  11px;
  --r-pill: 999px;
  --r-input:11px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  .5s;

  /* Fonts */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }
/* Dark root background so the rubber-band overscroll area (top/bottom) never
   flashes the browser's default white behind the page. */
html { scroll-behavior: smooth; background: #0a0b12; }
html, body { overscroll-behavior: none; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 620px at 78% -10%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(900px 560px at 4% 10%, rgba(124, 60, 255, 0.11), transparent 62%),
    radial-gradient(700px 700px at 50% 120%, rgba(168, 85, 247, 0.08), transparent 60%),
    linear-gradient(180deg, #0b0c15 0%, #0a0b12 46%, #090a11 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Ambient animated aurora layer */
body::before {
  content: "";
  position: fixed; inset: -20% -10% auto -10%;
  height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 300px at 20% 30%, rgba(168,85,247,0.10), transparent 70%),
    radial-gradient(520px 280px at 80% 20%, rgba(124,60,255,0.09), transparent 70%);
  filter: blur(20px);
  animation: aurora 18s var(--ease) infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(-3%, 0, 0) scale(1); opacity: .8; }
  100% { transform: translate3d(4%, 2%, 0) scale(1.08); opacity: 1; }
}

h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.mono { font-family: var(--mono); }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
.muted { color: var(--text-3); }

/* Layout ---------------------------------------------------------------- */
.wrap { width: min(1200px, 92vw); margin: 0 auto; }
.section { padding: 84px 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent-3);
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }

/* Navbar ---------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(180deg, rgba(10,11,18,0.82), rgba(10,11,18,0.55));
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 22px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { width: 26px; height: 26px; filter: drop-shadow(0 0 10px var(--accent-glow)); }
.brand-word { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.03em; }
.brand-word b { color: var(--accent-3); font-weight: 700; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 8px 13px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 500;
  color: var(--text-2); transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); background: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(168,85,247,0.28); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-pill); overflow: hidden;
  background: var(--surface); font-size: 12px; font-weight: 600;
}
.toggle button { border: 0; background: transparent; color: var(--text-3); padding: 6px 11px; cursor: pointer; font: inherit; transition: .2s; }
.toggle button.on { color: #fff; background: var(--accent); }
.nav-clock { font-family: var(--mono); font-size: 12px; color: var(--up); display: inline-flex; align-items: center; gap: 7px; }
.nav-clock::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.nav-desk { display: inline-flex; align-items: center; gap: 10px; }
.menu-extra { display: none; }
.nav-burger { display:none; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; border:1px solid var(--border); background: var(--surface); color: var(--text); cursor:pointer; }
.nav-burger:hover { background: var(--surface-hover); }

/* Buttons (bespoke intents) --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font); font-weight: 700; font-size: 14px; cursor: pointer;
  padding: 11px 20px; border-radius: var(--r-btn); border: 1px solid transparent;
  transition: transform .18s var(--ease), box-shadow .25s, background .25s, border-color .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 52%, var(--accent-3) 130%);
  box-shadow: 0 10px 30px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { box-shadow: 0 16px 40px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3); transform: translateY(-2px); }
.btn-ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-2px); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Cards ------------------------------------------------------------------ */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform .3s var(--ease), box-shadow .3s, border-color .3s, background .3s;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 20px 50px -24px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,0.06); }
.card.glow { border-color: rgba(168,85,247,0.4); box-shadow: 0 0 0 1px rgba(168,85,247,0.24), 0 18px 48px -18px var(--accent-glow); }
.card-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.card-metric { font-family: var(--display); font-size: 34px; font-weight: 700; margin-top: 6px; letter-spacing: -0.03em; }
.card-sub { font-size: 13px; color: var(--text-2); margin-top: 8px; }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* Pills / badges --------------------------------------------------------- */
.pill { display:inline-flex; align-items:center; gap:6px; padding: 4px 11px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.pill.up { color: var(--up); background: rgba(74,222,128,0.10); border-color: rgba(74,222,128,0.25); }
.pill.down { color: var(--down); background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.25); }
.pill.warn { color: var(--warn); background: rgba(252,211,77,0.10); border-color: rgba(252,211,77,0.25); }

/* Tables ----------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th:hover { color: var(--text); }
.tbl td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.tbl tbody tr, .tbl tbody tr { transition: background .18s; }
.tbl tbody tr:hover { background: var(--surface); }
.tbl .num { font-family: var(--mono); text-align: right; }
.coin-img { border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface); display: block; }
.coin-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.coin-cell img, .coin-cell .coin-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.coin-cell .cn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin-cell .sym { color: var(--text-3); font-size: 12px; text-transform: uppercase; }

/* Inputs ----------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: var(--r-input);
  background: rgba(0,0,0,0.28); border: 1px solid var(--border); color: var(--text);
  font: inherit; font-size: 14.5px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); background: rgba(0,0,0,0.4); }

/* Category chips --------------------------------------------------------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 15px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: .2s; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on { color: #fff; background: var(--accent-dim); border-color: rgba(168,85,247,0.4); box-shadow: 0 0 18px -6px var(--accent-glow); }

/* Sparkline / charts ----------------------------------------------------- */
.spark { width: 120px; height: 36px; display: block; }

/* Reveal on scroll ------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"]{ transition-delay:.08s } .reveal[data-d="2"]{ transition-delay:.16s }
.reveal[data-d="3"]{ transition-delay:.24s } .reveal[data-d="4"]{ transition-delay:.32s }

/* Footer ----------------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); padding: 46px 0 40px; margin-top: 60px; color: var(--text-3); font-size: 13px; }
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--text); }
.footer-cols { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer .disc { margin-top: 26px; font-size: 12px; color: var(--text-3); }

/* Toast ------------------------------------------------------------------ */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(30px); z-index: 300;
  background: rgba(20,16,30,0.96); border: 1px solid rgba(168,85,247,0.4); color: #fff; padding: 12px 20px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.8); transition: opacity .3s, transform .3s var(--ease); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Skeleton --------------------------------------------------------------- */
.skel { background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Gauge ring ------------------------------------------------------------- */
.gauge { position: relative; width: 168px; height: 168px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .val { position: absolute; inset: 0; text-align: center; }
.gauge .val b { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); font-family: var(--display); font-size: 40px; line-height: 1; }
.gauge .val span { position: absolute; top: 64%; left: 0; right: 0; display:block; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }

/* Hero blob for landing -------------------------------------------------- */
.grad-text { background: linear-gradient(120deg, var(--accent-3), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Marquee ticker --------------------------------------------------------- */
.marquee { overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); }
.marquee-track { display: inline-flex; gap: 40px; padding: 12px 0; white-space: nowrap; animation: scroll 34s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item { font-family: var(--mono); font-size: 13px; color: var(--text-2); display:inline-flex; gap:8px; align-items:center; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: 1fr; }
  .nav-desk { display: none; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column;
    padding: 14px; gap: 4px; background: rgba(10,11,18,0.99); backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border); box-shadow: 0 20px 40px -20px rgba(0,0,0,.7);
  }
  .nav-links.open a { padding: 12px 13px; }
  .nav-links.open .menu-extra { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
  .nav-links.open .menu-extra .toggle { align-self: flex-start; }
  .menu-auth { display: flex; gap: 10px; }
  .menu-auth .btn { flex: 1; }
  .nav-burger { display: inline-flex; }
}
@media (max-width: 720px) {
  .nav-clock { display: none; }
}
@media (max-width: 640px) {
  .g2, .g4 { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .card-metric { font-size: 28px; }
}

/* Mobile performance: fixed backgrounds + blurred aurora are the classic
   mobile jank sources, so lighten them on small screens. */
@media (max-width: 760px) {
  body { background-attachment: scroll; }
  body::before { animation: none; filter: blur(28px); opacity: .7; }
  .nav { backdrop-filter: blur(10px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  body::before { animation: none; }
  .marquee-track { animation: none; }
}

/* ==========================================================================
   PREMIUM POLISH LAYER — sitewide uplift (loaded last, so it refines the base)
   ========================================================================== */

/* Aligned, tabular figures wherever numbers matter — a core fintech premium tell */
.mono, .num, .card-metric, .tbl td.num, .tbl th.num,
.card-metric.mono, .bignum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Calmer, crisper text rendering */
body { letter-spacing: -0.006em; }
h1, h2, h3 { font-feature-settings: "ss01" 1; }

/* Selection + keyboard focus */
::selection { background: rgba(168,85,247,0.30); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* Refined scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(168,85,247,.35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168,85,247,.28); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(168,85,247,.5); background-clip: padding-box; }

/* Cards — softer, deeper depth + crisper hairline + smoother lift */
.card { border-radius: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.045), 0 12px 34px -20px rgba(0,0,0,0.72); }
.card:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 28px 64px -30px rgba(0,0,0,0.85); border-color: var(--border-strong); }
.card.glow { box-shadow: 0 0 0 1px rgba(168,85,247,0.22), 0 26px 64px -28px var(--accent-glow); }

/* Metrics — larger, tighter, more confident */
.card-metric { font-size: 36px; letter-spacing: -0.035em; line-height: 1.02; }
.card-label { letter-spacing: 0.09em; color: var(--text-3); }
.card-sub { color: var(--text-2); }

/* Buttons — refined weight, spring, gradient */
.btn { border-radius: 12px; letter-spacing: -0.01em; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%, var(--accent-3) 140%);
  box-shadow: 0 8px 24px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.22); }
.btn-primary:hover { box-shadow: 0 16px 42px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.28); }

/* Tables — more air, cleaner lines, tasteful hover tint */
.tbl th { padding: 14px 16px; font-size: 10.5px; letter-spacing: 0.09em; }
.tbl td { padding: 15px 16px; }
.tbl tbody tr { transition: background .16s ease; }
.tbl tbody tr:hover { background: rgba(168,85,247,0.055); }

/* Pills + eyebrow — calmer */
.pill { padding: 5px 12px; font-weight: 600; }
.eyebrow { font-size: 11px; letter-spacing: 0.2em; }

/* Generous rhythm on large screens */
@media (min-width: 1100px) { .section { padding: 96px 0; } }
