/* ==========================================================================
   SONDER THRESHOLDS · the boundaries between the light and the dark worlds
   ?threshold=original (default: the existing hard boundaries) | soft (static organic boundaries)
            | living (the same, with a barely perceptible scroll-linked change)
   html[data-threshold] is set before first paint by the homepage head script. Without JavaScript the
   attribute is never set, so the page shows the original boundaries. The hero → Approach boundary is
   untouched in every mode.

   One small family, two members:
   · Light → Dark (Approach → Services): the existing Dissolving Canvas form (styles/bridge.css), reused,
     not duplicated: soft and living switch html[data-bridge] to "organic". A near-black field rises
     highest on the left beneath the watercolor; the Living Tide comes up through it gradually.
     soft  = that form, static;  living = its existing scroll-driven growth (CSS, no script).
   · Dark → Light (How the work moves → About): the About canvas itself (its paper or its artwork,
     whichever About is shown) continues a little way under the dark section, and the dark section's
     lower edge becomes one broad curve: dark lowest on the left, light rising highest on the right,
     the mirror partner of the Approach → Services form. No ivory is painted: the light is the About
     section's own background, so there is no colour seam.
       Geometry: the curve sits in a band straddling the old boundary (U above it, D below it), inside
       the two sections' existing paddings (149 + 149 px at 1440; 80 + 80 px on phones), so no space is
       added: the dark section extends D into About (margin-bottom −D, padding-bottom +D) and About
       extends U under it (margin-top −U, padding-top +U). Every piece of content stays exactly where
       it was. The dark section is drawn above (z-index 1) and masked by the curve.
   Nothing here touches the Living Tide, the Ripple Effect, the About studies or any token.
   ========================================================================== */

/* the curves (white = the dark section shows; transparent = the About canvas shows through) */
html {
  --th-curve-wide: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%201600%20220%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%272.5%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-40%20-30%20L-40%20200%20C90%20206%20170%20210%20260%20206%20C470%20196%20620%20160%20780%20120%20C960%2075%201120%2026%201300%2018%20C1420%2013%201530%2022%201640%2034%20L1640%20-30%20Z%27/%3E%3C/svg%3E");
  --th-curve-phone: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20400%20110%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%271.2%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-20%20-20%20L-20%2092%20C70%2096%20150%2092%20220%2070%20C290%2048%20340%2022%20420%2016%20L420%20-20%20Z%27/%3E%3C/svg%3E");
}

@property --th-k { syntax: "<number>"; inherits: true; initial-value: 1; }

html:is([data-threshold="soft"], [data-threshold="soft-v1"], [data-threshold="living"]) {
  /* band height follows the width (the curve keeps its proportions), capped so it always stays inside the
     paddings; the curve's boundary line sits at 125/220 of the band (U above, D below) */
  --th-band: min(13.75vw, 17rem);
  --th-up:   calc(var(--th-band) * var(--th-uf, 125 / 220));
  --th-down: calc(var(--th-band) * var(--th-df, 95 / 220));
  --th-curve: var(--th-curve-wide);
  --th-k: 1;

  & #method {
    z-index: 1;
    padding-bottom: calc(var(--section-pad) + var(--th-down));
    /* layer 1: everything above the band, opaque. layer 2: the curve, scaled by --th-k about the old
       boundary line (1 = full; only the living mode changes it). Below the curve: transparent. */
    -webkit-mask:
      linear-gradient(#000, #000) top / 100% calc(100% - var(--th-down) - var(--th-up) * var(--th-k) + 1px) no-repeat,
      var(--th-curve) left bottom calc(var(--th-down) * (1 - var(--th-k))) / 100% calc(var(--th-band) * var(--th-k)) no-repeat;
            mask:
      linear-gradient(#000, #000) top / 100% calc(100% - var(--th-down) - var(--th-up) * var(--th-k) + 1px) no-repeat,
      var(--th-curve) left bottom calc(var(--th-down) * (1 - var(--th-k))) / 100% calc(var(--th-band) * var(--th-k)) no-repeat;
  }
  & #about {
    /* one negative margin (adjacent block margins collapse, so it carries both offsets): About begins U above the
       old boundary, under the dark section, which now ends D below it */
    margin-top: calc(-1 * (var(--th-up) + var(--th-down)));
    padding-top: calc(var(--section-pad) + var(--th-up));
    scroll-margin-top: calc(-1 * var(--th-up));   /* the About link still lands on the same content */
  }
}
@media (max-width: 699.98px) {
  html:is([data-threshold="soft"], [data-threshold="soft-v1"], [data-threshold="living"]) {
    --th-band: min(27.5vw, 110px);
    --th-uf: 60 / 110; --th-df: 50 / 110;
    --th-curve: var(--th-curve-phone);
  }
}

/* soft-v1 (the previous soft): the Approach → Services form holds still (the Dissolving Canvas otherwise grows with the scroll) */
html[data-threshold="soft-v1"] .bridge { animation: none !important; transform: none !important; }

/* living: as the boundary rises from the bottom of the screen to its middle, the light field grows from
   60 % to its full reach (and back when scrolling up). Tied to the scroll position; nothing loops. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    html[data-threshold="living"] #method {
      animation: th-emerge linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 55%;
    }
  }
}
@keyframes th-emerge {
  from { --th-k: 0.6; }
  to   { --th-k: 1; }
}

/* The tab studies' artwork (styles/about-tabs.css) used to be cut by About's top edge. Now that the About canvas
   continues up under the dark section, its top edge would show as a straight line in the light. It fades in
   instead, from transparent at its own top to full strength exactly at the old boundary, so everything that was
   visible before is unchanged; only the part that used to be hidden is softened. (The distance from the artwork's
   top to the old boundary is 32cqw − 12.5rem − the section padding, from the placement in about-tabs.css.) */
