/* ============================================================
   HighThree — Modern Fintech
   Cream + deep green, warm, charts-forward, editorial polish.
   ============================================================ */

:root {
  /* Core palette */
  --bg: #fbfaf7;
  --bg-soft: #f3efe8;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-deep: #1a2420;

  --ink: #1a2420;
  --ink-2: #4a4e5c;
  --ink-3: #8a8e9b;
  --ink-dim: #a8acb8;

  --line: #e6e1d7;
  --line-2: #f0ece3;
  --line-subtle: #f7f3eb;

  --accent: #2d5f4e;           /* deep green */
  --accent-2: #3d8370;
  --accent-3: #4ba38d;
  --accent-soft: rgba(45, 95, 78, 0.08);
  --accent-bg: rgba(45, 95, 78, 0.04);
  --accent-ink: #fbfaf7;

  --warm: #c28a3f;             /* warm amber */
  --warm-soft: rgba(194, 138, 63, 0.1);
  --berry: #9a4854;            /* muted berry */
  --berry-soft: rgba(154, 72, 84, 0.08);

  --positive: #2d5f4e;
  --warning: #c28a3f;
  --danger: #9a4854;

  --shadow-sm: 0 1px 2px rgba(26, 36, 32, 0.04);
  --shadow-md: 0 8px 30px rgba(26, 36, 32, 0.06);
  --shadow-lg: 0 24px 60px -20px rgba(26, 36, 32, 0.15);

  --radius: 10px;
  --radius-lg: 18px;
  --radius-xl: 28px;

  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Instrument Serif", "Charter", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", ui-monospace, monospace;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  line-height: 1.1;
}

h1 { font-size: clamp(2.4rem, 4.8vw, 3.8rem); line-height: 1.02; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.1; }
h3 { font-size: 1.35rem; font-weight: 500; }
h4 { font-size: 1rem; font-weight: 500; font-family: var(--font-sans); }

p { margin: 0 0 1em 0; color: var(--ink-2); font-size: 1rem; line-height: 1.65; }

code, .mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
.container-narrow { max-width: 840px; margin: 0 auto; padding: 0 28px; }

/* ---------- Nav ---------- */
.site-nav {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}
.brand-mark {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 0;
}
.nav-links a.active { color: var(--accent); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 100px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card-hero { box-shadow: var(--shadow-md); }

.card-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: 0 0 8px 0;
  font-weight: 500;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
}
.field .hint {
  font-size: 0.76rem;
  color: var(--ink-3);
  font-weight: 400;
}
.input, .select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg-card);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.num, .input.mono { font-family: var(--font-mono); }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .prefix, .input-group .suffix {
  position: absolute;
  color: var(--ink-3);
  font-size: 0.9rem;
  pointer-events: none;
  font-family: var(--font-mono);
}
.input-group .prefix { left: 14px; }
.input-group .suffix { right: 14px; }
.input-group .input.with-prefix { padding-left: 28px; }
.input-group .input.with-suffix { padding-right: 32px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-card); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
table.data th {
  text-align: right;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--bg-soft);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 0.85rem;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr.highlight td {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
table.data tr:hover td { background: var(--bg-soft); }
table.data tr.highlight:hover td { background: var(--accent-soft); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  margin-top: 80px;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--ink-3); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Callout ---------- */
.callout {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.callout strong { color: var(--ink); font-weight: 500; }
.callout code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.85em;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 100px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-accent { background: var(--accent-bg); color: var(--accent); border-color: transparent; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 100px;
  margin-bottom: 20px;
  width: fit-content;
}
.tab {
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tab.active { color: var(--ink); background: var(--bg-card); box-shadow: var(--shadow-sm); }
.tab:hover:not(.active) { color: var(--ink); }

/* ---------- Grid utilities ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Stat / metric ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.stat-sub {
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ---------- Range slider ---------- */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.slider-head .label { font-weight: 500; color: var(--ink-2); font-size: 0.95rem; }
.slider-head .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.015em;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 8px rgba(45, 95, 78, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
}

/* ---------- Disclaimer footer ---------- */
.disclaimer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 14px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* ---------- Utility ---------- */
.text-muted { color: var(--ink-3); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.text-sm { font-size: 0.88rem; }
.serif { font-family: var(--font-display); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 24px; }
.mt-3 { margin-top: 40px; }
.mt-4 { margin-top: 64px; }
.mb-1 { margin-bottom: 12px; }
.mb-2 { margin-bottom: 24px; }

/* ============================================================
   MOBILE / RESPONSIVE
   ============================================================ */

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--ink);
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg-soft); }
.nav-hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

@media (max-width: 820px) {
  /* Tighter horizontal gutters */
  .container, .container-narrow { padding: 0 16px; }

  /* Nav: hamburger replaces inline links */
  .nav-hamburger { display: flex; }
  .site-nav { position: relative; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(251, 250, 247, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 18px;
    z-index: 100;
    box-shadow: var(--shadow-md);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a {
    padding: 13px 0;
    border-bottom: 1px solid var(--line-2);
    font-size: 1rem;
    color: var(--ink-2);
  }
  .nav-links a:last-of-type { border-bottom: none; }
  .nav-links .btn {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    border-radius: var(--radius);
  }

  /* Tabs: horizontal scroll instead of overflow */
  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 8px 14px; font-size: 0.82rem; }

  /* Panel grids: single column */
  .panel-grid { grid-template-columns: 1fr !important; }
  .panel-grid .full { grid-column: 1 !important; }

  /* Summary band: 2-up on tablet */
  .summary-band { grid-template-columns: 1fr 1fr !important; }

  /* Reduce card padding slightly */
  .card { padding: 20px; }

  /* Footer stacks */
  .site-footer .container { flex-direction: column; gap: 10px; }
}

@media (max-width: 520px) {
  /* Summary band: 1-col on very small phones */
  .summary-band { grid-template-columns: 1fr !important; }

  /* Smaller card padding */
  .card { padding: 16px; }

  /* Reduce page-head h1 */
  h1 { font-size: clamp(1.75rem, 7vw, 2.4rem) !important; }
}
