/* ============================================================
   Regime Compass — global stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap');

:root {
  /* Regime colours (semantic) */
  --bear:    #e35454;
  --bear-2:  #c0392b;
  --neutral: #d4a017;
  --neutral-2: #c08e0a;
  --bull:    #34c673;
  --bull-2:  #27ae60;

  /* Surfaces */
  --bg:           #0a0d12;
  --bg-elev:      #11141a;
  --panel:        #161b22;
  --panel-2:      #1c2330;
  --panel-glass:  rgba(22, 27, 34, 0.7);
  --border:       #232830;
  --border-strong:#2d3540;

  /* Text */
  --text:         #e6edf3;
  --text-strong:  #ffffff;
  --muted:        #8b95a3;
  --muted-2:      #6b7480;

  /* Brand / links */
  --link:        #6ec1ff;
  --link-hover:  #9fd4ff;
  --accent:      #a78bfa;          /* violet accent for active states */
  --accent-dim:  rgba(167, 139, 250, 0.12);
  --accent-strong: #c4b5fd;

  /* Effects */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(167, 139, 250, 0.15);
  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex; flex-direction: column;
  /* subtle ambient glow */
  background-image:
    radial-gradient(at 12% 0%, rgba(167, 139, 250, 0.08) 0px, transparent 50%),
    radial-gradient(at 88% 100%, rgba(110, 193, 255, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); }

::selection { background: var(--accent-dim); color: var(--text-strong); }

/* ============================================================
   Page loader (thin top progress bar)
   ============================================================ */
.page-loader {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}
.page-loader::after {
  content: "";
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loader-slide 1.1s ease-in-out infinite;
}
@keyframes loader-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(450%); }
}
body.loaded .page-loader { display: none; }

/* Stale data banner */
.stale-banner {
  background: rgba(212, 160, 23, 0.12);
  border-bottom: 1px solid rgba(212, 160, 23, 0.4);
  color: #f5d99c;
  font-size: 13px;
  text-align: center;
  padding: 10px 20px;
  display: none;
}
.stale-banner.show { display: block; }
.stale-banner strong { color: #f8e6b3; }

/* ============================================================
   Top navigation
   ============================================================ */
nav.top {
  background: rgba(10, 13, 18, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
nav.top .inner {
  max-width: 1180px; margin: 0 auto;
  padding: 14px 28px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
nav.top .brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  display: inline-flex; align-items: center; gap: 10px;
  letter-spacing: -0.01em;
}
nav.top .brand:hover { text-decoration: none; }
nav.top .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bear) 0%, var(--neutral) 50%, var(--bull) 100%);
}
nav.top .links { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
nav.top .links a {
  color: var(--muted);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
nav.top .links a:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}
nav.top .links a.active {
  color: var(--accent-strong);
  background: var(--accent-dim);
}

/* Compass logo (inline SVG with classes) */
.logo-svg { width: 22px; height: 22px; display: inline-block; vertical-align: -6px; transition: var(--transition-slow); }
.logo-svg-lg { width: 56px; height: 56px; display: inline-block; vertical-align: middle; }
.brand:hover .logo-svg { transform: rotate(15deg); }
.logo-svg .ring { stroke: var(--muted); }
.logo-svg .needle { fill: var(--text); }

/* ============================================================
   Layout
   ============================================================ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 28px 48px; width: 100%; flex: 1; }
.wrap.narrow { max-width: 780px; }

/* ============================================================
   Hero
   ============================================================ */
.hero { margin: 10px 0 36px; animation: rise 0.4s ease-out; }
.hero .kicker {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--accent-strong);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.hero .kicker::before, .hero .kicker::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.hero .kicker::before { background: linear-gradient(90deg, transparent, var(--accent)); }
.hero .kicker::after  { background: linear-gradient(90deg, var(--accent), transparent); }
@media (max-width: 760px) {
  .hero .kicker { font-size: 14px; letter-spacing: 3px; gap: 8px; }
  .hero .kicker::before, .hero .kicker::after { width: 20px; }
}
.hero h1 {
  font-family: "Fraunces", "Source Serif Pro", Georgia, serif;
  font-size: 44px;
  font-weight: 600;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  margin: 0 0 12px;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text-strong);
}
.hero .tagline {
  color: var(--muted);
  font-size: 16px;
  max-width: 720px;
  line-height: 1.55;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   Panels & cards
   ============================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.panel:hover { border-color: var(--border-strong); }
.panel-title {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ============================================================
   Section blocks (about / methodology)
   ============================================================ */
.section { margin-bottom: 40px; }
.section h2 {
  font-family: "Fraunces", serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  text-transform: none;
}
.section h3 {
  font-family: "Fraunces", serif;
  font-size: 19px; font-weight: 600;
  margin: 26px 0 10px;
  color: var(--text-strong);
}
.section p {
  color: #c9d1d9;
  margin: 12px 0;
  font-size: 15.5px;
  line-height: 1.65;
}
.section ul, .section ol {
  color: #c9d1d9;
  padding-left: 24px;
  margin: 12px 0;
}
.section li { margin: 8px 0; font-size: 15.5px; line-height: 1.6; }
.section strong { color: var(--text-strong); }
.section code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: #f5d99c;
}
.section pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: var(--r-md);
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #c9d1d9;
  box-shadow: var(--shadow-sm);
}
.section pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* ============================================================
   Pills (regime labels)
   ============================================================ */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  vertical-align: middle;
  box-shadow: var(--shadow-sm);
}
.pill.bear    { background: var(--bear); color: white; }
.pill.neutral { background: var(--neutral); color: #1a1a1a; }
.pill.bull    { background: var(--bull); color: white; }

/* ============================================================
   Callouts
   ============================================================ */
.callout {
  background: rgba(110, 193, 255, 0.05);
  border-left: 3px solid var(--link);
  padding: 16px 20px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 20px 0;
  color: #c9d1d9;
  font-size: 14.5px;
  line-height: 1.6;
}
.callout.warn {
  background: rgba(212, 160, 23, 0.06);
  border-left-color: var(--neutral);
}
.callout strong { color: var(--text-strong); }

/* ============================================================
   Tables
   ============================================================ */
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.t th, table.t td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.t tbody tr { transition: background 0.12s ease; }
table.t tbody tr:hover { background: var(--panel-2); }
table.t th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 1.4px;
  background: var(--bg-elev);
}
table.t td.right { text-align: right; font-variant-numeric: tabular-nums; }
.positive { color: var(--bull); }
.negative { color: var(--bear); }

