/* =============================================================================
   Visuals: the hero headline loop and the "From raw to clean" data section.
   Motion is driven by static/site.js; everything here also renders a sensible
   static state without JavaScript or with reduced motion.
   ========================================================================== */

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

/* =================================================================== hero
   The headline is the data. Scrolling moves the logo's green bar along its
   loop: first it turns the clean headline raw, then cleans it again. */
.v-type { container-type: inline-size; }
.v-type h1 {
  position: relative;
  font-size: min(150px, calc(100cqi / 7.6));
  font-weight: 700; line-height: 1.02; letter-spacing: -0.045em;
}
.v-type h1:lang(nl) { font-size: min(150px, calc(100cqi / 9.1)); }
.t-line { position: relative; display: grid; width: max-content; max-width: 100%; }
.t-line > .t-dirty, .t-line > .t-clean { grid-area: 1 / 1; }
.t-clean { white-space: nowrap; }
.t-dirty {
  align-self: center; white-space: pre;
  font: 400 .5em/1 var(--mono); letter-spacing: 0;
  color: #8E928A;
  text-decoration: underline wavy rgba(180, 35, 24, 0.55);
  text-decoration-thickness: 2px; text-underline-offset: .25em;
  visibility: hidden; /* no JS: show the clean headline only */
}
.t-brush {
  position: absolute; left: 0; top: 0; z-index: 1;
  border-radius: 999px; background: var(--green);
  transform-origin: center; will-change: transform;
  display: none; opacity: 0; transition: opacity .45s ease;
}
.v-type.is-live .t-dirty { visibility: visible; }
.v-type.is-live .t-brush { display: block; }
.v-type.is-moving .t-brush { opacity: 1; transition-duration: .12s; }
/* scroll-driven: JS gives the hero extra height and pins its content, so the
   first stretch of scrolling plays the headline instead of moving the page */
.hero.is-pinned { padding: 0; }
.hero.is-pinned > .wrap {
  position: sticky; top: var(--header-h);
  padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(48px, 7vw, 88px);
}

/* scroll hint above the headline: only while the headline is scroll-driven,
   gone as soon as scrolling starts */
.scroll-hint {
  display: none; align-items: center; gap: 10px; margin: 0 0 clamp(14px, 2vw, 24px);
  font: 400 13px/1 var(--mono); color: var(--muted);
  transition: opacity .3s ease, transform .3s ease;
}
.hero.is-pinned .scroll-hint { display: inline-flex; }
.hero.has-scrolled .scroll-hint { opacity: 0; transform: translateY(4px); }
.hint-wheel {
  position: relative; flex: none;
  width: 16px; height: 24px; border: 1.5px solid var(--ink); border-radius: 999px;
}
.hint-dot {
  position: absolute; left: 50%; top: 4px; width: 4px; height: 7px; margin-left: -2px;
  border-radius: 999px; background: var(--period);
  animation: hint 1.8s cubic-bezier(.5, 0, .3, 1) infinite;
}
@keyframes hint {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translateY(7px); opacity: 1; }
  100% { transform: translateY(9px); opacity: 0; }
}

/* =================================================================== data rows (shared) */
[data-scenario]:not([data-scenario="identity"]) [data-s="identity"],
[data-scenario]:not([data-scenario="campaign"]) [data-s="campaign"] { visibility: hidden; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  font: 500 14px/1 var(--sans); color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 15px; cursor: pointer;
}
.tab:hover { color: var(--ink); border-color: #C9CBC4; }
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.set-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; font: 400 12.5px/1.35 var(--mono); }
.model { font-weight: 500; }

