/* ============================================================ THE CREAM PANEL
   The 12 m band on the ingredients page carries no photograph. It is flat
   cream at the founder's direction, and the amber liquid in the dropper is
   the only colour in it.

   Two structural consequences of having no plate. The panel needs an opaque
   background of its own, because body carries the depth ladder as one
   continuous gradient and without a plate that gradient would show through.
   And it drops the overlap on both of its joins, since the negative margin
   exists to let two photographs mix through a seam, and there is nothing
   here to mix. The result is a clean horizontal edge top and bottom.

   NOTE FOR THE BRAND GUIDELINES. The colour section of the guidelines rules
   cream out by name and calls anything warm a drift toward the rejected
   direction. This panel is a deliberate exception granted by the founder,
   scoped to one section, and the two documents disagree until somebody
   settles it. Do not spread --td-cream to other sections on the strength of
   this rule alone. */
/* Declared at the root, not on .td-dose. They lived inside .td-dose first,
   which is a descendant of the panel, so the panel itself could not resolve
   them and rendered transparent over the depth ladder. */
:root {
  --td-cream:      #F5EFE2;
  --td-cream-line: rgba(58, 38, 12, .18);
}

/* IT IS A PLATE, NOT A RECTANGLE. The first version painted cream straight
   onto the section and killed the overlap on both joins, which left two hard
   horizontal cuts where every other boundary on the site dissolves. The panel
   keeps its overlap now and carries the cream on a masked layer instead, so
   the surface photograph above fades out across the same band that the cream
   fades in across, and the register photograph below fades in over it. Same
   seam mask as the photographic plates, so the two ramps sum to full cover
   and no body gradient shows through the middle of the join. */
.td-depth--cream { background: none; }
.td-depth--cream::before {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background-color: var(--td-cream);
  pointer-events: none;
  /* It only needs to fade at the TOP. The surface panel sits before this one
     in the document, so the cream paints over it and has to dissolve in. The
     register panel sits after, so IT paints over the cream and dissolves in
     by itself. Fading the cream out at the bottom as well left two ramps
     thinning at once and a visible edge where they crossed, so the plate is
     solid all the way down and the photograph below simply arrives on top of
     it. 7.1% is measured off seam-mask.png, whose own top ramp reaches full
     alpha at y=170 of 2400. A fixed pixel ramp was tried first and cut the
     top seam instead: the photograph's fade is a fraction of ITS height and
     runs far longer than one overlap, so the cream went opaque while the
     photograph was still showing and clipped it. Match the fraction, not the
     distance. */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 7.1%, #000 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 7.1%, #000 100%);
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

/* the depth mark and every instrument in this panel run navy on cream */
.td-depth--cream .td-mark { color: var(--st-on-light); opacity: .38; }
/* Only this panel moves its mark below the join. Every panel rides up into
   the one above by --td-overlap, so a mark 44px from its own top sits inside
   the band where two plates dissolve. On water-over-water that reads as part
   of the instrument; against flat cream it read as a ruled boundary.

   This was briefly applied to .td-mark globally, which pushed every mark on
   every page down by an overlap and dropped them straight onto the depth
   gauge's own readout in the right margin. The gauge is fixed at the vertical
   centre, so 220px down is exactly where it lives. Scoped, not global. */
.td-depth--cream .td-mark { top: calc(var(--td-overlap) + clamp(20px, 3.5vw, 44px)); }
.td-depth--cream .td-h2,
.td-depth--cream .td-body,
.td-depth--cream .td-ledger__h,
.td-depth--cream .td-dose__cap,
.td-depth--cream .td-uncounted__h,
.td-depth--cream .td-dose__n,
.td-depth--cream .td-dose__l,
.td-depth--cream .td-dose__tick,
.td-depth--cream .td-uncounted__list li { color: var(--st-on-light); }
.td-depth--cream .td-dose__cap,
.td-depth--cream .td-inside__status { color: var(--st-on-light-mute); }

/* hairlines pick up the warm ground rather than the cool one */
.td-depth--cream .td-dose__grp,
.td-depth--cream .td-dose .td-uncounted__list li,
.td-depth--cream .td-ledger__h { border-color: var(--td-cream-line); }
.td-depth--cream .td-dose__tick::before { background: var(--td-cream-line); }
.td-depth--cream .td-dose .td-uncounted__list li::before {
  box-shadow: inset 0 0 0 1px rgba(58, 38, 12, .42);
}

/* The theme bar carried a white wash because it sat on a photograph and
   needed its own substrate. On flat cream there is nothing to lift off, so
   it becomes what it actually is: an outlined control on the page ground. */

/* the marked state runs amber here, so the ledger and the liquid agree */
.td-depth--cream .td-row.is-marked .td-row__mark,
.td-depth--cream .td-dose .td-uncounted__list li.is-marked::before {
  background: var(--td-sw3);
  box-shadow: inset 0 0 0 1px var(--td-sw3);
}
.td-depth--cream .td-dose__tick.is-lit { color: var(--td-sw6); }
.td-depth--cream .td-dose__tick.is-lit::before { background: var(--td-sw6); }
.td-depth--cream .td-dose__leader {
  background: linear-gradient(180deg, var(--td-sw4) 0%, transparent 100%);
}

/* a tight, light shadow: most of the tube is clear glass now (the dose is
   only the tip third), and the deep shadow tuned for a solid black dropper
   read as a dark band under glass that should be see-through */
.td-depth--cream .td-dose__photo {
  filter: drop-shadow(0 8px 14px rgba(58, 38, 12, .14));
}

/* ---- the cream panel's LOWER join ----
   The upper join works because the cream plate is stationary and the panel
   above it dissolves into it on the shared seam mask. The lower join does not
   get that for free. app.js drifts each photographic plate by up to 4% of its
   section height for the parallax, and a plate carries its mask with it, so
   the 7.1% ramp slides relative to the boundary as you scroll. On a 1182px
   panel that is 47px of travel against an 84px ramp, which at some scroll
   positions leaves the water arriving at very nearly full strength directly
   against the cream.

   Fading the cream out at the bottom to compensate was tried and is worse: two
   ramps thinning at once leave a visible seam where they cross. So the join
   gets a fade that cannot move. This wash belongs to the panel BELOW, runs one
   overlap deep from its own top, and sits above the photograph and its scrim
   but under the copy. Wherever the plate happens to have drifted to, the
   arrival is the same. */
.td-depth--cream + .td-depth::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--td-overlap);
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg,
    var(--td-cream) 0%,
    color-mix(in srgb, var(--td-cream) 72%, transparent) 34%,
    color-mix(in srgb, var(--td-cream) 28%, transparent) 68%,
    color-mix(in srgb, var(--td-cream) 0%,  transparent) 100%);
}