/* ============================================================
   Author card
   ============================================================ */
.author-card {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.author-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.author-card .avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bear) 0%, var(--neutral) 50%, var(--bull) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.author-card .info h4 {
  font-family: "Fraunces", serif;
  margin: 0 0 4px; font-size: 19px; font-weight: 600; color: var(--text-strong);
}
.author-card .info .role { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.author-card .info p { margin: 6px 0; font-size: 14px; color: #c9d1d9; line-height: 1.6; }
.author-card .info .links { margin-top: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.author-card .info .links a { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   Footer
   ============================================================ */
footer.site {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 32px 0;
  color: var(--muted);
  font-size: 13px;
}
footer.site .inner {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: center;
}
footer.site .built-by { display: inline-flex; align-items: center; gap: 8px; }
footer.site .built-by a {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; color: var(--text);
  transition: var(--transition);
}
footer.site .built-by a:hover { color: var(--accent-strong); }
footer.site .links { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
footer.site .links a { color: var(--muted); }
footer.site .links a:hover { color: var(--text); }

/* LinkedIn icon */
.icon-li {
  display: inline-block;
  width: 16px; height: 16px;
  vertical-align: -3px;
}

/* ============================================================
   Reusable animations
   ============================================================ */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 rgba(167, 139, 250, 0); }
  50% { box-shadow: 0 0 16px rgba(167, 139, 250, 0.3); }
}

/* ============================================================
   Table scroll wrapper (used inline: <div class="table-scroll">)
   ============================================================ */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -8px;
  padding: 0 8px;
}
.table-scroll table.t { min-width: 480px; }

/* ============================================================
   Tablet (up to 1000px)
   ============================================================ */
@media (max-width: 1000px) {
  .wrap { padding: 26px 22px 40px; }
  .hero h1 { font-size: 36px; }
  nav.top .inner { padding: 13px 22px; gap: 18px; }
}

/* ============================================================
   Mobile (up to 760px)
   ============================================================ */
@media (max-width: 760px) {
  /* Layout & spacing */
  .wrap { padding: 18px 14px 32px; }
  .panel { padding: 18px 16px; margin-bottom: 16px; border-radius: 10px; }
  .section { margin-bottom: 28px; }
  .section h2 { font-size: 20px; padding-bottom: 6px; }
  .section h3 { font-size: 17px; margin: 18px 0 8px; }
  .section p { font-size: 14.5px; line-height: 1.6; }
  .section li { font-size: 14.5px; }
  .section pre { font-size: 12px; padding: 12px 14px; }

  /* Hero */
  .hero { margin: 6px 0 26px; }
  .hero h1 { font-size: 28px; line-height: 1.1; }
  .hero .tagline { font-size: 14px; }
  .hero .kicker { font-size: 13px; letter-spacing: 2.5px; gap: 8px; margin-bottom: 14px; }
  .hero .kicker::before, .hero .kicker::after { width: 18px; }

  /* Nav — horizontal scroll on mobile, hidden scrollbar for cleanness */
  nav.top .inner { padding: 11px 14px; gap: 12px; flex-wrap: nowrap; }
  nav.top .brand { font-size: 14px; flex-shrink: 0; }
  .logo-svg { width: 20px; height: 20px; vertical-align: -5px; }
  nav.top .links {
    margin-left: auto;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: calc(100vw - 160px);
  }
  nav.top .links::-webkit-scrollbar { display: none; }
  nav.top .links a {
    padding: 8px 12px;
    font-size: 12.5px;
    flex-shrink: 0;
  }

  /* Footer */
  footer.site { margin-top: 36px; padding: 22px 0; }
  footer.site .inner { padding: 0 14px; gap: 14px; }
  footer.site .links { margin-left: 0; width: 100%; gap: 14px; }
  footer.site .built-by { width: 100%; }

  /* Tables — always horizontally scrollable on mobile */
  table.t { font-size: 12.5px; min-width: 480px; }
  table.t th, table.t td { padding: 8px 9px; }
  .panel > table.t, section > table.t { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Pills + callouts */
  .pill { padding: 2px 9px; font-size: 9.5px; letter-spacing: 1px; }
  .callout { padding: 14px 16px; font-size: 13.5px; line-height: 1.55; }

  /* Author card stacks on mobile */
  .author-card { flex-direction: column; padding: 18px; gap: 14px; }
  .author-card .avatar { width: 48px; height: 48px; font-size: 18px; }

  /* Charts (canvas containers) — universal smaller height on phones */
  .chart-wrap { height: 280px !important; }

  /* Touch target safety for any inline button-style link */
  .btn { padding: 11px 18px; font-size: 14px; }

  /* Hide tooltips/hover-only effects on touch devices */
  .panel:hover { border-color: var(--border); }
}

/* ============================================================
   Small mobile (up to 460px) — tighter padding for narrow phones
   ============================================================ */
@media (max-width: 460px) {
  .wrap { padding: 14px 12px 28px; }
  .panel { padding: 16px 14px; }
  .hero h1 { font-size: 24px; }
  .hero .tagline { font-size: 13.5px; }
  .panel-title { font-size: 10px; letter-spacing: 1.5px; }
  nav.top .brand { font-size: 13px; }
  nav.top .links { max-width: calc(100vw - 130px); }
  nav.top .links a { padding: 7px 10px; font-size: 12px; }
  .callout { padding: 12px 14px; font-size: 13px; }
}

/* ============================================================
   Cookie consent banner
   ============================================================ */
#cookie-consent {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--panel); border-top: 1px solid var(--border-strong);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  animation: rise 0.3s ease-out;
}
.cc-inner {
  max-width: 900px; margin: 0 auto;
  padding: 16px 24px; display: flex; align-items: center;
  gap: 20px; flex-wrap: wrap;
}
.cc-inner p {
  margin: 0; font-size: 13.5px; color: var(--text); flex: 1; min-width: 200px; line-height: 1.5;
}
.cc-inner p a { color: var(--link); }
.cc-btns { display: flex; gap: 10px; flex-shrink: 0; }
.cc-btns button {
  padding: 8px 20px; border-radius: var(--r-md); font-size: 13px;
  font-weight: 600; cursor: pointer; border: none; font-family: inherit;
  transition: var(--transition);
}
#cc-accept { background: var(--accent); color: var(--bg); }
#cc-accept:hover { background: var(--accent-strong); }
#cc-reject { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); }
#cc-reject:hover { color: var(--text); border-color: var(--muted); }

/* ============================================================
   Share buttons
   ============================================================ */
#share-container {
  display: inline-flex; align-items: center; gap: 2px; margin-left: 8px;
}
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  cursor: pointer; border: 1px solid var(--border);
  transition: var(--transition);
  background: var(--panel-2); color: var(--muted);
  padding: 0;
}
.share-btn:hover { background: var(--panel); color: var(--text-strong); border-color: var(--border-strong); }
