/* ============================================================
   Customer Insights — shared styles
   Brand tokens, baseline reset, section-nav, common components
   ============================================================ */

:root {
  --bg:                #3b4b77;
  --accent:            #2dd4bf;
  --text:              #ffffff;
  --text-muted:        rgba(255, 255, 255, 0.7);
  --text-dim:          rgba(255, 255, 255, 0.5);
  --border:            rgba(255, 255, 255, 0.3);
  --border-soft:       rgba(255, 255, 255, 0.12);
  --surface:           rgba(255, 255, 255, 0.06);
  --surface-soft:      rgba(255, 255, 255, 0.04);
  --accent-soft:       rgba(45, 212, 191, 0.08);
  --accent-glow:       rgba(45, 212, 191, 0.15);
  --danger:            #f87171;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Section navigation (3-column BACK | title | NEXT) ----- */

.sec-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 8px;
}

.sec-nav__header {
  justify-self: center;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.sec-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sec-nav__btn--back {
  justify-self: start;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.sec-nav__btn--back:hover { border-color: #fff; color: #fff; }

.sec-nav__btn--next {
  justify-self: end;
  background: var(--accent);
  border: none;
  color: var(--bg);
}
.sec-nav__btn--next:hover { filter: brightness(1.1); }

/* ----- Problem statement (section subtitle) ----- */

.problem-statement {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 24px;
  line-height: 1.55;
  text-align: center;
}

/* ----- Content card ----- */

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.content-card h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 12px 0; }
.content-card > p { font-size: 15px; line-height: 1.6; color: var(--text-muted); margin: 0 0 12px 0; }
.content-card > p:last-child { margin-bottom: 0; }
.content-card strong { color: var(--text); font-weight: 600; }

/* ----- Generic cards grid (icon / h3 / p) ----- */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
  background: rgba(45, 212, 191, 0.1);
}
.card h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 8px 0; }
.card p  { font-size: 14px; line-height: 1.55; color: var(--text-muted); margin: 0; }

/* ----- Concept cards (expand-on-click) ----- */

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.concept-card {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.concept-card:hover { border-color: var(--accent); }
.concept-card.expanded { border-color: var(--accent); background: var(--accent-soft); }
.concept-card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.concept-card .summary { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.concept-card .expand-hint {
  font-size: 12px; color: var(--accent); font-weight: 600;
  margin-top: 8px; display: flex; align-items: center; gap: 4px;
}
.concept-card .expand-hint svg { width: 12px; height: 12px; transition: transform 0.2s; }
.concept-card.expanded .expand-hint svg { transform: rotate(180deg); }
.concept-detail {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}
.concept-card.expanded .concept-detail { display: block; }
.concept-detail strong { color: var(--text); }
.concept-detail code {
  background: rgba(45, 212, 191, 0.1);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 12px;
  color: var(--accent);
}

/* ----- Stats row ----- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 6px; }

/* ----- Flow diagram ----- */

.diagram-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin: 20px 0;
}
.diagram-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 20px 0; text-align: center; }
.flow-diagram  { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.flow-step {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 20px;
  text-align: center;
  min-width: 130px;
}
.flow-step .step-num   { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; text-transform: uppercase; }
.flow-step .step-label { font-weight: 600; font-size: 14px; color: var(--text); }
.flow-arrow { color: var(--text-muted); font-size: 20px; }

/* ----- Callout ----- */

.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
  display: flex;
  gap: 14px;
}
.callout-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.callout-content h5 { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 4px 0; }
.callout-content p  { font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 0; }

/* ----- Tool section (calculator / interactive UI wrapper) ----- */

.tool-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
}
.tool-section h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 4px 0; }
.tool-desc       { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; font-style: italic; }

/* ----- Form elements ----- */

.input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field small { display: block; font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  min-height: 100px;
  resize: vertical;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ----- Chart + status messages ----- */

.chart-container {
  position: relative;
  width: 100%;
  max-height: 350px;
  margin-top: 14px;
}

.status-msg {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 10px;
  display: none;
}
.status-msg.error {
  display: block;
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.status-msg.success {
  display: block;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.3);
}
.status-msg.info {
  display: block;
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.3);
}
.status-msg.hidden { display: none; }

/* ----- CSV drop zone ----- */

.csv-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px;
}
.csv-drop-zone:hover,
.csv-drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.06);
}
.csv-drop-zone input[type="file"] { display: none; }

/* ----- Cohort / data table ----- */

.cohort-table-wrapper { overflow-x: auto; margin-top: 14px; }
.cohort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
}
.cohort-table th,
.cohort-table td {
  padding: 6px 8px;
  text-align: center;
  border: 1px solid var(--border-soft);
  color: var(--text);
}
.cohort-table th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}
.cohort-table td.label-cell {
  text-align: left;
  font-weight: 600;
  background: var(--surface-soft);
  white-space: nowrap;
}

/* ----- Details/summary ----- */

details { margin-bottom: 14px; }
summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ----- Buttons ----- */

.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.calc-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: filter 0.15s;
  font-family: inherit;
}
.calc-btn:hover { filter: brightness(1.1); }
.calc-btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.calc-btn.secondary:hover { background: var(--accent-soft); }

/* ----- Results panel ----- */