/* ============================================================ STORY & BENEFITS
   Two pages were added after the first three: story.html and benefits.html.
   Neither gets its own stylesheet, because neither needed one — between them
   they add three components and four modifiers, and everything else on both
   pages is a class that was already here.

   The rule followed throughout: a component that could plausibly appear on a
   deep panel AND a daylight one is written light-first and gets a modifier
   for the dark case, matching how .td-h2/.td-h2--dark already work.
   ============================================================ */

/* ---- the descent, extended and taught daylight ------------------------
   .td-descent was written for the 700 m panel of the homepage, where three
   steps walk further down and further in. story.html runs FOUR steps and runs
   them at 200 m, which holds daylight the whole way (see the note above
   .td-depth__scrim--column). So the ladder needs a fourth rung, and it needs
   a version whose type is ink rather than white. */
.td-descent__step:nth-child(4) { margin-left: clamp(0px, 18vw, 288px); }

/* the homepage descent labels are one or two words ("The sea", "The bottle"),
   so a 16ch track holds them on one line. These four are the four named stages
   the brand has always called them by, which are longer, and at 16ch they broke
   three deep against a three-line paragraph. The track is widened rather than
   the names shortened: the stage names are the client's, the track is ours. */
.td-descent--light .td-descent__step {
  grid-template-columns: minmax(0, 24ch) minmax(0, 1fr);
  border-top-color: var(--td-line-light);
}
.td-descent--light .td-descent__h { color: var(--st-on-light); }
.td-descent--light .td-descent__p { color: var(--st-on-light); }

/* ---- the figure stack, on deep water and in two columns ---------------
   .td-stack is the number run off the side panel of the box. It was ink on
   daylight only. story.html reads the six counted nutrient groups at 700 m,
   which needs both a dark variant and a second column, since six of these
   figures in one column is a screen and a half of scrolling.

   --split is layout, --dark is colour, and they are independent on purpose:
   either can be used without the other. */
.td-stack--split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(32px, 5vw, 80px);
  border-top: 0;
}
.td-stack--split .td-stack__row {
  border-top: 1px solid var(--td-line-light);
  border-bottom: 0;
}
/* two columns halve the width each figure has, so the display size comes down
   with it rather than wrapping the label onto a second line */
.td-stack--split .td-stack__fig { font-size: clamp(1.9rem, 3.2vw, 2.9rem); }

.td-stack--dark { border-top-color: var(--td-line-dim); }
.td-stack--dark .td-stack__row {
  border-top-color: var(--td-line-dim);
  border-bottom-color: var(--td-line-dim);
}
/* WHITE, NOT THE BODY TINT, at 700 m — same reasoning as the block above
   .td-depth--midnight .td-body--dark. The tint has no contrast margin left
   once the panel has gone this dark. */
.td-stack--dark .td-stack__fig,
.td-stack--dark .td-stack__lab { color: var(--st-on-dark); }

.td-mid__note { margin-top: clamp(28px, 3.2vw, 44px); }