.raw-line {
  display: grid; align-items: center; column-gap: 12px;
  height: 32px; border-top: 1px solid #262A2F;
  font: 400 12.5px/1 var(--mono);
  transition: opacity .4s;
}
.raw-identity .raw-line { grid-template-columns: 22px 3ch 12ch 9ch minmax(0, 1fr) 5ch; }
.raw-identity .raw-line .c:last-child { text-align: right; }
.raw-campaign .raw-line { grid-template-columns: 22px 10ch minmax(0, 31ch) minmax(0, 1fr); }
.c { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key { color: #C4C8C0; transition: color .4s; }

.badge {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: var(--ink);
  font: 600 11px/1 var(--mono);
}
.badge-none { background: transparent; }

.clean-set { font: 400 12.5px/1.35 var(--mono); }
.clean-set table { width: 100%; border-collapse: collapse; }
.clean-set th, .clean-set td { text-align: left; padding: 7px 10px 7px 0; border-top: 1px solid rgba(22, 24, 28, 0.14); vertical-align: top; }
.clean-set thead th { font-weight: 400; font-size: 12px; }
.clean-set .kv th { font-weight: 400; width: 15ch; }
.clean-set td.b { width: 30px; }
.clean-set .n { text-align: right; padding-right: 0; padding-left: 12px; white-space: nowrap; }
.clean-set .strong { font-weight: 600; }
.clean-set .sub { display: block; font-size: 11.5px; margin-top: 2px; }
.clean-set tfoot th, .clean-set tfoot td { border-top: 1.5px solid var(--ink); }
.clean-set tfoot th { font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { border: 1px solid rgba(22, 24, 28, 0.14); background: var(--paper); border-radius: 999px; padding: 2px 7px; font-size: 12px; }
.clean-line { transition: opacity .45s calc(var(--i) * 110ms); }

/* =================================================================== From raw to clean */
.section-lineage .wrap { max-width: 1320px; }
.lineage { margin-top: clamp(36px, 5vw, 56px); }
.lineage-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
html:not(.js) .lineage-head { display: none; }
.lineage-grid {
  position: relative; display: grid; align-items: stretch;
  grid-template-columns: minmax(0, 1fr) clamp(48px, 6vw, 96px) minmax(440px, .72fr);
}
.lineage-raw, .lineage-clean { display: grid; border-radius: 28px; padding: 16px 22px 18px; }
.lineage-raw > *, .lineage-clean > * { grid-area: 1 / 1; min-width: 0; }
.lineage-raw { grid-column: 1; container-type: inline-size; background: var(--ink); color: #8E928A; }
.lineage-raw .set-head { color: var(--on-ink-muted); }
.lineage-raw .model-meta { color: #6E726B; }
.lineage-raw .raw-line:first-child { border-top: 0; }
.lineage-clean { grid-column: 3; background: var(--green); align-content: start; }
.lineage-clean .model-meta, .lineage-clean thead th, .lineage-clean .kv th,
.lineage-clean tfoot th, .lineage-clean .sub { color: rgba(22, 24, 28, 0.62); }
.lineage-clean .badge { background: var(--ink); color: var(--green); }
.lineage-svg { position: absolute; inset: 0; pointer-events: none; }
.lineage-svg svg { position: absolute; inset: 0; overflow: visible; }
.lineage-svg path { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; }

/* drop the least important raw columns when the panel gets narrow */
@container (max-width: 560px) {
  .raw-campaign .raw-line { grid-template-columns: 22px 10ch minmax(0, 1fr); }
  .raw-campaign .raw-line .c:last-child { display: none; }
  .raw-identity .raw-line { grid-template-columns: 22px 3ch 12ch 9ch minmax(0, 1fr); }
  .raw-identity .raw-line .c:last-child { display: none; }
}
@container (max-width: 400px) {
  .raw-identity .raw-line { grid-template-columns: 20px 3ch 12ch minmax(0, 1fr); column-gap: 10px; }
  .raw-identity .raw-line .c:nth-child(4) { display: none; }
  .raw-campaign .raw-line { grid-template-columns: 20px 8ch minmax(0, 1fr); column-gap: 10px; }
}

/* stages: raw → link → clean (clean is the default, also without JS) */
.lineage[data-stage="raw"] .raw-line { animation: line-in .45s calc(var(--i) * 70ms) both; }
.lineage[data-stage="raw"] .lineage-raw .badge { transform: scale(0); }
.lineage:is([data-stage="link"], [data-stage="clean"]) .lineage-raw .badge { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1) calc(var(--i) * 140ms); }
.lineage:is([data-stage="link"], [data-stage="clean"]) .key { color: var(--green); transition-delay: calc(var(--i) * 140ms); }
.lineage:is([data-stage="link"], [data-stage="clean"]) .is-dropped { opacity: .3; }
.lineage:not([data-stage="clean"]) .clean-line { opacity: 0; transition: none; }
.lineage:not([data-stage="clean"]) .lineage-clean .badge { transform: scale(0); }
.lineage .lineage-clean .badge { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1) calc(var(--i) * 110ms); }

/* =================================================================== responsive */
@media (max-width: 900px) {
  .lineage-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lineage-raw, .lineage-clean { grid-column: 1; }
  .lineage-svg { display: none; }
}
@media (max-width: 640px) {
  .lineage-raw, .lineage-clean { padding: 14px 16px 16px; border-radius: 22px; }
  .clean-set { font-size: 11px; }
  .clean-set thead th { font-size: 11px; }
  .clean-set th, .clean-set td { padding-right: 6px; }
  .clean-set td.b { width: 24px; }
  .clean-set .kv th { width: auto; }
  .clean-set .n { padding-left: 6px; }
  .tab { font-size: 13px; padding: 8px 12px; }
}
@media (max-width: 420px) {
  /* very small phones: keep every column, scroll the table inside its panel */
  .lineage-clean .clean-set { overflow-x: auto; }
  .lineage-clean .clean-set table { min-width: 330px; }
}
@media (prefers-reduced-motion: reduce) {
  .lineage .raw-line, .lineage .clean-line { animation: none !important; transition: none !important; }
}
