@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&display=swap');

/* ============================================================
   DESIGN SYSTEM — Market Events Monitor
   shadcn/ui-inspired tokens + shared components

   Hallmark redesign (site-wide): editorial / Swiss-blue system.
   --blue is the richer cobalt accent (was #2563eb/#3b82f6); --font-display is
   DM Serif Display for headings (kept); --font-sans is Hanken Grotesk for
   body/UI; --font-mono is IBM Plex Mono for numbers/data/labels. (Previously
   Geist / Geist Mono — swapped for a pairing with more character that doesn't
   read as "generic AI dashboard default".) Every page that already consumes
   these tokens picks up the new look automatically; no per-page hardcoded
   colour/font should bypass them. --font-body/--font-label are aliases of
   the same values for code that prefers that naming.
   ============================================================ */

/* ---- Light mode tokens ---- */
:root {
  --font-display: "DM Serif Display", Georgia, serif;
  --font-serif: var(--font-display);
  --bg-0: #f0f5ff;
  --bg-1: #f7f9ff;
  --bg-2: #ffffff;
  --bg-3: #edf1fb;
  --bd-0: #dde3f0;
  --bd-1: #c8d0e8;
  --bd-2: #eaf0fb;
  --tx-0: #0d1117;
  --tx-1: #3d4a63;
  --tx-2: #7d8fad;
  --tx-3: #b0bcd4;
  --blue: #144bb7;
  --blue-hover: #0035a0;
  --blue-light: rgba(20,75,183,0.08);
  --blue-ring: rgba(20,75,183,0.25);
  --up: #16a34a;
  --up-light: rgba(22,163,74,0.10);
  --dn: #dc2626;
  --dn-light: rgba(220,38,38,0.10);
  --dn-dim: rgba(220,38,38,0.08);
  --dn-bd: rgba(220,38,38,0.25);
  --warn: #d97706;
  --warn-bright: #fcd34d;
  --warn-dark: #78350f;
  --warn-light: rgba(217,119,6,0.10);
  --info: #0284c7;
  --info-light: rgba(2,132,199,0.10);
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-full: 9999px;
  --sh-sm: 0 1px 2px rgba(10,30,80,0.06);
  --sh: 0 1px 4px rgba(10,30,80,0.08);
  --sh-md: 0 4px 14px rgba(10,30,80,0.10);
  --sh-lg: 0 8px 28px rgba(10,30,80,0.12);
  --transition: all 140ms cubic-bezier(0.4,0,0.2,1);
  --font-sans: "Hanken Grotesk", "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: var(--font-sans);
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  --font-label: var(--font-mono);
  --purple: #7c3aed;
  --purple-light: rgba(124,58,237,0.10);
  --cyan: #0891b2;
  --pink: #db2777;
  --slate: #475569;
  --slate-dark: #1e293b;
  --emerald: #059669;
  --blue-deep: #1e3a8a;
  --overlay-subtle: rgba(10,30,80,0.06);
  --overlay: rgba(0,0,0,0.30);
  --white: #ffffff;

  /* Backwards compatibility aliases for gradual migration */
  --text-muted: var(--tx-2);
  --text-sec: var(--tx-1);
  --text-primary: var(--tx-0);
  --text-secondary: var(--tx-1);
  --border: var(--bd-0);
  --border-dim: var(--bd-2);
  --brand: var(--blue);
  --brand-dim: var(--blue-light);
  --brand-hover: var(--blue-hover);
  --yellow: var(--warn);
  --green: var(--up);
  --bg-card: var(--bg-2);
  --bg-surface: var(--bg-1);
  --bg-inset: var(--bg-3);
}

