/* ============================================================
   Seller Pains, global styles
   Brand chrome: Amazon squid-ink + orange (no data meaning).
   Data encoding: validated dataviz ramps (see color-formula validator).
   Light + dark. Default follows the OS; a manual toggle wins and persists.
   ============================================================ */

:root {
  color-scheme: light;
  /* brand chrome */
  --ink:        #232F3E;   /* Amazon squid ink */
  --ink-2:      #37475A;
  --orange:     #FF9900;   /* Amazon orange */
  --orange-ink: #C77400;   /* orange dark enough for text on light */

  /* page + surfaces (dataviz reference) */
  --plane:      #f4f5f6;
  --surface:    #ffffff;
  --surface-2:  #fbfbfa;
  --text:       #0b0b0b;
  --text-2:     #52514e;
  --muted:      #898781;
  --hair:       rgba(11,11,11,0.10);
  --grid:       #e1e0d9;

  /* sequential blue ramp (validated) */
  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
  --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;

  /* heatmap 4 ordinal bins (validated both modes) */
  --bin-1: #86b6ef; --bin-2: #3987e5; --bin-3: #256abf; --bin-4: #184f95;

  /* status (fixed, never themed), ALWAYS paired with icon + label */
  --st-open:     #d03b3b;
  --st-partial:  #fab219;
  --st-resolved: #0ca30c;

  --shadow: 0 1px 2px rgba(35,47,62,.06), 0 4px 16px rgba(35,47,62,.06);
  --radius: 10px;
  --maxw: 1120px;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:      #0d0d0d;
  --surface:    #1a1a19;
  --surface-2:  #201f1e;
  --text:       #ffffff;
  --text-2:     #c3c2b7;
  --muted:      #898781;
  --hair:       rgba(255,255,255,0.12);
  --grid:       #2c2c2a;
  --ink:        #0f1620;
  --ink-2:      #232F3E;
  --seq-250: #86b6ef; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95;
  --bin-1: #86b6ef; --bin-2: #3987e5; --bin-3: #256abf; --bin-4: #184f95;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:#0d0d0d; --surface:#1a1a19; --surface-2:#201f1e;
    --text:#ffffff; --text-2:#c3c2b7; --hair:rgba(255,255,255,0.12); --grid:#2c2c2a;
    --ink:#0f1620; --ink-2:#232F3E;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Amazon Ember", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--plane);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--seq-500); text-decoration: none; }
a:hover { text-decoration: underline; }
:root[data-theme="dark"] a { color: var(--seq-250); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; border-top: 1px solid var(--hair); }
.section:first-of-type { border-top: none; }
h1,h2,h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -0.01em; }
h2.section-title { font-size: 1.7rem; }
h2 .eyebrow, .eyebrow {
  display: block; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--orange-ink); margin-bottom: 6px;
}
:root[data-theme="dark"] .eyebrow { color: var(--orange); }
.lede { font-size: 1.06rem; color: var(--text-2); max-width: 70ch; }
.small { font-size: .85rem; color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- top nav (floats + condenses on scroll) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: box-shadow .28s ease, background .28s ease, border-color .28s ease;
}
.nav .wrap { display: flex; align-items: center; gap: 20px; height: 60px; transition: height .28s ease; }
.nav.scrolled {
  background: color-mix(in srgb, var(--ink) 96%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom-color: rgba(255,255,255,.14);
  box-shadow: 0 10px 30px rgba(0,0,0,.32);
}
.nav.scrolled .wrap { height: 50px; }
.nav .brand { color: #fff; font-weight: 700; letter-spacing: -0.01em; display:flex; align-items:center; gap:9px; }
.nav .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 0 rgba(255,153,0,.55); animation: pulseDot 3s ease-in-out infinite; }
.nav .links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav .links a {
  color: #cdd3da; font-size: .82rem; font-weight: 500; padding: 6px 10px; border-radius: 6px;
}
.nav .links a:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }
.nav .links a.contact {
  color: #fff; border: 1px solid rgba(255,153,0,.55); margin-left: 4px;
}
.nav .links a.contact:hover { background: var(--orange); color: #231f1a; border-color: var(--orange); }
.theme-btn {
  background: rgba(255,255,255,.10); color:#fff; border:none; cursor:pointer;
  width:34px; height:34px; border-radius:7px; font-size:1rem; line-height:1;
}
.theme-btn:hover { background: rgba(255,255,255,.2); }
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,153,0,.5); }
  50%     { box-shadow: 0 0 0 5px rgba(255,153,0,0); }
}

