/* ==========================================================================
   APPROACH · WATERCOLOR BACKGROUND  (html[data-thread="wc"], the default)
   --------------------------------------------------------------------------
   The original watercolor artwork is the one background of the philosophies
   and the three forms. It is static: no motion, no parallax.

   .ap-canvas wraps both sections; it carries the artwork and the sections
   become transparent over it. The artwork comes in positioned variants made
   by tools/build_watercolor.py from the untouched source PNG: each keeps the
   artwork's three bands of colour (top washes, middle waves, lower washes)
   where they belong on that layout, adjusting only the plain paper between
   them, so nothing is stretched. 'cover' then trims at most a few percent.

   .phil__veil sits in the illustration's own grid cell with its exact size:
   the calibrated ivory (--phil-ivory) behind the media, fading softly into
   the paper, so the rectangle of the video and stills can never show.
   The content sets the height; the artwork never does.
   ========================================================================== */

.phil__veil { display: none; }

html[data-thread="wc"] {
  --wc-paper: #FDEDDC;     /* the artwork's paper, sampled */

  & .ap-canvas {
    position: relative;
    overflow: clip;                                   /* the veil's soft edge never widens the page */
    isolation: isolate;                               /* the veil sits just above the artwork, under all content */
    background-color: var(--wc-paper);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 50% 50%;
    background-image: image-set(url("../assets/art/watercolor/wc-phone-480.webp") 1x, url("../assets/art/watercolor/wc-phone-800.webp") 2x);
  }
  & .ap-canvas > .phil,
  & .ap-canvas > .offers[data-mode="living"] { background: transparent; }

  /* superseded by the artwork: the pale fields and the small scattered accents */
  & :is(.th-stage, .th-corner, .th-narrow) { display: none !important; }
  & .offers[data-mode="living"] .lv-accent { display: none; }

  /* media-safe area: same grid cell and sizing rules as .phil__art (styles/approach.css).
     The veil box itself is transparent; its ::before is an oval of the calibrated ivory twice
     the illustration's size. Solid ivory reaches past the illustration's corners (an ellipse
     through the corners has semi-axes of w/√2 and h/√2, i.e. 71 % of this oval), then fades
     to nothing at its edge, so the light behind the illustration has no corners at all. */
  & .phil__veil {
    display: block;
    grid-area: art;
    position: relative;
    width: 100%;
    max-width: calc((100svh - var(--header-h) - 3rem) * 4 / 3);
    justify-self: end;
    aspect-ratio: 4 / 3;
    z-index: -1;
    pointer-events: none;
  }
  & .phil__veil::before {
    content: "";
    position: absolute;
    inset: -50%;
    background: radial-gradient(closest-side,
      var(--phil-ivory) 0%, var(--phil-ivory) 73%,
      rgb(255 244 238 / 0.82) 80%, rgb(255 244 238 / 0.5) 87%,
      rgb(255 244 238 / 0.2) 93.5%, rgb(255 244 238 / 0) 100%);
  }
  & .phil__art { z-index: 1; }
}

@media (min-width: 700px) {
  html[data-thread="wc"] .ap-canvas { background-image: image-set(url("../assets/art/watercolor/wc-tabs-900.webp") 1x, url("../assets/art/watercolor/wc-tabs-1500.webp") 2x); }
}
@media (min-width: 861px) {
  html[data-thread="wc"] .ap-canvas { background-image: image-set(url("../assets/art/watercolor/wc-tab-1200.webp") 1x, url("../assets/art/watercolor/wc-tab-1800.webp") 2x); }
}
@media (min-width: 1180px) {
  /* narrow desktops are a little taller than the variant: trim the right side (behind the
     illustration's light), never the label's side */
  html[data-thread="wc"] .ap-canvas { background-position: 0% 50%; }
  html[data-thread="wc"] .ap-canvas { background-image: image-set(url("../assets/art/watercolor/wc-desk-1600.webp") 1x, url("../assets/art/watercolor/wc-desk-2400.webp") 2x); }
}
@media (min-width: 1600px) {
  html[data-thread="wc"] .ap-canvas { background-position: 50% 50%; }
  html[data-thread="wc"] .ap-canvas { background-image: image-set(url("../assets/art/watercolor/wc-desk2-2000.webp") 1x, url("../assets/art/watercolor/wc-desk2-3000.webp") 2x); }
}
@media (min-width: 2200px) {
  html[data-thread="wc"] .ap-canvas { background-image: image-set(url("../assets/art/watercolor/wc-wide-2400.webp") 1x, url("../assets/art/watercolor/wc-wide-3200.webp") 2x); }
}

/* stacked layouts: the illustration bleeds to the screen edges, so the veil does too,
   with a shorter fade above and below */
@media (max-width: 860px) {
  html[data-thread="wc"] .phil__veil {
    max-width: none;
    justify-self: stretch;
    width: calc(100% + 2 * var(--gutter));
    margin-inline: calc(-1 * var(--gutter));
  }
  /* full-width illustration: a band of ivory, solid across the media, fading above and below */
  html[data-thread="wc"] .phil__veil::before {
    inset: -18% 0;
    background: linear-gradient(to bottom, rgb(255 244 238 / 0), rgb(255 244 238 / 0.6) 6%, var(--phil-ivory) 15.3%,
      var(--phil-ivory) 84.7%, rgb(255 244 238 / 0.6) 94%, rgb(255 244 238 / 0));
  }
}