/* ---- Dark mode tokens ---- */
[data-theme="dark"] {
  --bg-0: #07090f;
  --bg-1: #0d1117;
  --bg-2: #161b27;
  --bg-3: #1e2535;
  --bd-0: #2a3347;
  --bd-1: #374159;
  --bd-2: #1e2535;
  --tx-0: #e8edf7;
  --tx-1: #b0bcd4;
  --tx-2: #6b7a9b;
  --tx-3: #4a5568;
  --blue: #6ca2ff;
  --blue-hover: #4e82e5;
  --blue-light: rgba(108,162,255,0.12);
  --blue-ring: rgba(108,162,255,0.30);
  --up: #4ade80;
  --up-light: rgba(74,222,128,0.12);
  --dn: #f87171;
  --dn-light: rgba(248,113,113,0.12);
  --dn-dim: rgba(248,113,113,0.08);
  --dn-bd: rgba(248,113,113,0.25);
  --warn: #fbbf24;
  --warn-bright: #fde68a;
  --warn-dark: #92400e;
  --warn-light: rgba(251,191,36,0.12);
  --info: #38bdf8;
  --info-light: rgba(56,189,248,0.12);

  /* Backwards compatibility aliases — dark mode overrides */
  --text-muted: var(--tx-2);
  --text-sec: var(--tx-1);
  --text-primary: var(--tx-0);
  --text-secondary: var(--tx-1);
  --border: var(--bd-0);
  --border-dim: var(--bd-2);
  --brand: var(--blue);
  --brand-dim: var(--blue-light);
  --brand-hover: var(--blue-hover);
  --yellow: var(--warn);
  --green: var(--up);
  --bg-card: var(--bg-2);
  --bg-surface: var(--bg-1);
  --bg-inset: var(--bg-3);
}

/* ---- Base reset ---- */
*, *::before, *::after { box-sizing: border-box; }

/* Prevent horizontal page scroll when any child miscalculates its width (a
   min-width or nowrap string slightly wider than the viewport). clip — not
   hidden — so position:sticky sub-elements keep working. Mirrors the per-page
   guards already in account.css / prediction_detail.css, but applied globally
   so the rest of the site (scorecard, timeline, rankings, …) is covered too. */
html, body { overflow-x: clip; }

body {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--tx-0);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
}

/* Site-wide display face for headings (Hallmark redesign). Low-specificity
   element selector — any page/component that already sets its own heading
   font-family (via a class) keeps winning the cascade; this is just the
   fallback every page inherits for free. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.mono-price {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-blue { background: var(--blue-light); color: var(--blue); border-color: var(--blue-ring); }
.badge-green { background: var(--up-light); color: var(--up); border-color: rgba(22,163,74,0.20); }
.badge-red { background: var(--dn-light); color: var(--dn); border-color: var(--dn-bd); }
.badge-warn { background: var(--warn-light); color: var(--warn); border-color: rgba(217,119,6,0.20); }
.badge-muted { background: var(--bg-3); color: var(--tx-2); border-color: var(--bd-0); }
.badge-purple { background: var(--purple-light); color: var(--purple); border-color: rgba(124,58,237,0.25); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-outline { background: var(--bg-2); color: var(--tx-1); border-color: var(--bd-0); box-shadow: var(--sh-sm); }
.btn-outline:hover { border-color: var(--bd-1); color: var(--tx-0); }
.btn-ghost { background: transparent; color: var(--tx-1); }
.btn-ghost:hover { background: var(--bg-1); color: var(--tx-0); }
.btn-danger { background: var(--dn-dim); color: var(--dn); border-color: var(--dn-bd); }
.btn-danger:hover { background: var(--dn-light); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-lg { padding: 9px 20px; font-size: 14px; }

/* ---- Card ---- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--bd-0);
  border-radius: var(--r-xl);
  box-shadow: var(--sh);
}
.card-body { padding: 18px 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--bd-2); }

/* ---- Form input ---- */
.input {
  display: block;
  width: 100%;
  padding: 7px 12px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: var(--tx-0);
  background: var(--bg-3);
  border: 1px solid var(--bd-0);
  border-radius: var(--r-md);
  outline: none;
  transition: var(--transition);
}
.input:focus { border-color: var(--bd-1); box-shadow: 0 0 0 3px var(--blue-ring); }
.input::placeholder { color: var(--tx-3); }

/* ---- Table ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--font-sans); }
.tbl th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-3);
  border-bottom: 1px solid var(--bd-0);
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--bd-2); color: var(--tx-1); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--bg-1); }

/* ---- Page header ---- */
/* Unified page-level heading used across all content pages.
   Usage:
     <div class="page-header">
       <p class="page-eyebrow">OPTIONAL LABEL</p>   ← optional
       <h1 class="page-title">Title</h1>
       <p class="page-sub">Subtitle</p>             ← optional
     </div>
*/
.page-header {
  margin-bottom: 24px;
}
.page-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 6px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--tx-0);
  margin: 0 0 4px;
}
.page-sub {
  font-size: 13px;
  color: var(--tx-2);
  margin: 0;
}