/* ---------- hero (majestic) ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  color: #fff; padding: 96px 0 84px;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(120% 120% at 85% -10%, #2b3a4d 0%, transparent 55%),
    linear-gradient(155deg, #0f1620 0%, #232F3E 46%, #2c3e52 100%);
}
/* scroll affordance pinned to the bottom of the full-height hero */
.hero-scroll {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.38); border-radius: 14px;
}
.hero-scroll span {
  position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px;
  background: rgba(255,255,255,.75); border-radius: 2px;
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}
/* animated aurora sheet behind the copy */
.hero .hero-bg {
  position: absolute; inset: -30% -10% -10% -10%; z-index: -2;
  background:
    radial-gradient(45% 55% at 20% 25%, rgba(255,153,0,.20), transparent 60%),
    radial-gradient(40% 50% at 78% 18%, rgba(57,135,229,.28), transparent 62%),
    radial-gradient(50% 60% at 62% 88%, rgba(37,106,191,.22), transparent 60%);
  filter: blur(6px);
  animation: heroDrift 26s ease-in-out infinite alternate;
}
/* fine grid overlay for depth */
.hero .hero-glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px, 46px 46px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
}
.hero-inner { position: relative; }
.hero-eyebrow { color: var(--orange) !important; }
.hero h1 {
  font-size: clamp(2.3rem, 5.2vw, 4rem); max-width: 18ch; color: #fff;
  line-height: 1.06; letter-spacing: -0.025em; font-weight: 800;
  text-shadow: 0 2px 30px rgba(0,0,0,.35);
}
.hero .sub { font-size: 1.16rem; color: #dbe0e6; max-width: 64ch; margin-top: 14px; }

/* scoring explainer, dimmed, at the foot of Key findings */
.score-explainer {
  margin-top: 30px; padding-top: 22px; border-top: 1px dashed var(--hair);
  max-width: 900px; opacity: .58; transition: opacity .3s ease;
}
.score-explainer:hover, .score-explainer:focus-within { opacity: 1; }
.score-explainer .fx-title {
  font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 10px;
}
.score-explainer .fx-formula {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--hair); padding: 5px 9px; border-radius: 7px; margin-bottom: 12px;
}
.score-explainer .fx-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.score-explainer .fx-list li { font-size: .84rem; color: var(--text-2); line-height: 1.5; }
.score-explainer .fx-list b { color: var(--text); font-weight: 700; }
.score-explainer .fx-note { margin-top: 12px; font-size: .8rem; color: var(--muted); }

