/* =========================================================================
   TOPTELLER ONBOARDING PORTAL — DESIGN SYSTEM
   Signature idea: the "progress rail" — a transit-map style journey line
   that runs through the top bar and mirrors the numbered step lists below.
   Palette: ink navy + jade (money/growth) + amber (premium tiers), on a
   cool porcelain background rather than the common warm-cream default.
   ========================================================================= */

:root {
  /* ---- palette ---- */
  --ink:        #0B1F2A;
  --ink-soft:   #16303F;
  --jade:       #1FAA75;
  --jade-deep:  #167F58;
  --amber:      #E8A33D;
  --coral:      #E15B4D;
  --porcelain:  #F3F6F4;
  --paper:      #FFFFFF;
  --line:       #E1E7E5;
  --text:       #14242B;
  --text-soft:  #4C5E63;

  /* ---- type ---- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* ---- layout ---- */
  --sidebar-w: 300px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-soft: 0 8px 30px rgba(11, 31, 42, 0.08);
  --shadow-lift: 0 16px 40px rgba(11, 31, 42, 0.14);

  --bg: var(--porcelain);
  --surface: var(--paper);
  --surface-glass: rgba(255, 255, 255, 0.6);
  --border: var(--line);
  --fg: var(--text);
  --fg-soft: var(--text-soft);
}

html[data-theme="dark"] {
  --bg: #0A1620;
  --surface: #10222E;
  --surface-glass: rgba(16, 34, 46, 0.6);
  --border: #223B47;
  --fg: #EAF1EF;
  --fg-soft: #9FB4B8;
  --porcelain: #0A1620;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--fg); margin: 0 0 0.4em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--fg-soft); }
a { color: var(--jade-deep); }
button { font-family: inherit; cursor: pointer; }
ul, ol { padding-left: 0; margin: 0; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ===================== SHELL / LAYOUT ===================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 20px 16px;
  gap: 16px;
  overflow-y: auto;
  z-index: 40;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  box-shadow: var(--shadow-soft);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.sidebar-close { display: none; }

.search-box { position: relative; }
#searchInput {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  font-size: 14px;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lift);
  max-height: 320px; overflow-y: auto; z-index: 50;
}
.search-result-item { display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; background: none; border-bottom: 1px solid var(--border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item:focus { background: var(--bg); }
.search-result-item strong { display: block; font-size: 13.5px; color: var(--fg); }
.search-result-item span { font-size: 12px; color: var(--fg-soft); }

.nav-tree { flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-soft); font-weight: 600; margin: 0 0 8px 6px;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; text-align: left; padding: 9px 10px;
  border-radius: var(--radius-sm); font-size: 14px; color: var(--fg-soft);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--bg); color: var(--fg); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background 0.15s ease, transform .15s ease; }
.nav-link.is-active { background: color-mix(in srgb, var(--jade) 12%, transparent); color: var(--ink); font-weight: 600; }
html[data-theme="dark"] .nav-link.is-active { color: #fff; }
.nav-link.is-active .nav-dot { background: var(--jade); transform: scale(1.3); }
.nav-link.is-done .nav-dot { background: var(--jade-deep); }
.nav-link--final { font-weight: 600; }

.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; color: var(--fg);
}
.text-btn { background: none; border: none; color: var(--fg-soft); font-size: 13px; text-align: left; padding: 4px 6px; }
.text-btn:hover { color: var(--fg); }

.sidebar-scrim { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; background: var(--surface-glass);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--fg); flex-shrink: 0;
}
#menuBtn { display: none; }

.progress-rail {
  flex: 1; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden;
  position: relative;
}
.progress-rail__fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, var(--jade), var(--amber));
  transition: width 0.4s ease;
}
.progress-label { font-size: 12.5px; color: var(--fg-soft); white-space: nowrap; font-family: var(--font-mono); }
.bookmark-btn.is-bookmarked { color: var(--amber); border-color: var(--amber); }

.content-pane { flex: 1; padding: 40px clamp(20px, 5vw, 64px); max-width: 980px; width: 100%; margin: 0 auto; }
.chapter-wrap { animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== CHAPTER HEAD ===================== */
.chapter-head { margin-bottom: 24px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--jade-deep); margin: 0 0 10px;
}
.eyebrow--mandatory { color: var(--coral); }
.chapter-subtitle { font-size: 17px; color: var(--fg-soft); max-width: 60ch; }
.lead-text { font-size: 16px; color: var(--fg); max-width: 68ch; }
.subhead { font-size: 15px; margin-top: 28px; }

.shot {
  margin: 0 0 28px; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-lift); border: 1px solid var(--border);
  background: var(--surface);
}
.shot img { width: 100%; }

