/* R23, thirds as columns. R24: the default page; R30: the only page (index.html sets .layout-thirds statically; every
   rule here is still scoped to it, so each wins over style.css's base rule as before).
   thirds.js adds the plates (.plate > .plate-in > img) as the first child of .s-problem (refinery, left), .s-track
   (R24: Ralph's portrait, right) and .s-does (energy, R24: left) and sets the column crop; the plate list lives
   there, the sizes here.
   Breakpoint: columns wider than 760 px (style.css's own phone/desktop split), the strip at 760 px and below. */
:root {
  --bar-h: 0px;                              /* the header bar shows only with a canvas */
  /* R24 (N8): the edge fades halved (R23: 38 % and clamp(48px, 9vh, 110px)). */
  --plate-fade: 19%;                         /* desktop: the plate's inner edge fades over this share of the column */
  --plate-vfade: clamp(24px, 4.5vh, 55px);   /* desktop: top and bottom edge fades (40.5 px at 900) */
  --strip-h: clamp(200px, 33vh, 380px);      /* phone: a third of the screen (279 px at 844, 220 at 667) */
  --strip-fade: 18%;                         /* phone: top and bottom fades of the strip */
}
.layout-thirds.has-canvas { --bar-h: 52px; }
/* R24 (N1): the two colour joins, shortened from 66vh (style.css) to 40vh; main.js JOIN carries the same number. */
/* R28: --hero-overlap 20vh to 35vh (the page's top edge now sits 5vh under the fold at rest, so the first screen is
   unchanged, and starts to come up with the first scroll). */
.layout-thirds.has-canvas { --join: 40vh; --hero-overlap: 35vh; }
/* R24 (N1), the blank screen under the hero: R23's page reached the bottom edge only when the hero ended (S = T), and its
   first content rose above the dock some 130 px later, after the hero text had gone: a whole screen of navy and the
   docked drop. Now the page starts to rise --hero-overlap before the hero ends, so its first content (the divider,
   the refinery column) comes up while the hero text is fading. The hero's own timeline is unchanged (it still ends at
   T: the margin does not change .scroll-space's box, which the timeline and the drop model read). */
.layout-thirds.has-canvas .scroll-space { margin-bottom: calc(-1 * var(--hero-overlap)); }
/* R28 (N1 reopened): R24's overlap still left a third of a screen of ground only (the hero text faded on the hero
   timeline, gone well before the first heading came into reading view). Now (a) main.js fades the hero text only as
   the first heading arrives (THIRDS_READ), so there is always one or the other, (b) the overlap above is longer and
   (c) the first section's top spacing is shorter (below), so the heading arrives about when the old fade ended and
   the hero text does not hang on. Desktop: the space between the divider and the heading. Phones: the gap between
   the refinery strip and the heading (the strip's own 18 % fade still separates them). */
@media (min-width: 761px) { .layout-thirds.has-canvas .s-problem { padding-top: clamp(2.5rem, 5vh, 4rem); } }
/* Phones also: the section's bottom padding, so the track record's portrait and "Ralph Goehring" come up before the
   last lines of this section leave (at 390x667 there was a moment with neither). */
@media (max-width: 760px) {
  .layout-thirds.has-canvas .s-problem > .plate { margin-bottom: 2.5rem; }
  .layout-thirds.has-canvas .s-problem { padding-bottom: 2.5rem; }
}
@supports (height: 1svh) { :root { --strip-h: clamp(200px, 33svh, 380px); } }

/* The track record follows the problem section and sits on the dark ground of its end (data-ground "dark" in
   index.html): flat deep teal, so problem (navy to deep), track (deep) and does (deep, then its join to sand) run on
   with no seam. Sand text, as on .s-problem and .s-does. */
.layout-thirds .s-track { background: var(--deep); color: var(--sand); border-top: 0; }
.layout-thirds .s-track blockquote { border-left-color: rgba(248, 235, 218, 0.55); }   /* was deep: invisible here */
.layout-thirds .page .s-track a:focus-visible::after { background: var(--sand); }     /* no sheen ring holds 3:1 on teal */
/* R24: the testimonials follow the track record on the same ground (data-ground "dark" in index.html). */
.layout-thirds .s-voices { background: var(--deep); color: var(--sand); border-top: 0; }
.layout-thirds .s-voices blockquote { border-left-color: rgba(248, 235, 218, 0.55); }

