/* ============================================================================
   theme-aura.css — site-wide cinematic dark theme
   Loaded last in <head> so it re-skins the shared classes (.glass,
   .gradient-text, .gradient-btn) every page already uses. Frontend only.
   Palette: deep-black base + blue→cyan cinematic gradient.
   ============================================================================ */

:root {
  --aura-bg: #0c0c0c;
  --aura-bg-soft: #0e1014;
  --aura-line: rgba(255,255,255,0.10);
  --aura-grad-1: #0B2551;
  --aura-grad-2: #A4F4FD;
  --aura-grad-3: #00d2ff;
  --aura-brand: #3D81E3;
  /* Skeleton shimmer tokens — consumed by .skel and friends below */
  --skel-base:    rgba(255,255,255,0.06);
  --skel-shine:   rgba(255,255,255,0.13);
  --skel-radius:  6px;
}

/* ---- base ----
   Bridge to the theme.js variable namespace (--bg-primary / --text-* / --accent)
   so the navbar theme picker actually re-skins every page. theme.js sets these
   vars on :root; we consume them here with the cinematic aura values as fallback
   so the default (midnight) look is unchanged when no theme is chosen. ---- */
html, body {
  background: var(--bg-primary, var(--aura-bg)) !important;
  color: var(--text-secondary, #e2e8f0);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(0,210,255,0.28); }

/* tighter, more cinematic headings */
h1, h2, h3 { letter-spacing: -0.02em; }

/* ---- cinematic gradient text — DARK THEMES ONLY ---- */
/* On dark themes (everything except light) we apply the deep-navy → cyan aura
   gradient. On light theme we fall back to a readable accent gradient so the
   text stays visible against the pale background. */
:root:not([data-theme="light"]) .gradient-text,
:root:not([data-theme="light"]) .serif-italic.gradient-text {
  background: linear-gradient(120deg, var(--aura-grad-1) 0%, var(--aura-grad-2) 45%, var(--aura-grad-3) 70%, var(--aura-grad-1) 100%) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}

/* Light-mode gradient-text: accent → accent-secondary, fully readable */
[data-theme="light"] .gradient-text,
[data-theme="light"] .serif-italic.gradient-text {
  background: linear-gradient(120deg,
    var(--accent, #2563eb) 0%,
    var(--accent-secondary, #7c3aed) 60%,
    var(--accent-tertiary, #0891b2) 100%) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}

/* ---- shiny animated headline — dark only ---- */
:root:not([data-theme="light"]) .aura-shiny {
  background: linear-gradient(to right,
    #60a5fa 0%, #3b82f6 12.5%, #A4F4FD 32.5%, #00d2ff 50%,
    #3b82f6 67.5%, #60a5fa 87.5%, #60a5fa 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: aura-shiny 6s linear infinite;
}
/* Light fallback — just use accent color, no gradient tricks */
[data-theme="light"] .aura-shiny {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  animation: none;
}
@keyframes aura-shiny {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
@media (prefers-reduced-motion: reduce) {
  .aura-shiny { animation: none; }
}

/* ---- buttons: cooler cinematic gradient + crisp pill option ---- */
.gradient-btn {
  background: linear-gradient(135deg, var(--aura-brand), var(--aura-grad-3)) !important;
  box-shadow: 0 6px 24px rgba(0,210,255,0.18);
}
.gradient-btn:hover { filter: brightness(1.06); }
.aura-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 9999px; background: #fff; color: #000; font-weight: 600;
  font-size: 0.875rem; padding: 12px 22px; transition: all .25s ease; border: none;
}
.aura-pill:hover { background: rgba(255,255,255,0.9); }
.aura-pill:active { transform: scale(0.98); }

/* ---- liquid-glass treatment (re-skins existing .glass + opt-in .liquid-glass) ----
   Background now consumes --bg-card so theme.js can control card opacity.
   The !important on the border/shadow keeps the cinematic inset highlight
   without fighting Tailwind border-* utilities (those use specificity, not !important). */
.glass, .liquid-glass {
  background: var(--bg-card, rgba(255,255,255,0.015)) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid transparent !important;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.10) !important;
  position: relative;
  overflow: hidden;
}

/* Light-mode glass: visible surface with a clear border */
[data-theme="light"] .glass,
[data-theme="light"] .liquid-glass {
  background: var(--bg-card, rgba(0,0,0,0.03)) !important;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.60),
              0 1px 3px rgba(0,0,0,0.06) !important;
}

/* Dark-only glass shimmer pseudo — gated so it doesn't pollute light mode */
:root:not([data-theme="light"]) .glass::before,
:root:not([data-theme="light"]) .liquid-glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.40) 0%, rgba(255,255,255,0.12) 20%,
    rgba(255,255,255,0) 42%, rgba(255,255,255,0) 58%,
    rgba(255,255,255,0.12) 80%, rgba(255,255,255,0.40) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

/* ---- FIX: the global .glass { overflow:hidden } above clips scrollable
   regions (tables, feeds) inside glass cards. ---- */
.table-wrap.glass, .glass.scroll-y, .scroll-area.glass { overflow: auto !important; }
.table-wrap, .scroll-y, .scroll-area { overflow: auto; }

/* ---- FIX: native <select> option popups rendered white-on-white on dark pages. ---- */
:root:not([data-theme="light"]) :where(option) { background: #0f0f1a; color: #e2e8f0; }
:root:not([data-theme="light"]) :where(optgroup) { background: #0f0f1a; color: #94a3b8; }

/* ---- vertical container guide lines (desktop, dark only) ---- */
.aura-guides { display: none; }
@media (min-width: 768px) {
  :root:not([data-theme="light"]) .aura-guides { display: block; }
  .aura-guides::before, .aura-guides::after {
    content: ''; position: fixed; top: 0; bottom: 0; width: 1px;
    background: var(--aura-line); z-index: 5; pointer-events: none;
  }
  .aura-guides::before { left: calc(50% - 36rem); }
  .aura-guides::after  { left: calc(50% + 36rem); }
}

/* ---- global film grain (subtle, fixed, behind content) — dark themes only ---- */
:root:not([data-theme="light"]) body::after {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Light theme: no grain/vignette */
[data-theme="light"] body::after { display: none; }

/* ---- refined scrollbar — dark themes ---- */
:root:not([data-theme="light"]) ::-webkit-scrollbar { width: 10px; height: 10px; }
:root:not([data-theme="light"]) ::-webkit-scrollbar-track { background: transparent; }
:root:not([data-theme="light"]) ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
:root:not([data-theme="light"]) ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* Light-mode scrollbar */
[data-theme="light"] ::-webkit-scrollbar { width: 8px; height: 8px; }
[data-theme="light"] ::-webkit-scrollbar-track { background: transparent; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 8px; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.32); }

/* ============================================================================
   === UX polish pass 2026-06-10 ===
   Additive, low-specificity accessibility + readability improvements.
   :where() selectors carry 0,0,0 specificity so Tailwind wins automatically.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. READABILITY / CONTRAST
   ---------------------------------------------------------------------------- */
:root {
  --text-muted: #a9b4c4;
  --text-secondary: #c2ccd9;
  --aura-text-muted: #a9b4c4;
}
:where([class*="text-[#94a3b8]"]) { color: #a9b4c4 !important; }
:where([class*="text-[#64748b]"]) { color: #94a3b8 !important; }
:where([class*="text-[#9ca3af]"]) { color: #aab3c0 !important; }
:where(.text-text-muted) { color: var(--text-muted) !important; }

/* Light-mode muted text: use the theme's own muted token (already readable) */
[data-theme="light"] :where([class*="text-[#94a3b8]"]) { color: var(--text-muted, #6b7280) !important; }
[data-theme="light"] :where([class*="text-[#64748b]"]) { color: var(--text-muted, #6b7280) !important; }
[data-theme="light"] :where([class*="text-[#9ca3af]"]) { color: var(--text-muted, #6b7280) !important; }

:where(body) { line-height: 1.6; }
:where(p) { line-height: 1.65; }
.prose-measure { max-width: 70ch; }
.prose-measure p { line-height: 1.7; margin-bottom: 1em; }

/* ----------------------------------------------------------------------------
   2. TABULAR NUMBERS
   ---------------------------------------------------------------------------- */
:where(table, .mono, code, kbd, samp, pre, [class*="font-mono"], [class*="JetBrains"], [style*="JetBrains"]) {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
:where(td, th) { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
   3. FOCUS-VISIBLE (keyboard only)
   ---------------------------------------------------------------------------- */
:where(a, button, [role="button"], input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
  border-radius: 4px;
}
@supports selector(:focus-visible) {
  :where(a, button, [role="button"]):focus:not(:focus-visible) { outline: none; }
}

/* ----------------------------------------------------------------------------
   4. REDUCED MOTION
   ---------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------------------------------------------------------
   5. CONSISTENT HOVER / TRANSITIONS
   ---------------------------------------------------------------------------- */
:where(a, button, [role="button"], .btn, .clickable, summary, select,
       input[type="checkbox"], input[type="radio"], input[type="submit"]) {
  transition: color .18s ease-out, background-color .18s ease-out,
              border-color .18s ease-out, box-shadow .18s ease-out,
              opacity .18s ease-out, transform .18s ease-out, filter .18s ease-out;
}
:where(button, [role="button"], .btn, .clickable,
       input[type="submit"], input[type="checkbox"], input[type="radio"],
       select, summary, label[for]) {
  cursor: pointer;
}
:where(button:disabled, [role="button"][aria-disabled="true"], .btn:disabled) {
  cursor: not-allowed;
}

/* ----------------------------------------------------------------------------
   6. TOUCH TARGETS
   ---------------------------------------------------------------------------- */
@media (pointer: coarse) {
  :where(button, [role="button"], .btn, a.btn, nav a, .nav-link) {
    min-height: 40px;
  }
  :where(.icon-btn, button.icon, [data-icon-btn], button[aria-label]:empty,
         a[aria-label]:empty) {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ----------------------------------------------------------------------------
   7. SCROLLBAR + SELECTION POLISH
   ---------------------------------------------------------------------------- */
:where(html) {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.16) transparent;
}
[data-theme="light"] {
  scrollbar-color: rgba(0,0,0,0.18) transparent;
}
::selection {
  background: rgba(59,130,246,0.35);
  color: #f8fafc;
}
::-moz-selection {
  background: rgba(59,130,246,0.35);
  color: #f8fafc;
}

/* Light-mode selection */
[data-theme="light"] ::selection {
  background: rgba(37,99,235,0.25);
  color: #0c0c0c;
}
[data-theme="light"] ::-moz-selection {
  background: rgba(37,99,235,0.25);
  color: #0c0c0c;
}

/* ----------------------------------------------------------------------------
   8. CARD / SECTION RHYTHM
   ---------------------------------------------------------------------------- */
.section-tight { padding-top: 32px; padding-bottom: 32px; }
.section       { padding-top: 48px; padding-bottom: 48px; }
.section-loose { padding-top: 72px; padding-bottom: 72px; }
.card-pad      { padding: 20px; }
@media (min-width: 768px) {
  .card-pad    { padding: 28px; }
}

/* ----------------------------------------------------------------------------
   9. TABLE POLISH
   ---------------------------------------------------------------------------- */
:where(table) { border-collapse: collapse; }
:root:not([data-theme="light"]) :where(tbody tr:nth-child(even)) { background: rgba(255,255,255,0.018); }
:root:not([data-theme="light"]) :where(tbody tr):hover { background: rgba(59,130,246,0.07); }
:where(th, td) { border-color: var(--border-color, rgba(255,255,255,0.08)); }

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary, var(--aura-bg-soft, #0e1014));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.table-clean th,
.table-clean td {
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
  padding: 10px 12px;
}
.table-clean tbody tr:last-child td { border-bottom: none; }

/* ----------------------------------------------------------------------------
   10. LIGHT-PALETTE TABLE + SELECTION SAFETY
   ---------------------------------------------------------------------------- */
:where([data-theme="light"]) tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.03);
}
:where([data-theme="light"]) tbody tr:hover {
  background: rgba(37,99,235,0.08);
}
/* end === UX polish pass 2026-06-10 === */

/* ============================================================================
   11. SKELETON LOADERS
   Reusable shimmer placeholders. Use these classes directly on placeholder
   elements while async content loads — no JS required, pure CSS.

   Usage examples:
     <div class="skel skel-card"></div>
     <div class="skel skel-text" style="width:60%"></div>
     <div class="skel-row">
       <div class="skel" style="width:40px;height:40px;border-radius:50%"></div>
       <div style="flex:1">
         <div class="skel skel-text"></div>
         <div class="skel skel-text" style="width:70%"></div>
       </div>
     </div>

   Tokens --skel-base and --skel-shine are set on :root above and pick up
   any theme's surface colors automatically (light theme overrides below).
   ============================================================================ */

/* Light-mode skeleton tokens — use darker washes on the pale background */
[data-theme="light"] {
  --skel-base:  rgba(0,0,0,0.07);
  --skel-shine: rgba(0,0,0,0.13);
}

/* Core shimmer animation */
@keyframes skel-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* Base block — apply to any placeholder element */
.skel {
  display: block;
  border-radius: var(--skel-radius, 6px);
  background: linear-gradient(
    90deg,
    var(--skel-base, rgba(255,255,255,0.06))  0%,
    var(--skel-shine, rgba(255,255,255,0.13)) 40%,
    var(--skel-base, rgba(255,255,255,0.06))  80%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .skel {
    animation: none;
    background: var(--skel-base, rgba(255,255,255,0.06));
  }
}

/* Inline text placeholder — matches a line of body text height */
.skel-text {
  height: 1em;
  border-radius: 4px;
  margin-bottom: 0.5em;
  width: 100%;
}
.skel-text:last-child { margin-bottom: 0; }

/* Horizontal layout row (avatar + lines, etc.) */
.skel-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Card-sized placeholder that matches a standard glass card */
.skel-card {
  width: 100%;
  min-height: 120px;
  border-radius: 12px;
  /* Slightly heavier shine for card-level depth */
  background: linear-gradient(
    90deg,
    var(--skel-base, rgba(255,255,255,0.05))  0%,
    var(--skel-shine, rgba(255,255,255,0.11)) 40%,
    var(--skel-base, rgba(255,255,255,0.05))  80%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.8s ease-in-out infinite;
}
/* end skeleton loaders */

/* ============================================================================
   Global fixed-nav anchor-link guard
   The shared nav (nav.js) renders a position:fixed bar 64px tall.
   scroll-padding-top ensures anchor (#hash) links land below the nav.
   Pages manage their own first-child padding-top (typically pt-16 = 64px).
   ============================================================================ */
html { scroll-padding-top: 72px; }

/* ============================================================================
   Universal mobile horizontal-overflow guard
   Stops any wide content (long wallet addresses, code blocks, tables, hashes)
   from spilling past the right edge and becoming unreadable on phones.
   ============================================================================ */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100%; }
/* Media + tables never exceed the viewport */
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
/* Code/preformatted blocks scroll internally instead of stretching the page */
pre, code, .mono, .code-body, .code-block { max-width: 100%; }
pre, .code-body { overflow-x: auto; }
/* Long unbroken strings (0x addresses, tx hashes) wrap instead of overflowing */
.mono, .swap-row a, .break-anywhere, a[href*="0x"], td, th {
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Wide tables become horizontally scrollable on small screens */
@media (max-width: 640px) {
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  pre { white-space: pre-wrap; word-break: break-word; }
}