/* ===================== HERO ===================== */
.chapter--hero { padding-top: 8px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero-copy h1 { font-size: clamp(30px, 4vw, 44px); }
.hero-subtitle { font-size: 18px; color: var(--fg-soft); }
.hero-art .shot { margin-bottom: 0; }

/* ===================== BUTTONS ===================== */
.action-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.action-row--center { justify-content: center; }
.btn {
  border-radius: 999px; padding: 13px 22px; font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: linear-gradient(135deg, var(--jade), var(--jade-deep)); color: #fff; box-shadow: 0 10px 24px rgba(31,170,117,0.28); }
.btn--secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn--ghost { background: transparent; color: var(--fg-soft); border-color: var(--border); }
.btn--wide { width: 100%; justify-content: center; margin-top: 16px; }
.swipe-hint { opacity: 0.7; font-weight: 400; }

/* ===================== STEP LIST ===================== */
.step-list { list-style: none; display: flex; flex-direction: column; gap: 18px; margin: 20px 0; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: #fff; font-family: var(--font-mono); font-weight: 500;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
html[data-theme="dark"] .step-num { background: var(--jade); color: var(--ink); }
.step h3 { font-size: 16px; margin-bottom: 4px; }
.step p { margin: 0; }

/* ===================== CALLOUTS ===================== */
.callout { border-radius: var(--radius-md); padding: 16px 18px; margin: 20px 0; font-size: 14.5px; }
.callout ul { margin: 8px 0 0 18px; }
.callout--tip { background: color-mix(in srgb, var(--jade) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--jade) 30%, var(--border)); color: var(--fg); }
.callout--warn { background: color-mix(in srgb, var(--coral) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--coral) 25%, var(--border)); color: var(--fg); }
.muted-note { font-size: 13.5px; color: var(--fg-soft); }

/* ===================== SLIDESHOW ===================== */
.slideshow { position: relative; }
.slide-track { position: relative; min-height: 1px; }
.slide { display: none; }
.slide.is-active { display: block; animation: fadeUp 0.3s ease; }
.slide-purpose { font-size: 14px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); }
.slide-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.slide-dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 0.2s ease; }
.dot.is-active { background: var(--jade); width: 22px; border-radius: 4px; }

/* ===================== CHOICE / FIELDS / AREA GRIDS ===================== */
.choice-grid, .area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0; }
.choice-card, .area-card, .field-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 20px; box-shadow: var(--shadow-soft);
}
.choice-card h3, .area-card h3 { font-size: 16px; }
.choice-who { font-family: var(--font-mono); font-size: 12px; color: var(--jade-deep); margin: 0; }

.field-list { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.field-card h3 { font-size: 16px; margin-bottom: 10px; }
.field-card dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; margin: 0; }
.field-card dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-soft); font-weight: 600; }
.field-card dd { margin: 0 0 6px; font-size: 14.5px; }
.field-list--simple { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
.field-card--simple p { margin: 0; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pill {
  background: color-mix(in srgb, var(--amber) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border));
  color: var(--fg); font-size: 13px; padding: 7px 14px; border-radius: 999px;
}
.plain-list { list-style: disc; margin: 10px 0 10px 20px; color: var(--fg-soft); }
.plain-list li { margin-bottom: 6px; }

.success-panel {
  background: linear-gradient(135deg, color-mix(in srgb, var(--jade) 15%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--jade) 35%, var(--border));
  border-radius: var(--radius-lg); padding: 24px; text-align: center; margin: 24px 0;
}

/* ===================== FAQ ===================== */
.faq-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: '+'; margin-right: 10px; color: var(--jade-deep); font-weight: 700; }
.faq-item[open] summary::before { content: '−'; }
.faq-item p, .faq-item ul { margin: 10px 0 0; }

.related-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.chip {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-size: 13.5px; color: var(--fg);
}
.chip:hover { border-color: var(--jade); color: var(--jade-deep); }

/* ===================== COMPLETION ===================== */
.chapter--completion { text-align: center; max-width: 640px; margin: 0 auto; }
.completion-badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--jade), var(--amber)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: var(--shadow-lift);
}
.progress-track { height: 8px; border-radius: 4px; background: var(--border); margin: 20px 0; overflow: hidden; }
.progress-track__fill { height: 100%; background: linear-gradient(90deg, var(--jade), var(--amber)); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--fg-soft); }

/* ===================== FOOTER NAV ===================== */
.chapter-footer {
  display: flex; justify-content: space-between; padding: 18px clamp(20px, 5vw, 64px) 32px;
  max-width: 980px; margin: 0 auto; width: 100%;
}

/* ===================== VIDEO MODAL ===================== */
.video-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.video-modal[hidden] { display: none; }
.video-modal__backdrop { position: absolute; inset: 0; background: rgba(10,22,32,0.7); backdrop-filter: blur(4px); }
.video-modal__box { position: relative; width: min(900px, 100%); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lift); }
.video-modal__close { position: absolute; top: 12px; right: 12px; z-index: 2; background: var(--surface); }
.video-modal__frame { position: relative; padding-top: 56.25%; }
.video-modal__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  #menuBtn { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform 0.25s ease; box-shadow: var(--shadow-lift);
    width: min(320px, 86vw);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-scrim.is-open { display: block; position: fixed; inset: 0; background: rgba(10,22,32,0.5); z-index: 39; }
  .content-pane { padding: 28px 18px 60px; }
  .progress-label { display: none; }
  .field-card dl { grid-template-columns: 1fr; }
  .field-card dt { margin-top: 8px; }
}

@media print {
  .sidebar, .topbar, .chapter-footer, .video-modal { display: none !important; }
  .content-pane { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