/* R24 (N1): the joins, 40vh (the same stops as style.css's 66vh joins, scaled: 58/66 = 0.8788 and so on). */
.layout-thirds.has-canvas .s-does {
  padding-bottom: var(--join);
  background: linear-gradient(
    #176A80 calc(100% - var(--join)),
    #1A7088 calc(100% - var(--join) * 0.8788),
    #1F7A93 calc(100% - var(--join) * 0.7273),
    #2B8A9A calc(100% - var(--join) * 0.5758),
    #3C9A9C calc(100% - var(--join) * 0.4242),
    #8DBFB8 calc(100% - var(--join) * 0.2576),
    #CFE0CF calc(100% - var(--join) * 0.1212),
    #F8EBDA 100%);
}
.layout-thirds.has-canvas .s-close {
  padding-top: var(--join);
  background:
    linear-gradient(
      #F8EBDA 0,
      #CFE0CF calc(var(--join) * 0.1212),
      #8DBFB8 calc(var(--join) * 0.2576),
      #3C9A9C calc(var(--join) * 0.4242),
      #2B8A9A calc(var(--join) * 0.5758),
      #1F7A93 calc(var(--join) * 0.7273),
      #176A80 calc(var(--join) * 0.8788),
      #0E3B4A var(--join)) top / 100% var(--join) no-repeat,
    var(--navy);
}

/* R24 (N9): the sheen dividing line (style.css --divider) at the top edge of each section where the ground or the
   plate column changes: hero | problem, problem | track, track | testimonials, testimonials | does. Not on the
   colour joins (does | fractional, who | close), and not between the sand sections (their hairlines stay).
   Static, no pointer events, above the plate column. */
.layout-thirds .page > :is(.s-problem, .s-track, .s-voices, .s-does)::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: var(--divider-h);
  background: var(--divider);
  pointer-events: none;
}
/* The section after the track record had a hairline against sand above it; .s-does starts deep, so none is needed. */

/* ---- Desktop: three columns of the viewport width; one outer third is the plate. ---- */
@media (min-width: 761px) {
  /* The text takes the other two thirds, centred there at its own reading width (.two keeps its max-width).
     Padding percentages are of .page's width, which is the viewport's. */
  .layout-thirds .plate-left { padding-left: calc(100% / 3 + 24px); padding-right: 24px; }
  .layout-thirds .plate-right { padding-right: calc(100% / 3 + 24px); padding-left: 24px; }

  .layout-thirds .plate {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(100% / 3);
    overflow: clip;                /* not hidden: that would make it a scroll box and stop the held plate */
    pointer-events: none;
    /* Top and bottom edges fade into the section's ground. */
    -webkit-mask: linear-gradient(transparent, #000 var(--plate-vfade), #000 calc(100% - var(--plate-vfade)), transparent) no-repeat;
    mask: linear-gradient(transparent, #000 var(--plate-vfade), #000 calc(100% - var(--plate-vfade)), transparent) no-repeat;
  }
  .layout-thirds .plate-left .plate { left: 0; }
  .layout-thirds .plate-right .plate { right: 0; }
  /* .s-does: the plate ends where the dark-to-light join begins (the join itself is unchanged). */
  .layout-thirds .s-does .plate { bottom: 21rem; }
  .layout-thirds.has-canvas .s-does .plate { bottom: var(--join); }

  /* Base (and reduced motion): the picture fills the whole column and scrolls with the section. The inner edge fades out. */
  .layout-thirds .plate-in {
    position: absolute;
    inset: 0;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--plate-fade)), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - var(--plate-fade)), transparent);
  }
  .layout-thirds .plate-right .plate-in {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--plate-fade)), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - var(--plate-fade)), transparent);
  }
  .layout-thirds .plate-in img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    display: block;
    object-fit: cover;
    object-position: var(--plate-x, 50%) var(--plate-y, 50%);   /* thirds.js: the subject's crop for this column */
  }
}
/* Hold (R30: the only reveal where motion is allowed): one screen of picture (below the header bar), held in view while
   the section is on screen; the column (the section's height) carries it off with the section. Shorter sections: the
   column's own height. */
@media (min-width: 761px) and (prefers-reduced-motion: no-preference) {
  .layout-thirds .plate-in {
    position: sticky;
    inset: auto;
    top: var(--bar-h);
    height: calc(100vh - var(--bar-h));
    max-height: 100%;
  }
}