/* ---------- funnel (research pipeline) ---------- */
.funnel { margin-top: 30px; display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.funnel .rung {
  position: relative; display: flex; align-items: baseline; gap: 14px;
  padding: 12px 18px; border-radius: 10px; color: #fff;
  background: linear-gradient(90deg, rgba(255,153,0,.9), rgba(255,153,0,.55));
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
  transition: transform .18s ease;
}
.funnel .rung:hover { transform: translateX(3px); }
.funnel .rung:nth-child(1) { width: 100%;  background: linear-gradient(90deg, #ffb43d, #ff9900); }
.funnel .rung:nth-child(2) { width: 82%;   background: linear-gradient(90deg, #5aa0ee, #3987e5); }
.funnel .rung:nth-child(3) { width: 60%;   background: linear-gradient(90deg, #3f8ae0, #256abf); }
.funnel .rung:nth-child(4) { width: 42%;   background: linear-gradient(90deg, #2f74c9, #184f95); }
.funnel .rung b { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.funnel .rung span { font-size: .82rem; opacity: .95; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.funnel .rung::after {
  content: ""; position: absolute; left: 22px; bottom: -8px; width: 2px; height: 8px;
  background: rgba(255,255,255,.4);
}
.funnel .rung:last-child::after { display: none; }

/* ---------- KPI stat tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.kpi .v { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; }
.kpi .k { font-size: .8rem; color: var(--text-2); margin-top: 2px; }
.kpi .note { font-size: .74rem; color: var(--muted); margin-top: 8px; }

/* ---------- generic card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:20px; }

/* ---------- status chip (icon + label, never color alone) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700;
  padding: 2px 9px 2px 7px; border-radius: 20px; white-space: nowrap;
  border: 1px solid transparent;
}
.chip .ic { font-weight: 900; font-size:.8em; }
.chip.open     { color: #8f1f1f; background: #fbe6e6; border-color: #f2c2c2; }
.chip.partial  { color: #7a5200; background: #fdf1d6; border-color: #f6dfa3; }
.chip.resolved { color: #0a5b0a; background: #e3f5e3; border-color: #b9e6b9; }
:root[data-theme="dark"] .chip.open     { color:#ffb4b4; background:rgba(208,59,59,.16); border-color:rgba(208,59,59,.4); }
:root[data-theme="dark"] .chip.partial  { color:#ffd888; background:rgba(250,178,25,.14); border-color:rgba(250,178,25,.38); }
:root[data-theme="dark"] .chip.resolved { color:#8fe58f; background:rgba(12,163,12,.16); border-color:rgba(12,163,12,.4); }

/* ---------- score bar (sequential magnitude) ---------- */
.scorebar { display:flex; align-items:center; gap:10px; }
.scorebar .track {
  flex:1; height: 8px; background: var(--grid); border-radius: 4px; overflow:hidden; min-width:80px;
}
.scorebar .fill { height:100%; border-radius:4px; background: var(--seq-500); }
.scorebar .val { font-weight:800; font-variant-numeric: tabular-nums; min-width: 2.4ch; text-align:right; }

/* ---------- category section ---------- */
.cat-head { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom: 4px; }
.cat-head .icon { font-size:1.4rem; }
.cat-head .id { font-weight:800; color: var(--orange-ink); }
:root[data-theme="dark"] .cat-head .id { color: var(--orange); }
.cat-head .cn { color: var(--muted); font-size:.9rem; }
.cat-stats { font-size:.8rem; color: var(--text-2); margin-bottom:14px; }

/* pain row */
.pain {
  border-top: 1px solid var(--hair); padding: 14px 0; display:grid;
  grid-template-columns: 62px 1fr; gap: 16px; align-items:start;
}
.pain:first-child { border-top:none; }
.pain .ps-col { text-align:center; }
.pain .ps-badge {
  font-size:1.15rem; font-weight:800; font-variant-numeric:tabular-nums;
  color: var(--seq-600); line-height:1;
}
:root[data-theme="dark"] .pain .ps-badge { color: var(--seq-250); }
.pain .ps-col .lbl { font-size:.6rem; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; }
.pain .title { font-weight:600; margin-bottom:2px; }
.pain .title .pid { color: var(--muted); font-weight:700; font-size:.8rem; margin-right:6px; }
.pain .cn { color: var(--text-2); font-size:.88rem; }
.pain .meta { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:8px; }
.pain .yrs { font-size:.74rem; color:var(--muted); font-variant-numeric:tabular-nums; }
.pain .prob { font-size:.9rem; color: var(--text-2); margin-top:8px; max-width: 78ch; display:none; }
.pain.exp .prob { display:block; }
.pain .srcs { margin-top:8px; display:none; flex-wrap:wrap; gap:6px; }
.pain.exp .srcs { display:flex; }
.pain .srcs a {
  font-size:.73rem; padding:2px 8px; border:1px solid var(--hair); border-radius:14px;
  color: var(--text-2); background: var(--surface-2);
}
.pain .srcs a:hover { border-color: var(--seq-400); color: var(--seq-500); text-decoration:none; }
.pain .srcs a .tag { font-weight:700; }
.expand-hint { font-size:.72rem; color: var(--seq-500); cursor:pointer; user-select:none; margin-top:6px; }
:root[data-theme="dark"] .expand-hint { color: var(--seq-250); }

/* ---------- heatmap (category x year, 4 ordinal bins) ---------- */
.heat { overflow-x:auto; }
.heat table { border-collapse: separate; border-spacing: 3px; width:100%; }
.heat th { font-size:.74rem; color: var(--text-2); font-weight:600; padding:4px; text-align:center; }
.heat th.rowh { text-align:left; white-space:nowrap; }
.heat td {
  text-align:center; border-radius:6px; font-size:.8rem; font-weight:700;
  font-variant-numeric:tabular-nums; padding:9px 4px; min-width:46px; color:#fff;
}
.heat td.b0 { background: var(--surface-2); color: var(--muted); }
.heat td.b1 { background: var(--bin-1); color:#0b0b0b; }
.heat td.b2 { background: var(--bin-2); color:#fff; }
.heat td.b3 { background: var(--bin-3); color:#fff; }
.heat td.b4 { background: var(--bin-4); color:#fff; }
.heat .rowh { font-size:.78rem; color: var(--text); }
.heat-legend { display:flex; gap:14px; align-items:center; margin-top:12px; font-size:.76rem; color:var(--text-2); flex-wrap:wrap; }
.heat-legend .sw { display:inline-flex; align-items:center; gap:5px; }
.heat-legend .box { width:14px; height:14px; border-radius:3px; display:inline-block; }

/* ---------- filter bar ---------- */
.filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:22px; }
.filters .fbtn {
  font-size:.8rem; padding:6px 12px; border:1px solid var(--hair); background:var(--surface);
  color: var(--text-2); border-radius:20px; cursor:pointer; font-family:inherit;
}
.filters .fbtn:hover { border-color: var(--seq-400); }
.filters .fbtn.active { background: var(--ink); color:#fff; border-color: var(--ink); }
:root[data-theme="dark"] .filters .fbtn.active { background: var(--orange); color:#231f1a; border-color:var(--orange); }

/* ---------- floating back-to-top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--orange); color: #231f1a; font-size: 1.25rem; font-weight: 800; line-height: 1;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(.9);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.to-top:hover { filter: brightness(1.06); transform: translateY(-2px) scale(1.04); }

/* ---------- CTA band ---------- */
.cta {
  border-top: 1px solid var(--hair); color: #fff; padding: 60px 0;
  background:
    radial-gradient(90% 140% at 100% 0%, rgba(255,153,0,.16), transparent 60%),
    linear-gradient(150deg, #0f1620 0%, #232F3E 100%);
}
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap; }
.cta-copy h2 { font-size: 1.85rem; color: #fff; margin: .1em 0 .25em; }
.cta-copy p { color: #cdd3da; max-width: 54ch; margin: 0; }
.cta-btn {
  flex-shrink: 0; display: inline-block; background: var(--orange); color: #231f1a;
  font-weight: 800; font-size: .98rem; padding: 15px 26px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  transition: transform .18s ease, filter .18s ease;
}
.cta-btn:hover { text-decoration: none; transform: translateY(-2px); filter: brightness(1.06); }

/* ---------- scroll reveal (plays down and back up) ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s cubic-bezier(.22,.61,.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color:#aeb6bf; padding: 34px 0; font-size:.84rem; }
.foot a { color:#cdd3da; }
.foot .files { margin-top:10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:.78rem; color:#8b939c; }

/* ---------- animations ---------- */
@keyframes heroDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1.08); }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .funnel .rung { width: 100% !important; }
  .funnel .rung b { font-size: 1.25rem; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .section { padding: 42px 0; }
  h2.section-title { font-size: 1.42rem; }
  /* keep all nav items on one line, scroll horizontally instead of wrapping */
  .nav .wrap { gap: 10px; }
  .nav .links {
    gap: 2px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav .links::-webkit-scrollbar { display: none; }
  .nav .links a { padding: 6px 8px; font-size: .8rem; white-space: nowrap; }
  .nav .links a.contact { margin-left: 2px; }
  .kpis { grid-template-columns: 1fr; }
  .hero { padding: 88px 0 72px; }
  .hero .sub { font-size: 1.02rem; }
  .funnel .rung { padding: 11px 14px; }
  .funnel .rung b { font-size: 1.12rem; }
  .funnel .rung span { font-size: .72rem; }
  .cta { padding: 44px 0; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
  .cta-copy h2 { font-size: 1.5rem; }
  .cta-btn { width: 100%; text-align: center; }
  .to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero .hero-bg { animation: none; }
  .hero-scroll span { animation: none; }
  .nav .brand .dot { animation: none; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}
