/* ============================================================
   FAIRBANKSPAY INVESTOR PORTAL — DESIGN TOKENS
   Swiss Private Bank aesthetic · Navy + Champagne Gold
   ============================================================ */

:root {
  /* --- Brand palette --- */
  --navy-deep:    #0A1F3D;
  --navy-mid:     #14335C;
  --navy-soft:    #1E4673;
  --champagne:    #C9A961;
  --champagne-light: #E4CC94;
  --champagne-dark:  #9E8345;

  /* --- Surfaces --- */
  --bg:           #FAFAF7;     /* Warm off-white */
  --bg-elevated: #FFFFFF;
  --bg-subtle:    #F3F1EB;     /* Pale gold tint */
  --bg-navy:      #0A1F3D;

  /* --- Text --- */
  --text:         #1A1A1A;
  --text-muted:   #4A5568;
  --text-subtle:  #7A8699;
  --text-inverse: #FAFAF7;

  /* --- Semantic --- */
  --positive:     #2D5F3F;
  --negative:     #8B2635;
  --teal-accent:  #6BA3A0;     /* data viz only */

  /* --- Borders --- */
  --border:       #E8E4D9;
  --border-strong: #D4CDB8;
  --border-navy:  rgba(255, 255, 255, 0.12);

  /* --- Radii --- */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(10, 31, 61, 0.04);
  --shadow:    0 2px 8px rgba(10, 31, 61, 0.06);
  --shadow-lg: 0 12px 32px rgba(10, 31, 61, 0.10);

  /* --- Typography --- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;

  /* Minimum enforced sizes — investor readability */
  --text-footnote: 14px;
  --text-caption: 15px;
  --text-body: clamp(18px, 1.1vw + 14px, 21px);
  --text-large: clamp(20px, 1.2vw + 15px, 24px);
  --text-h3: clamp(22px, 1.5vw + 16px, 28px);
  --text-h2: clamp(28px, 2.5vw + 16px, 40px);
  --text-h1: clamp(36px, 4vw + 16px, 56px);
  --text-display: clamp(56px, 7vw + 16px, 108px);
  --text-hero: clamp(64px, 10vw + 16px, 140px);

  /* --- Spacing --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

table { border-collapse: collapse; }

/* ============ TOP NAVIGATION ============ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  padding: 0 var(--space-7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--navy-deep);
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy-deep);
}

.brand-accent { color: var(--champagne-dark); }

.nav-meta {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.slide-counter {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  transition: all 160ms ease-out;
  text-decoration: none;
}
a.nav-btn { text-decoration: none; }
a.nav-btn:hover, a.nav-btn:visited { text-decoration: none; }
.nav-btn:hover {
  color: var(--navy-deep);
  border-color: var(--champagne);
  background: var(--bg-subtle);
}

/* ============ PROGRESS BAR ============ */
.progress-track {
  position: fixed;
  top: 64px; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  z-index: 99;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: var(--champagne);
  transition: width 300ms ease-out;
}

/* ============ DECK ============ */
.deck {
  position: relative;
  height: 100vh;
  padding-top: 64px;
}

.slide {
  position: absolute;
  top: 64px; left: 0; right: 0; bottom: 0;
  display: none;
  opacity: 0;
  animation: slideIn 400ms ease-out forwards;
}

.slide.active { display: flex; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-inner {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-9) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
  overflow-y: auto;
}

.slide-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 900px;
}

.slide-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--champagne-dark);
}

.slide-title {
  font-family: var(--font-serif);
  font-size: var(--text-h1);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--navy-deep);
}

.slide-footer {
  position: absolute;
  bottom: 0;
  left: var(--space-9);
  right: var(--space-9);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding: var(--space-3) 0;
  background: var(--bg);
}

/* ============ SLIDE 1 — COVER ============ */
.slide-cover {
  color: var(--text-inverse);
}

.cover-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at top left, rgba(201, 169, 97, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(30, 70, 115, 0.6) 0%, transparent 60%),
    linear-gradient(180deg, var(--navy-deep) 0%, #0D2B50 100%);
}

.cover-inner {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  padding-top: var(--space-9);
  padding-bottom: var(--space-8);
}

.cover-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--champagne);
  opacity: 0.9;
}

.cover-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 1000px;
}

.cover-title-main {
  font-family: var(--font-serif);
  font-size: var(--text-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #FAFAF7;
}

.cover-title-sub {
  font-family: var(--font-sans);
  font-size: clamp(22px, 1.8vw + 14px, 32px);
  font-weight: 400;
  line-height: 1.35;
  color: rgba(250, 250, 247, 0.75);
  max-width: 840px;
}

.cover-highlight {
  display: flex;
  align-items: center;
  gap: var(--space-7);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border-navy);
  border-bottom: 1px solid var(--border-navy);
}

.cover-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cover-stat-value {
  font-family: var(--font-serif);
  font-size: clamp(40px, 3.5vw + 16px, 64px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--champagne);
  font-variant-numeric: tabular-nums;
}

.cover-stat-label {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(250, 250, 247, 0.72);
}

.cover-divider {
  width: 1px;
  height: 56px;
  background: var(--border-navy);
}

.cover-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-7);
  max-width: 900px;
}

.cover-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cover-meta-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(201, 169, 97, 0.8);
}

.cover-meta-value {
  font-size: 16px;
  font-weight: 500;
  color: rgba(250, 250, 247, 0.9);
  line-height: 1.4;
}

/* ============ SLIDE 2 — PROBLEM ============ */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.problem-card {
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.problem-stat {
  font-family: var(--font-serif);
  font-size: clamp(44px, 3.8vw + 14px, 64px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
}

.problem-stat-unit {
  font-size: 0.4em;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
  margin-left: 4px;
}

.problem-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy-deep);
  margin-top: var(--space-2);
}