.results-panel {
  margin-top: 18px;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  display: none;
}
.results-panel.visible { display: block; }
.results-panel h3 {
  font-size: 16px; font-weight: 600; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px; letter-spacing: 0.03em;
}
.result-metric {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.result-metric:last-child { border-bottom: none; }
.result-metric .label { font-size: 14px; color: var(--text-muted); }
.result-metric .value {
  font-size: 16px; font-weight: 700;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  color: var(--text);
}

/* ----- Formula display ----- */

.formula-display {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 14px 18px;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 14px;
  color: var(--accent);
  margin: 10px 0;
  overflow-x: auto;
  line-height: 1.7;
  white-space: pre-wrap;
}
.formula-display .hl  { color: #60a5fa; font-weight: 500; }
.formula-display .op  { color: #fbbf24; }
.formula-display .res { color: #34d399; font-weight: 700; }

.segment-badge { margin-top: 12px; padding: 10px 14px; border-radius: 6px; font-size: 14px; }

/* ----- Accordion (click-to-expand items) ----- */

.accordion { margin-bottom: 20px; }
.accordion-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.accordion-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s ease;
}
.accordion-header:hover { background: rgba(255, 255, 255, 0.04); }
.accordion-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}
.accordion-header .num {
  width: 26px;
  height: 26px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.accordion-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
.accordion-icon::before {
  content: '+';
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}
.accordion-item.open .accordion-icon { transform: rotate(45deg); }
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.accordion-item.open .accordion-content { max-height: 2000px; }
.accordion-body {
  padding: 0 20px 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}
.accordion-body p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}
.accordion-body ul {
  list-style: none;
  margin: 10px 0 0 0;
  padding: 0;
}
.accordion-body li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.accordion-body li:last-child { border-bottom: none; }
.accordion-body li::before {
  content: '\2192';
  color: var(--accent);
  flex-shrink: 0;
}

/* ----- Inline highlights (used inside accordion / prose) ----- */

.highlight        { color: var(--accent); font-weight: 600; }
.highlight-rose   { color: #f87171;       font-weight: 600; }
.highlight-violet { color: #a78bfa;       font-weight: 600; }
.highlight-amber  { color: #fbbf24;       font-weight: 600; }

/* ----- Formula box (monospace math inside prose) ----- */

.formula-box {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 14px 0;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 14px;
  line-height: 1.8;
  color: var(--accent);
  overflow-x: auto;
}

/* ----- Quiz block ----- */

.quiz-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin: 20px 0;
}
.quiz-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px 0;
}
.quiz-options {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.quiz-option:hover { border-color: var(--accent); }
.quiz-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.quiz-option.correct  { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
}
.quiz-option .letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.quiz-option.correct .letter {
  background: var(--accent);
  color: var(--bg);
}
.quiz-option.incorrect .letter {
  background: var(--danger);
  color: #fff;
}
.quiz-feedback {
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: none;
}
.quiz-feedback.success {
  display: block;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.3);
}
.quiz-feedback.error {
  display: block;
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.quiz-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: filter 0.15s;
  font-family: inherit;
}
.quiz-btn:hover { filter: brightness(1.1); }
.quiz-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- Section headings (secondary h3 above grids) ----- */

.section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px 0;
}

/* ----- Segment grid (bullet-dot list of named items) ----- */

.segment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.segment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.segment-item h5 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.segment-item h5::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.segment-item p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ============================================================
   Hub page (index.html)
   ============================================================ */

.hub-hero {
  text-align: center;
  padding: 0 20px;
  margin: 0 0 20px 0;
}
.hub-hero h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
}
.hub-hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 8px;
  line-height: 1.55;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 20px auto 0;
}
.hub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.hub-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.hub-card__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px 0;
}
.hub-card__body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}
.hub-card__arrow {
  display: inline-block;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1366px) and (hover: none),
       (max-width: 1366px) and (pointer: coarse) {
  .content-card > p,
  .callout-content p,
  .card p,
  .tool-desc,
  .concept-card .summary,
  .concept-detail,
  .panel-desc,
  .result-metric .label { font-size: 16px; }
}

@media (max-width: 720px) {
  .hub-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .hub-hero h1 { font-size: 28px; }
}

@media (max-width: 600px) {
  .sec-nav__header   { font-size: 24px; }
  .problem-statement { font-size: 14px; }
  .content-card      { padding: 18px 20px; }
  .content-card h2   { font-size: 18px; }
  .content-card > p,
  .callout-content p,
  .card p            { font-size: 14px; }
  .cards-grid        { grid-template-columns: 1fr; }
  .stats-row         { grid-template-columns: 1fr; }
  .concept-grid      { grid-template-columns: 1fr; }
  .input-row         { grid-template-columns: 1fr; }
  .diagram-container { padding: 18px; }
  .flow-diagram      { flex-direction: column; }
  .flow-arrow        { transform: rotate(90deg); }
  .tool-section      { padding: 18px 20px; }
  .hub-hero h1       { font-size: 24px; }
  .hub-hero p        { font-size: 14px; }
  .hub-card          { padding: 24px 22px; }
  .segment-grid      { grid-template-columns: 1fr; }
  .quiz-container    { padding: 18px 20px; }
  .formula-box       { font-size: 12px; padding: 12px 14px; }
}
