/* ==========================================================================
   Firsthand — marketing site
   Palette and type come from docs/brand/README.md, which lifts the palette
   from app/viz/charts.jsx so the brand and the product dashboard cannot drift.
   The one rule that makes it a system: blue is always the correct/expected
   element, orange is always the displaced one. Orange is never decorative.
   ========================================================================== */

:root {
  --blue: #2a78d6;
  --blue-deep: #1f5aa3;
  --orange: #eb6834;
  --ink: #0b0b0b;
  --putty: #e1e0d9;
  --wash: #f6f6f5;
  --white: #ffffff;

  --muted: #55554f;
  --muted-soft: #7a7a72;

  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: "Work Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --wrap: 68rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.97rem + 0.16vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap.narrow { max-width: 46rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--white);
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

:where(a, button, input):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Wordmark ------------------------------------------------------------
   Two layers stacked in one grid cell. Both SVGs share viewBox "0 0 417 107",
   so they register exactly at any size and only the dot layer is transformed.
   ------------------------------------------------------------------------ */

.wordmark {
  display: grid;
  width: var(--wm-w, 9rem);
}

.wordmark > img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
}

.wordmark--sm   { --wm-w: 7.5rem; }
.wordmark--hero { --wm-w: clamp(11rem, 26vw, 16rem); margin: 0 auto 2.25rem; }
.wordmark--foot { --wm-w: 7rem; }

/* The kinetic moment the brand README asks for and static artwork can't carry:
   the dot arrives late and settles into the slot the reader is already holding
   open for it. Motion is the only place the "ghost slot" idea survives. */
@keyframes dot-arrive {
  0%   { transform: translate(-18%, -155%) scale(0.55); opacity: 0; }
  55%  { opacity: 1; }
  70%  { transform: translate(0, 6%) scale(1.06); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; }
}

.wordmark-dot--kinetic {
  transform-origin: 22% 14%;
  animation: dot-arrive 1150ms cubic-bezier(0.22, 0.8, 0.3, 1) 180ms both;
}

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

.btn {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  padding: 0.85rem 1.4rem;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.btn--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}
.btn--primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }

.btn--ghost {
  background: transparent;
  border-color: var(--putty);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }

.btn--lg { padding: 1rem 1.75rem; font-size: 1rem; }

/* --- Header -------------------------------------------------------------- */

.site-head {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--putty);
  background: color-mix(in srgb, var(--wash) 85%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(8px);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
  text-align: center;
}

.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.2rem + 4.2vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

.hero-sub {
  max-width: 40rem;
  margin: 0 auto;
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.hero-cta {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.hero-note {
  font-size: 0.875rem;
  color: var(--muted-soft);
}

/* --- Sections ------------------------------------------------------------ */

.section {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--putty);
}

.eyebrow {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.9rem;
}

.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 1.1rem + 2.1vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 1.1rem;
  max-width: 24ch;
  text-wrap: balance;
}

.section--cta .section-title,
.narrow .section-title { max-width: none; }

.section-lead {
  max-width: 46rem;
  margin: 0;
  font-size: clamp(1rem, 0.97rem + 0.3vw, 1.125rem);
  color: var(--muted);
  text-wrap: pretty;
}

.section-note {
  margin: 2rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted-soft);
  max-width: 44rem;
}

/* --- The gap chart ------------------------------------------------------- */

.gap {
  margin: 2.75rem 0 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--white);
  border: 1px solid var(--putty);
  border-radius: 16px;
}

.gap-caption {
  font-size: 0.8125rem;
  color: var(--muted-soft);
  margin-bottom: 1.25rem;
}

.gap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.key { display: inline-flex; align-items: center; gap: 0.45rem; }
.key::before {
  content: "";
  width: 12px; height: 12px;
  border-radius: 3px;
}
.key--said::before      { background: var(--orange); }
.key--credited::before  { background: var(--blue); }

.gap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.gap-table thead th {
  text-align: left;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-soft);
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--putty);
}

.gap-table tbody th,
.gap-table tbody td {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--wash);
  vertical-align: middle;
}

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

.gap-table tbody th {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  padding-right: 1.25rem;
  width: 1%;
}

.gap-table .bars {
  width: 100%;
  padding-right: 1.25rem;
  display: grid;
  gap: 4px;
  min-width: 8rem;
}

/* Bars carry their own value as text — the project's dataviz rule is that a
   number never hides inside a tooltip. Narrow bars push the label outside. */
.bar {
  --w: 0%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 22px;
  width: var(--w);
  min-width: 1.75rem;
  padding-right: 0.5rem;
  border-radius: 4px;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
}

.bar--said     { --w: var(--said);     background: var(--orange); }
.bar--credited { --w: var(--credited); background: var(--blue); }

.gap-table .delta {
  white-space: nowrap;
  text-align: right;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-soft);
  width: 1%;
}

.delta.under { color: #b8481c; font-weight: 600; }
.delta.over  { color: var(--blue-deep); font-weight: 600; }

/* --- Cards --------------------------------------------------------------- */

.cards {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}

.card {
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--putty);
  border-radius: 14px;
}

.card h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.015em;
  margin: 0 0 0.6rem;
}

.card p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* The integrity guardrail is the one claim in this section that the category
   doesn't make. Orange marks it, because it is the displaced expectation. */
.card--rule { border-color: color-mix(in srgb, var(--orange) 45%, var(--putty)); }
.card--rule h3::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 0.45em;
  vertical-align: 0.18em;
  border-radius: 50%;
  background: var(--orange);
}

/* --- Trust list ---------------------------------------------------------- */

.trust-list {
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.9rem;
  max-width: 46rem;
}

.trust-list li {
  padding-left: 1.6rem;
  position: relative;
  color: var(--muted);
  text-wrap: pretty;
}

.trust-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.trust-list strong { color: var(--ink); font-weight: 600; }

/* --- CTA ----------------------------------------------------------------- */

.section--cta { text-align: center; }
.section--cta .section-lead { margin-inline: auto; }
.section--cta p:last-child { margin-top: 2rem; }

/* --- Footer -------------------------------------------------------------- */

.site-foot {
  background: var(--ink);
  color: #cfcfc9;
  padding: 3rem 0;
}

.foot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.foot-line {
  margin: 0;
  font-size: 0.875rem;
  color: #8d8d86;
}

/* --- Scroll reveal ------------------------------------------------------- */
/* Sections are visible by default. The hidden state is only applied once the
   script confirms IntersectionObserver exists, so no-JS never means no-page. */

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 620ms ease, transform 620ms cubic-bezier(0.22, 0.8, 0.3, 1);
}

.js-reveal .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .wordmark-dot--kinetic { animation: none; opacity: 1; transform: none; }
  .js-reveal .reveal { opacity: 1; transform: none; }
}

/* --- Narrow screens ------------------------------------------------------ */

@media (max-width: 40rem) {
  .site-head { position: static; backdrop-filter: none; }

  .gap { padding: 1.1rem; }
  .gap-table { font-size: 0.875rem; }

  /* The delta column is the first thing to cost more than it earns on a phone;
     the bars already carry the comparison, so drop the words, not the data. */
  .gap-table thead th:last-child,
  .gap-table .delta { display: none; }

  .gap-table tbody th { white-space: normal; padding-right: 0.75rem; }
  .gap-table .bars { padding-right: 0; }
}

@media (max-width: 26rem) {
  .head-inner .btn--ghost { display: none; }
}