/* ---- Phone: the plate is a strip above the section's heading (R21's plain band). ---- */
@media (max-width: 760px) {
  /* The strip takes the section's top padding's place: the strip, then the same gap, then the heading. */
  .layout-thirds .has-plate:not(.has-portrait) { padding-top: 0; }
  .layout-thirds .s-problem { background: linear-gradient(var(--navy) var(--strip-h), var(--deep)); }
  .layout-thirds .plate {
    position: relative;
    height: var(--strip-h);
    margin: 0 -16px clamp(3.5rem, 7vw, 6rem);     /* full width, out over the section's side padding */
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(transparent, #000 var(--strip-fade), #000 calc(100% - var(--strip-fade)), transparent);
    mask-image: linear-gradient(transparent, #000 var(--strip-fade), #000 calc(100% - var(--strip-fade)), transparent);
  }
  .layout-thirds.has-canvas .plate { margin-bottom: clamp(4.5rem, 10vh, 7.5rem); }   /* = top padding with a canvas */
  .layout-thirds .plate-in { position: absolute; inset: 0; }
  .layout-thirds .plate-in img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    display: block;
    object-fit: cover;
    object-position: var(--plate-narrow, 50% 50%);
  }
  /* R24: the portrait is not a strip (a face cut to a strip looks wrong): a small upright picture above the
     "Ralph Goehring" heading, at the reading column's left edge, in the section's top padding. */
  .layout-thirds .plate.plate-portrait {
    width: var(--portrait-w, 160px);
    height: auto;
    aspect-ratio: 2 / 3;
    margin: 0 0 1.6rem max(0px, calc((100% - 40rem) / 2));
    border-radius: 6px;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* ---- R26's recommendations, the default since R30 (OQ-30, OQ-25, OQ-31; were ?try=fade, outline, voices). ---- */

/* The shaped plate fade (OQ-30). Over the R24 fades (inner edge 19 %, top and bottom --plate-vfade, unchanged), the
   picture itself is masked by two layers added together: a band of the picture kept at full strength (thirds.js PLATES
   keep: [top, bottom], fractions of the picture's height, written as --keep-top / --keep-bottom) fading out above and
   below it, plus the picture's own luminance (the same file, --plate-url, placed as object-fit places it). Above and
   below the band only the lit parts stay (lights, steam, the glow); the near-black sky and foreground give way to the
   section's ground, so the column has no dark box. The landscape plates fill the column's height at every size (cover,
   much wider than the column), so the band's fractions of the box are fractions of the picture. Not the portrait.
   Phones: the same on the strip (it read as a dark band across the teal, the energy plate most), placed as the strip's
   own crop. A browser without mask-mode treats the luminance layer as opaque: the plain R24 plate. */
.layout-thirds .plate:not(.plate-portrait) .plate-in img {
  mask-image:
    linear-gradient(transparent, rgba(0, 0, 0, 0.5) calc(var(--keep-top) * 0.65), #000 var(--keep-top),
      #000 var(--keep-bottom), rgba(0, 0, 0, 0.5) calc(var(--keep-bottom) + (100% - var(--keep-bottom)) * 0.35), transparent),
    var(--plate-url);
  mask-mode: alpha, luminance;
  mask-size: 100% 100%, cover;
  mask-position: 0 0, var(--plate-x, 50%) var(--plate-y, 50%);
  mask-repeat: no-repeat;
  mask-composite: add;
}
@media (max-width: 760px) {
  .layout-thirds .plate:not(.plate-portrait) .plate-in img { mask-position: 0 0, var(--plate-narrow, 50% 50%); }
}

/* The sand outline on the track record's "Book a call" (OQ-25), which sits on deep teal here (fill edge 1.44:1 against
   it). Outside the fill, so the fill, its drift and hover slide and the label are unchanged; the focus ring (inset -6px)
   stays clear of it. The other "Book a call" buttons are untouched. */
.layout-thirds .page .s-track .cta { box-shadow: 0 0 0 1.5px var(--sand); }

/* The testimonials heading (OQ-31), the page's small heading (.page h3), at the quotes' own width (.voices: 40rem,
   72rem from 1100 px). */
.layout-thirds .voices-h { max-width: 40rem; margin-inline: auto; }
@media (min-width: 1100px) { .layout-thirds .voices-h { max-width: 72rem; } }
