/* TESORIN's glass art (glass-art.js): the 3D graphics in clear glass, a
   chapter's head with its graphic dropping in beside its name, and the glass
   marble that comes with each. These are the Features page's rules
   (features.css, where they began), moved here when that page was merged
   into the home page on 19 Nov 2026. */

/* --------------------------------------------------------------------------
   A chapter's head: its name in the serif, large, and its graphic at the
   right, dropping in from above. There is no rule along its top (the user,
   19 Nov 2026: "remove this thin border that comes first"): the graphic
   comes down out of the page itself, through a soft edge (below).
   -------------------------------------------------------------------------- */
.features-group__head {
  --head-fade: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: clamp(24px, 4vw, 64px);
  margin-bottom: clamp(44px, 6vw, 88px);
  /* Room above for the soft edge, clear of where the graphic comes to
     rest; and room under the name for the tails of its letters, which the
     head's clipping cut off ("why this texts are cutting out": the p and
     g of "planning."). */
  padding-top: var(--head-fade);
  padding-bottom: clamp(12px, 1.4vw, 20px);
}

.features-group__title {
  min-width: 0;
}


.features-group__head h2 {
  max-width: 14ch;
  margin: 0;
  font-family: var(--font-serif, var(--serif));
  font-size: clamp(40px, 6.4vw, 92px);
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.028em;
  color: var(--ink);
}

.features-group__sketch {
  width: auto;
  height: clamp(88px, 10vw, 144px);
  max-width: min(32vw, 220px);
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Each section's 3D graphic, dropping in as you scroll to it, drawn by
   glass-art.js on the canvas over its standing still: budgeting's board
   stands up (assets/graphics/budget-rise/), and tracking's, planning's and
   simplifying's lie with a loop playing over them (tracking.webm and the
   rest, with their -rise/ stills). */
.features-group__sketch--graphic {
  height: clamp(220px, 30vw, 440px);
  max-width: min(54vw, 520px);
  background: transparent;
}

.features-rise {
  position: relative;
  aspect-ratio: 1008 / 966;
}

/* Tracking's, planning's and simplifying's boards lie flat, in a wider
   frame (3:2), so they're sized by their width. */
.features-group__sketch--lying {
  width: clamp(240px, 38vw, 560px);
  height: auto;
  max-width: none;
  aspect-ratio: 1008 / 672;
}

.features-rise > img,
.features-rise > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.features-rise.is-scrubbing > img {
  visibility: hidden;
}

/* A glass marble comes in for each scroll graphic: across the budgeting
   head from the window's left edge, or dropping from the top into the hero.
   glass-art.js moves it and turns it through its sheet of 36 rolls
   (assets/graphics/marble.webp); it sits behind the graphic's stills, so
   the boards pass in front of it. */
.features-group__head:has(.features-marble) {
  position: relative;
}

.features-marble {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  background: url("/assets/graphics/marble.webp") 0 0 / 600% 600% no-repeat;
  pointer-events: none;
  will-change: transform;
}

.is-rolling > .features-marble {
  display: block;
}

/* In the hero and the sections the pieces loop over the board's still. */
.features-rise > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

/* The hero's board looping, its pie and bars moving, while it lies before
   the scroll or stands after it; glass-art.js shows the one for its pose
   over the stills. */
.features-rise > .features-rise__board {
  opacity: 0;
  transition: opacity .12s ease;
}

.features-rise[data-at="lying"] > .features-rise__board[data-pose="lying"],
.features-rise[data-at="standing"] > .features-rise__board[data-pose="standing"] {
  opacity: 1;
}

/* The hero's board is clear glass: once its loop has a frame, the stills
   under it step aside, or their pie and bars would show through it. */
/* The sections' loops carry their clear boards too, so there the still
   steps aside once its loop has a frame. */
.features-rise[data-at="lying"]:has(> .features-rise__board[data-pose="lying"][data-ready]) > :is(canvas, img),
.features-rise[data-at="standing"]:has(> .features-rise__board[data-pose="standing"][data-ready]) > :is(canvas, img),
.features-group__head .features-rise:has(> .features-rise__loop[data-ready]) > :is(canvas, img) {
  visibility: hidden;
}

/* A graphic drops in from above its head, so the head clips what's above
   it (and nothing sideways). While it falls, the head's top edge is soft:
   the graphic fades in through it instead of sliding out from under a line
   (glass-art.js marks the fall, is-falling). */
.features-group__head.is-dropping {
  overflow-x: visible;
  overflow-y: clip;
}

.features-group__head.is-falling {
  /* (The edge is longer the further the graphic still has to fall:
     --head-soft, from glass-art.js. A short edge alone showed the marble
     as a half ball on the bare page wherever the scroll stopped early in
     the fall.) */
  --head-edge: calc(var(--head-fade) + var(--head-soft, 0px));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--head-edge));
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--head-edge));
}

@media (max-width: 560px) {
  .features-group__head {
    --head-fade: 36px;
    column-gap: 18px;
  }

  .features-group__head h2 {
    font-size: clamp(38px, 11vw, 52px);
    line-height: 1.02;
  }

  .features-group__sketch {
    height: 74px;
    max-width: 30vw;
  }

  /* No wider than leaves the words 55vw (less the gutters and the gap), as
     the longest, "simplifying.", needs at 11vw. */
  .features-group__sketch--graphic {
    height: min(150px, calc((45vw - 54px) * 966 / 1008));
    max-width: 46vw;
  }

  .features-group__sketch--lying {
    width: calc(45vw - 54px);
    height: auto;
  }
}