.problem-card-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted);
}

.problem-resolution {
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy-mid) 100%);
  border-radius: var(--radius);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.problem-resolution::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px;
  height: 100%;
  background: var(--champagne);
}

.resolution-marker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--champagne);
}

.resolution-text {
  font-size: 18px;
  line-height: 1.5;
  color: rgba(250, 250, 247, 0.94);
  font-weight: 400;
}

.resolution-text strong {
  color: var(--champagne-light);
  font-weight: 600;
}

/* ============ SLIDE 3 — MARKET ============ */
.market-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) 0;
}

.market-primary {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.market-primary-value {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--champagne-dark);
  font-variant-numeric: tabular-nums;
}

.market-primary-label {
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-deep);
  margin-top: var(--space-3);
}

.market-primary-note {
  font-size: 15px;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.market-card {
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 160ms ease-out;
}
.market-card:hover {
  border-color: var(--champagne);
}

.market-card-value {
  font-family: var(--font-serif);
  font-size: clamp(32px, 2.8vw + 14px, 48px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
}

.market-card-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.market-card-source {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.market-insight {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--bg-subtle);
  border-left: 3px solid var(--champagne);
  border-radius: var(--radius-sm);
}

.insight-icon {
  font-size: 20px;
  color: var(--champagne-dark);
  line-height: 1.4;
}

.market-insight p {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
}

.market-insight strong {
  color: var(--navy-deep);
  font-weight: 600;
}

/* ============ SLIDE 4 — FINANCIALS ============ */
.fin-hero {
  text-align: center;
  padding: var(--space-2) 0;
}

.fin-hero-value {
  font-family: var(--font-serif);
  font-size: clamp(56px, 5vw + 14px, 84px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--champagne-dark);
  font-variant-numeric: tabular-nums;
}

.fin-hero-label {
  font-size: 18px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.fin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.fin-table {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.fin-table th,
.fin-table td {
  padding: 14px 20px;
  text-align: right;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
}

.fin-table thead th {
  background: var(--navy-deep);
  color: var(--text-inverse);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 16px 20px;
}

.fin-table thead th:first-child,
.fin-table tbody th {
  text-align: left;
}

.fin-table tbody th {
  font-weight: 500;
  color: var(--text);
  background: var(--bg-subtle);
}

.fin-table tbody tr:last-child td,
.fin-table tbody tr:last-child th { border-bottom: none; }

.fin-table td.highlight {
  color: var(--champagne-dark);
  font-weight: 700;
  font-size: 22px;
}

.fin-table td.positive { color: var(--positive); font-weight: 600; }
.fin-table td.negative { color: var(--negative); font-weight: 600; }

.fin-assumptions {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.assumptions-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--champagne-dark);
}

.assumptions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  font-size: 17px;
  font-weight: 600;
  color: var(--navy-deep);
}

.assumption-label {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 6px;
}

/* ============ ARROW NAV ============ */
.arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 50%;
  z-index: 50;
  transition: all 180ms ease-out;
  box-shadow: var(--shadow);
}
.arrow:hover {
  color: var(--navy-deep);
  border-color: var(--champagne);
  transform: translateY(-50%) scale(1.05);
}
.arrow-left { left: var(--space-5); }
.arrow-right { right: var(--space-5); }

.slide-cover ~ .arrow,
.slide-cover.active ~ .arrow {
  /* arrows stay visible on cover */
}

/* ============ TOC OVERLAY ============ */
.toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 31, 61, 0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.toc-overlay.active {
  display: flex;
  opacity: 1;
}

.toc-inner {
  width: 520px;
  max-width: 92vw;
  max-height: 80vh;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.toc-header h3 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--navy-deep);
  letter-spacing: -0.01em;
}

.toc-close {
  width: 32px;
  height: 32px;
  font-size: 24px;
  color: var(--text-muted);
  border-radius: 50%;
  transition: background 140ms ease-out;
}
.toc-close:hover { background: var(--bg-subtle); }

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 140ms ease-out;
}
.toc-list button:hover {
  background: var(--bg-subtle);
}

.toc-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--champagne-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.toc-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--navy-deep);
}

.toc-note {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-subtle);
  font-style: italic;
  text-align: center;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .slide-inner { padding: var(--space-6) var(--space-6) var(--space-7); }
  .problem-grid { grid-template-columns: 1fr; }
  .market-grid { grid-template-columns: repeat(2, 1fr); }
  .cover-footer { grid-template-columns: 1fr; gap: var(--space-4); }
  .cover-highlight { flex-direction: column; align-items: flex-start; gap: var(--space-4); }
  .cover-divider { display: none; }
  .assumptions-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar { padding: 0 var(--space-4); height: 56px; }
  .progress-track { top: 56px; }
  .slide { top: 56px; }
  .nav-btn span { display: none; }
  .market-grid { grid-template-columns: 1fr; }
  .fin-table th, .fin-table td { padding: 14px 12px; font-size: 15px; }
  .assumptions-grid { grid-template-columns: 1fr; }
  .slide-footer { position: relative; left: 0; right: 0; flex-direction: column; gap: 4px; }
}

/* ============ PRESENTATION MODE ============ */
body.presentation-mode .topbar,
body.presentation-mode .progress-track,
body.presentation-mode .slide-footer {
  opacity: 0;
  pointer-events: none;
}

body.presentation-mode { font-size: 18px; }
body.presentation-mode .slide { top: 0; }
body.presentation-mode .deck { padding-top: 0; }
