/* One Thread (/thread): the scroll film. A 1100vh track holds a sticky,
   viewport-sized stage; thread.js maps scroll to beat 0..10 and draws. */

.thread-page { background: var(--color-paper); }
.tf-track { position: relative; height: 1100vh; }
.tf-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-paper);
  color: var(--color-ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

/* Minimal chrome */
.tf-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 max(16px, 6vw);
  pointer-events: none;
}
.tf-bar a { pointer-events: auto; }
.tf-bar__brand img { height: 26px; width: auto; }
.tf-bar__all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  color: var(--color-navy);
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-shadow: 0 0 2px var(--color-paper), 0 0 4px var(--color-paper), 0 0 7px var(--color-paper);
}
.tf-bar__all:hover { color: var(--color-gold-ink, #8A6D33); }

/* Figures: positioned every frame by thread.js */
.tf-figs { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.tf-figs img {
  position: absolute;
  left: 0; top: 0;
  height: 400px;
  width: auto;
  max-width: none;
  opacity: 0;
  will-change: transform, opacity;
}

/* Beats */
/* Stack: card 4, figures 6, thread 30, type 32, bead 34. The thread runs
   over the figures (into the hand) but behind type: a paper halo opens a
   gap round each glyph, and bubbles and buttons hide it behind their fill. */
.tf-layer {
  position: absolute;
  z-index: 32;
  text-shadow: 0 0 2px var(--color-paper), 0 0 4px var(--color-paper), 0 0 7px var(--color-paper), 0 0 10px var(--color-paper);
  left: 6vw;
  top: clamp(72px, 12vh, 140px);
  width: min(88vw, 40rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tf-layer--narrow { width: min(88vw, 30rem); }
.tf-layer--landing { inset: 0; left: 0; top: 0; width: auto; z-index: 32; opacity: 1; visibility: visible; }
.tf-h {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(29px, 3.68vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--color-ink);
  text-wrap: balance;
}

/* 00 Landing */
.tf-grid {
  position: absolute;
  inset: 0;
  padding: 76px 6vw 100px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  align-content: space-between;
  column-gap: 3vw;
  row-gap: 10px;
}
.tf-grid > div, .tf-grid > button {
  font-family: var(--font-heading);
  font-size: clamp(14px, 1.16vw, 18px);
  line-height: 1.22;
  max-width: 26ch;
  text-wrap: pretty;
}
.tf-grid .tf-grid__gap { grid-column: 1 / -1; height: clamp(150px, 30vh, 380px); max-width: none; }
.tf-grid--base { color: #E9E3D6; text-shadow: 0 1px 0 #FFFFFF; }
.tf-grid--lit { color: var(--color-ink); }
.tf-grid--lit button {
  pointer-events: auto;
  justify-self: start;
  padding: 0;
  text-align: left;
  color: inherit;
}
.tf-grid--lit button:focus-visible { outline-offset: 4px; }
.tf-h0 {
  position: absolute;
  left: 6vw; right: 6vw;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(51px, min(14.4vw, 13.6vh), 160px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}

/* 02 Deposit */
.tf-big {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(51px, min(15.2vw, 17.6vh), 160px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-weight: 400;
  padding-bottom: 0.14em; /* the numerals hang below a 0.9 line box; the thread underlines below them */
}

/* 03 Family group */
.tf-kicker {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: #8A6D33;
}
.tf-bubs { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: min(64vw, 26rem); }
.tf-bub {
  opacity: 0;
  text-shadow: none;
  background: #FFFFFF;
  border: 1px solid var(--color-rule);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.3;
  color: var(--color-ink);
  box-shadow: 0 1px 3px rgba(44, 62, 80, 0.09);
}
.tf-bub--in { margin-left: 18px; }
.tf-verdict {
  margin-top: 26px;
  font-family: var(--font-heading);
  font-size: clamp(29px, 3.68vw, 54px);
  line-height: 1.05;
  color: var(--color-ink);
}
.tf-verdict [data-bub] { opacity: 0; }
.tf-law { position: relative; display: inline-block; margin-top: 0.62em; }
.tf-caret {
  position: absolute;
  left: 0.1em;
  bottom: 96%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
  font-style: italic;
  font-size: 0.72em;
  color: #8A6D33;
}
.tf-caret svg { margin-bottom: -0.32em; flex: none; display: inline; }
.tf-law__word { position: relative; }
.tf-strike {
  position: absolute;
  left: -3%; right: -3%;
  top: 52%;
  height: 4px;
  background: var(--color-navy);
  transform: scaleX(0);
  transform-origin: left center;
}

/* 04 Typed */
.tf-chat { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 20px; }
.tf-msg {
  text-shadow: none;
  opacity: 0;
  background: var(--color-navy);
  color: var(--color-paper);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.3;
  min-height: 1.3em;
}
.tf-msg--long { max-width: 82%; }

/* 08 Price */
.tf-price {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 14px;
  font-family: var(--font-display);
  color: var(--color-ink);
}
.tf-price__ours { font-size: clamp(35px, 7.2vw, 77px); font-weight: 700; color: #8A6D33; line-height: 1; }
.tf-price__vs { font-family: var(--font-heading); font-size: clamp(22px, 2.72vw, 35px); }
.tf-price__theirs { font-size: clamp(45px, 11.2vw, 120px); font-weight: 800; letter-spacing: -0.02em; line-height: 1; }

/* 09 Where he stood */
.tf-motto {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(13px, 1.12vw, 15px);
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--color-navy);
}

/* 10 What happened (close) */
.tf-h10 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(48px, min(12.8vw, 12vh), 144px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}
.tf-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.tf-btn {
  text-shadow: none;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.tf-btn:hover { opacity: 0.85; }
.tf-btn:active { transform: scale(0.98); }
.tf-btn--navy { background: var(--color-navy); color: var(--color-paper); box-shadow: 0 1px 3px rgba(44, 62, 80, 0.09); }
.tf-btn--navy:hover { color: var(--color-paper); }
.tf-btn--gold { background: var(--color-gold); color: var(--color-ink); }
.tf-btn--gold:hover { color: var(--color-ink); }
.tf-btn--line { background: transparent; color: var(--color-navy); border-color: var(--color-navy); }

/* 05-07 Product card: clip, clip, memo with lens */
.tf-card {
  position: absolute;
  z-index: 4;
  left: 0; top: 0;
  width: 10px; height: 10px;
  opacity: 0;
  visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  box-shadow: 0 16px 48px rgba(44, 62, 80, 0.2);
  pointer-events: none;
}
.tf-cv { position: absolute; inset: 0; overflow: hidden; }
.tf-cv[data-cv="1"], .tf-cv[data-cv="2"] { opacity: 0; }
.tf-zoom { position: absolute; inset: 0; }
.tf-card video, .tf-cv > img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.tf-lens {
  position: absolute;
  left: 0; top: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-paper);
  box-shadow: 0 0 0 3px #8A6D33, 0 8px 32px rgba(44, 62, 80, 0.16);
}
.tf-lens img { position: absolute; left: 0; top: 0; max-width: none; display: block; }

/* Chosen-problem overlay. It sits under the thread (its own path) and so
   under the type layers too: hide those while it is open. */
body:has([data-overlay]:not([hidden])) .tf-layer { visibility: hidden !important; }
/* Chosen-problem overlay */
.tf-overlay { position: fixed; inset: 0; z-index: 20; background: var(--color-paper); }
.tf-overlay__fig { position: absolute; bottom: 2vh; right: 4vw; height: max(50vh, min(84vh, 50vw)); width: auto; max-width: none; }
.tf-overlay__body { position: absolute; left: 6vw; top: clamp(72px, 12vh, 140px); width: min(88vw, 38rem); }
.tf-overlay__text {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(26px, 3.52vw, 48px);
  line-height: 1.08;
  color: var(--color-ink);
  text-wrap: balance;
}

/* The thread and its bead */
.tf-thread { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; overflow: visible; max-width: none; }
.tf-bead {
  position: absolute;
  z-index: 34;
  left: 0; top: 0;
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}
.tf-bead span {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #8A6D33;
  box-shadow: 0 0 0 4px #E6D4A2, 0 4px 14px rgba(44, 62, 80, 0.12);
}
.tf-bead:focus-visible { outline: 2px solid var(--color-navy); border-radius: 50%; }

.thread-page .site-footer { position: relative; z-index: 1; }