/* ---- Utility ---- */
.text-muted { color: var(--tx-2); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.up { color: var(--up); }
.dn { color: var(--dn); }
.warn { color: var(--warn); }

/* Hallmark · component: base inline link
 * states: default · hover · active · focus-visible
 * Plain <a> tags that fall through to no other rule (inline references in
 * body copy, breadcrumbs without their own class) previously rendered as
 * unstyled browser default — clashing blue, no hover/focus feedback. Nav
 * links, buttons-as-links, and card/list-item links already carry their own
 * more-specific classes (.nav-link, .btn, .card a, .link-back/.link-fwd,
 * etc.) and are unaffected by this base rule (higher selector specificity
 * wins regardless of source order).
 */
a {
  color: var(--blue);
  text-decoration-line: underline;
  text-decoration-color: var(--blue-ring);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: var(--transition);
}
a:hover { color: var(--blue-hover); text-decoration-color: currentColor; }
a:active { color: var(--blue-hover); }
a:focus-visible {
  outline: 2px solid var(--blue-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Hallmark · component: nav-link (back / view-all / forward chevron)
 * states: default · hover · focus-visible
 * consolidates scattered inline-styled/hardcoded-hex variants
 * (virtual_portfolio.html, homepage.html, account.css .view-all-link)
 * onto these two existing classes — reuses this project's own
 * design-system tokens (var(--blue), var(--tx-2), var(--blue-hover)),
 * no foreign theme imposed.
 */
/* ---- Chevron arrow links (unified back / view-all / forward nav) ---- */
.link-back,
.link-fwd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: gap 160ms ease, color 160ms ease;
}
/* Back links: quiet by default, brightens on hover — a secondary action. */
.link-back { color: var(--tx-2); }
.link-back:hover { color: var(--tx-0); gap: 6px; }
/* Forward / "view all" links: brand accent — a primary action. */
.link-fwd { color: var(--blue); }
.link-fwd:hover { color: var(--blue-hover); gap: 6px; }

.link-back:focus-visible,
.link-fwd:focus-visible {
  outline: 2px solid var(--blue-ring);
  outline-offset: 2px;
}

.link-back .chevron,
.link-fwd .chevron {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 160ms ease;
}
.link-back:hover .chevron { transform: translateX(-2px); }
.link-fwd:hover  .chevron { transform: translateX(2px); }

/* Pagination arrows */
.page-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--bd-0);
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--tx-1);
  transition: gap 160ms ease, border-color 160ms ease;
}
.page-arrow:hover {
  gap: 6px;
  border-color: var(--bd-1);
}
.page-arrow:focus-visible {
  outline: 2px solid var(--blue-ring);
  outline-offset: 2px;
}
.page-arrow .chevron {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 160ms ease;
}
.page-arrow:hover .chevron-left  { transform: translateX(-2px); }
.page-arrow:hover .chevron-right { transform: translateX(2px); }

/* Archived-arena banner: reusable across any finished prediction arena
   (World Cup 2026, future Euro Cup, etc.) — see /archive. */
.archived-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-muted, #f5f8ff);
  border: 1px solid var(--bd-0, #e2e8f0);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.archived-banner__icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.archived-banner__title { font-size: 13px; font-weight: 700; color: var(--tx-0, #1a2234); margin-bottom: 2px; }
.archived-banner__desc { font-size: 12px; color: var(--tx-2, #7d8fad); }
.archived-banner__desc a { color: var(--blue, #144bb7); font-weight: 600; text-decoration: none; }
.archived-banner__desc a:hover { text-decoration: underline; }

/* Shared info-tooltip icon ("i"). Reused by BSS/BS metric labels.
   Text via data-tooltip (set by i18n.js data-i18n-tooltip). */
.tip-icon {
    display: inline-flex;
    text-transform: none;
    line-height: 1;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--blue);
    color: var(--bg-0);
    font-size: 11px;
    font-style: normal;
    cursor: help;
    flex-shrink: 0;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}
.tip-icon::after {
    content: attr(data-tooltip);
    text-transform: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-0);
    border: 1px solid var(--bd-0);
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--tx-1);
    white-space: normal;
    width: 200px;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.tip-icon:hover::after,
.tip-icon:focus::after { opacity: 1; }
.tip-icon:focus { outline: none; }