/* ---- the founder — story.html, 60 m -----------------------------------
   The one band the live site does not have. Portrait one side, the person
   the other.

   TEXT HERE IS INK, NEVER THE ACCENT. The canopy panel is a mid-tone
   photograph: deep cyan measures 3.99:1 against it and coral 4.00:1, so on
   this panel the accent is allowed on graphics — the emblem, the squiggle,
   the quote rule, all of which answer to 3:1 — and every run of type is full
   ink. This is the same rule .td-depth--canopy already enforces on the SKUs. */

/* the portrait does not exist yet. Same convention as the Joint + Muscle
   media well on the homepage: state the absence rather than ship a stand-in
   that reads as a real photograph of a real person. */

/* The name is the first thing in this column and carries its own weight. It
   had a "THE FOUNDER" label over it for a while; no other page in this build
   sets a label above a heading, and the heading did not need one. */

/* Archivo, not the mono. The mono on this site is the instrument face and it
   is spent on things that are measured — depth readouts, counts, prices,
   binomials. A person's title is none of those, and setting it in mono was
   borrowing the instrument's authority for a line that has not earned it. */

/* ---- the benefit register — benefits.html -----------------------------
   A benefit is a name and a sentence, which is one field more than .td-row
   carries and a sentence longer than .td-row__common is set for (that one is
   a right-aligned uppercase tag). So benefits get their own row rather than
   an abused ledger row.

   The five group headings reuse .td-ledger__h, which is the same instrument
   label the ingredients register uses — deliberately, because these are the
   same five themes every ingredient over there is tagged with. */
.td-bgroup { margin-top: clamp(48px, 6vw, 88px); }

/* .td-ledger__h carries --td-line-dark, the hairline for type sitting ON a
   deep panel. This register is on daylight, where that rule is invisible.
   Scoped to .td-bgroup so the ingredients page is left exactly as it was. */
.td-bgroup .td-ledger__h { border-bottom-color: var(--td-line-light); }

.td-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(36px, 5vw, 80px);
  margin-top: clamp(20px, 2.4vw, 32px);
}
.td-benefit {
  padding-block: clamp(18px, 2.2vw, 28px);
  border-top: 1px solid var(--td-line-light);
}
.td-benefit__h {
  font-family: var(--st-font-ui);
  font-weight: var(--st-fw-med);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.2;
  letter-spacing: -.018em;
  color: var(--st-on-light);
}
.td-benefit__p {
  margin-top: var(--st-3);
  font-size: var(--st-size-body);
  line-height: 1.62;
  color: var(--st-on-light);
  max-width: 46ch;
}

/* the Joint + Muscle register sits at 700 m, so the same component in white */
.td-benefits--dark { margin-top: clamp(48px, 6vw, 88px); }
.td-benefits--dark .td-benefit { border-top-color: var(--td-line-dim); }
.td-benefits--dark .td-benefit__h { color: var(--st-on-dark); }
.td-benefits--dark .td-benefit__p { color: var(--st-on-dark-body); }

/* the closing note under the register, on daylight rather than deep water.
   In ingredients.html .td-inside__foot is nested inside .td-inside; here it
   is a direct child of .td-column, so this cannot reach that page. */
.td-depth--ledger .td-column > .td-inside__foot {
  border-top-color: var(--td-line-light);
}

/* ---- the register bands' tail ----------------------------------------
   Both register bands carry ink to the bottom of a photographic panel whose
   veil is thinning as it goes. On ingredients.html the equivalent band ends
   at 73% of its own height and never enters the zone where the wash has taken
   over; measured off the render, ink is still 5.3:1 at 79% and has fallen to
   3.7:1 by 87%.

   So the last entry is pushed clear of it. This is tail padding, not a gap in
   the design: the band still ends where the ladder says it ends, the type just
   stops before the water does. */
.td-depth--regband { padding-bottom: clamp(200px, 24vw, 440px); }

@media (max-width: 940px) {
  /* the fourth rung folds back with the second and third */
  .td-descent__step:nth-child(4) { margin-left: 0; }
  /* and the widened label track folds with them. The base rule that collapses
     .td-descent__step to one column is (0,1,0); the --light override above is
     (0,2,0) and later, so it wins inside this media query unless it is undone
     here by name. Without this the label kept a 220px track on a 390px screen
     and left the paragraph 118px wide. */
  .td-descent--light .td-descent__step { grid-template-columns: minmax(0, 1fr); }

}

@media (max-width: 760px) {
  /* both two-column registers go to one. At this width the second column is
     narrower than the 46ch the copy is set to and every entry wraps badly. */
  .td-benefits { grid-template-columns: minmax(0, 1fr); }
  .td-stack--split { grid-template-columns: minmax(0, 1fr); }
  .td-stack--split .td-stack__fig { font-size: clamp(2.4rem, 5vw, 3.9rem); }
}