@media (min-width: 900px) {
  html:is([data-threshold="soft"], [data-threshold="soft-v1"], [data-threshold="living"])[data-ab-layout="tabs"] .ab__bg {
    --th-art-fade: max(1px, calc(32cqw - 12.5rem - var(--section-pad)));
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, #000 0, #000 84%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 var(--th-art-fade));
            mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, #000 0, #000 84%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 var(--th-art-fade));
    -webkit-mask-composite: source-in, source-in;
            mask-composite: intersect, intersect;
  }
}


/* ==========================================================================
   SOFT (refined 2026-11-23, the default)
   ========================================================================== */
html {
  --wb-curve-wide: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%201600%20200%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%273.2%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-40%20-20%20L-40%20168%20C110%20180%20300%20194%20480%20188%20C650%20182%20770%20140%20920%20126%20C1050%20114%201130%20134%201250%20126%20C1390%20116%201490%2078%201640%2064%20L1640%20-20%20Z%27/%3E%3C/svg%3E");
  --wb-curve-phone: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20400%20100%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%271.4%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-20%20-20%20L-20%2084%20C60%2090%20140%2092%20210%2080%20C270%2070%20300%2058%20340%2054%20C370%2051%20395%2050%20420%2046%20L420%20-20%20Z%27/%3E%3C/svg%3E");
  --th2-curve-wide: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%201600%20100%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%271.6%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-40%20-20%20L-40%2072%20C140%2076%20300%2082%20520%2076%20C760%2069%20980%2046%201200%2032%20C1360%2022%201500%2024%201640%2028%20L1640%20-20%20Z%27/%3E%3C/svg%3E");
  --th2-curve-phone: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20400%20100%27%20preserveAspectRatio=%27none%27%3E%3Cdefs%3E%3Cfilter%20id=%27f%27%20x=%27-5%25%27%20y=%27-20%25%27%20width=%27110%25%27%20height=%27140%25%27%3E%3CfeGaussianBlur%20stdDeviation=%271.0%27/%3E%3C/filter%3E%3C/defs%3E%3Cpath%20fill=%27white%27%20filter=%27url%28%23f%29%27%20d=%27M-20%20-20%20L-20%2070%20C100%2074%20220%2062%20300%2046%20C350%2037%20390%2034%20420%2033%20L420%20-20%20Z%27/%3E%3C/svg%3E");
}

/* ---------- How the work moves → About: the same idea, much shallower ----------------------------------
   A mostly horizontal edge with one gentle rise to the right: 66–100 px band on desktop (36–54 px of vertical
   variation), 40–60 px on phones (20–25 px). The boundary line sits at 55 % of the band. */
html[data-threshold="soft"] {
  --th-band: clamp(66px, 5.4vw, 100px);
  --th-uf: 0.55; --th-df: 0.45;
  --th-curve: var(--th2-curve-wide);
}
@media (max-width: 699.98px) {
  html[data-threshold="soft"] { --th-band: clamp(40px, 15vw, 60px); --th-uf: 0.55; --th-df: 0.45; --th-curve: var(--th2-curve-phone); }
}

/* ---------- Approach → Services: the watercolor bleeds into the dark ---------------------------------------
   Services begins a little earlier, underneath the watercolor (margin-top −H, padding-top +H: none of its
   content moves), and the Living Tide layer begins at that new top (its own margins are offset by H, so
   nothing after it moves and its sticky behaviour is the same). The watercolor canvas is drawn above it
   (z-index 2) and its lower band is masked by one broad curve. Wherever the watercolor ends, the moving tide
   (or, on phones and without video, the same near-black) is already there: there is no dark shape, no veil and
   no straight video edge, because the video's top edge always lies under the watercolor.
   The canvas's size, its artwork and its cover sizing are unchanged; only its lowest band is revealed.
   Band H: 9vw up to 9rem on desktop: fullest on the left, one long swell that eases up through the middle, a soft
   shoulder, then a last rise to the right (about 85 px of travel at 1440, over the whole width);
   min(12vw, 48px) on phones (one shallow line, about 30 px of rise). */
html[data-threshold="soft"] {
  --wb-h: min(9vw, 9rem);
  --wb-curve: var(--wb-curve-wide);

  & .ap-canvas {
    z-index: 2;
    -webkit-mask:
      linear-gradient(#000, #000) top / 100% calc(100% - var(--wb-h) + 1px) no-repeat,
      var(--wb-curve) left bottom / 100% var(--wb-h) no-repeat;
            mask:
      linear-gradient(#000, #000) top / 100% calc(100% - var(--wb-h) + 1px) no-repeat,
      var(--wb-curve) left bottom / 100% var(--wb-h) no-repeat;
  }
  & .svp {
    margin-top: calc(-1 * var(--wb-h));
    padding-top: var(--wb-h);
    scroll-margin-top: calc(-1 * var(--wb-h));     /* the Services link still lands on the same content */
  }
}
@media (min-width: 900px) {
  html[data-threshold="soft"]:is([data-services="tide"], [data-services="tide-dark"]) .svp-tide {
    margin-top: calc(-1 * var(--wb-h));                       /* starts at the section's new top, under the watercolor */
    margin-bottom: calc(-100svh + var(--wb-h));               /* …and still takes no room in the flow */
  }
}
@media (max-width: 699.98px) {
  html[data-threshold="soft"] { --wb-h: min(12vw, 48px); --wb-curve: var(--wb-curve-phone); }
}
