/* ==========================================================================
   ABOUT · THE PORTRAIT IN COLOR
   html[data-about="color"]         Variation A · The Editorial Color Field
   html[data-about="living-color"]  Variation B · The Living Portrait in Color
   Both set html[data-ab-color] and use the living layout (html[data-ab-layout="living"], styles/about.css):
   the same sticky portrait, the same chapters, the same entrances. This file only adds the colour
   composition, the photographic window, the larger portrait, the shared illustration (B) and the
   quieter closing note. Everything is scoped to #about; tokens are read, never changed.

   The composition (all shapes in tools/ab_shapes.py, in portrait units: the window is 100 × 120)
   · the canvas: warm ivory
   · the photographic window: the cutout portrait on that same ivory, inside a softly asymmetric
     tall crop. Where it meets the page above, it disappears; where it crosses the peach field, its
     edge becomes visible and the portrait ends on it
   · one peach field: from the page's left edge, behind the window, curling up its right side and
     tapering toward the text column
   · one cobalt accent: a small leaf on the field's upper edge, its tip tucked behind the window
   · B: one small shared illustration at the end of the field's taper, between the portrait and
     the chapters
   ========================================================================== */

html[data-ab-color] #about {
  --ab-ivory: #FFF4EE;                 /* warm ivory canvas */
  --ab-field: #F5C6B2;                 /* soft peach field */
  --ab-accent: var(--c-cobalt);        /* the Encounter cobalt */
  background: var(--ab-ivory);
}

/* ---------- the portrait ------------------------------------------------------------ */
html[data-ab-color] .ab__form,
html[data-ab-color] .ab__motif { display: none; }

html[data-ab-color] .ab__photo {
  aspect-ratio: 5 / 6;
  overflow: visible;
  border-radius: 0;
  -webkit-mask-image: none; mask-image: none;
}
html[data-ab-color] .ab__photo img {
  background: var(--ab-ivory);         /* the photograph's white becomes the page's own ivory */
  clip-path: url(#ab-frame);           /* the window; the entrance mask works on .ab__photo, so they never fight */
  object-position: 50% 9%;
}

/* the field and the accent sit behind the window, in portrait units (viewBox -200 -10 340 150) */
.ab__field { display: none; }
html[data-ab-color] .ab__field {
  display: block;
  position: absolute; z-index: -1;
  left: -200%; top: -8.3333%; width: 340%; height: 125%;
  overflow: visible; pointer-events: none;
}
.ab__field-peach { fill: var(--ab-field); }
.ab__field-accent { fill: var(--ab-accent); }
.ab__field-peach--narrow { display: none; }

/* the shared illustration: only in B, only where it has room (see below) */
.ab__art { display: none; }
.ab__art path, .ab__art circle { vector-effect: non-scaling-stroke; }
.ab-art__line { fill: none; stroke: var(--ab-ink); stroke-width: 1.4; stroke-linecap: round; }
.ab-art__fine { fill: none; stroke: var(--c-orange); stroke-width: 1.1; stroke-linecap: round; }
.ab-art__space { fill: var(--ab-field); }
.ab-art__dot { fill: var(--c-orange); }

/* ==========================================================================
   WIDE · the anchored layout (the same sticky span as the Living Portrait)
   ========================================================================== */
@media (min-width: 900px) {
  /* a little more room for the portrait column */
  html[data-ab-color] .ab { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* the window sits a step in from the name, so the field has an exposed edge of colour */
  html[data-ab-color] .ab__portrait { margin-left: clamp(2.5rem, 1rem + 3.5vw, 5rem); }
}
@media (min-width: 1100px) and (min-height: 640px) {
  html[data-ab-color] .ab__identity { margin-bottom: clamp(1.25rem, 0.5rem + 1.2vw, 2rem); }
  html[data-ab-color] .ab__name-cred { margin-top: 0.42em; }
  html[data-ab-color] .ab__portrait {
    /* 5:6, about 10% more portrait than the Living Portrait, still always under the header */
    width: min(calc(100% - clamp(2.5rem, 1rem + 3.5vw, 5rem)), calc(clamp(17rem, 100svh - var(--header-h) - 16.5rem, 40rem) * 5 / 6));
  }
  html[data-about="living-color"] .ab__art {
    display: block; position: absolute;
    width: clamp(6.5rem, 4rem + 3.2vw, 8.75rem); height: auto; aspect-ratio: 1;
    left: calc(100% + clamp(1.5rem, 0.5rem + 1.6vw, 3rem));
    top: 52%;                          /* just above the field's taper, which leads the eye to it */
    overflow: visible;
  }
}

/* ==========================================================================
   NARROW · one column: label · name · portrait · standfirst · disciplines · note
   ========================================================================== */
/* between the one-column layout and the anchored one there is less room before the text column: the
   shorter taper keeps the field clear of the headings */
@media (min-width: 900px) and (max-width: 1099.98px) {
  html[data-ab-color] .ab__portrait { width: min(calc(100% - clamp(2.5rem, 1rem + 3.5vw, 5rem) - 2.5rem), 30rem); }
  html[data-ab-color] .ab__field-peach--wide { display: none; }
  html[data-ab-color] .ab__field-peach--narrow { display: block; }
}
/* wherever the portrait is not anchored (one column, the in-between widths, short screens), B's illustration
   rests beside the name, above the window's empty upper corner, in one stable state */
@media (max-width: 1099.98px), (max-height: 639.98px) {
  html[data-about="living-color"] .ab__art {
    display: block; position: absolute;
    width: min(25%, 7.5rem); height: auto; aspect-ratio: 1;
    right: 0; bottom: calc(100% + clamp(1.5rem, 6vw, 2.5rem));
    overflow: visible;
  }
}
@media (max-width: 899.98px) {
  /* the portrait steps to the right, leaving a strip of colour beside it; room is kept under the window for
     the field and the cobalt stroke (the field reaches 12 units below the 120-unit window) */
  html[data-ab-color] .ab__portrait { width: min(84%, 24rem); margin-left: auto; margin-right: 0; margin-bottom: calc(min(84vw, 24rem) * 0.12 + clamp(2rem, 6vw, 3rem)); }
  html[data-ab-color] .ab__field-peach--wide { display: none; }
  html[data-ab-color] .ab__field-peach--narrow { display: block; }
}

/* ==========================================================================
   THE CLOSING NOTE · "What this work is, and isn't"
   No panel: a band of the deeper paper tone that closes the profile, a fine rule with a short orange
   run, an understated heading and two balanced columns. Same words, same order.
   ========================================================================== */
html[data-ab-color] #about .scope {
  position: relative;
  margin-top: clamp(5rem, 3rem + 6vw, 9rem);
  margin-bottom: calc(-1 * var(--section-pad));          /* the band, not the section's padding, ends the profile */
  padding: clamp(2.5rem, 1.75rem + 2vw, 3.75rem) 0 clamp(3.5rem, 2.5rem + 3vw, 6rem);
  border: 0; border-radius: 0;
  border-top: 1px solid var(--light-rule);
  background: var(--c-paper);
  /* the band runs edge to edge of the page */
  box-shadow: 0 0 0 100vmax var(--c-paper);
  clip-path: inset(0 -100vmax);
}
html[data-ab-color] #about .scope::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 5rem; height: 1.5px; background: var(--c-orange);
}
html[data-ab-color] #about .scope__title {
  margin: 0 0 clamp(1.5rem, 1rem + 1vw, 2.25rem);
  font-size: clamp(1.375rem, 1.1rem + 0.6vw, 1.75rem); font-weight: 360;
}
@media (min-width: 900px) {
  html[data-ab-color] #about .scope { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(4.5rem, 2rem + 6vw, 9.5rem); }
  html[data-ab-color] #about .scope__title { grid-column: 1; }
  html[data-ab-color] #about .scope__cols { grid-column: 1 / -1; column-gap: clamp(4.5rem, 2rem + 6vw, 9.5rem); }
  html[data-ab-color] #about .scope__cols p { max-width: 46ch; }
}

/* ==========================================================================
   MOTION · the field arrives with the portrait (no other background motion)
   ========================================================================== */
html[data-ab-color].ab-motion .ab:not(.is-in) .ab__field { opacity: 0; transform: translateX(-2.5%); }
html[data-ab-color].ab-motion .ab:not(.is-in) .ab__art { opacity: 0; }
html[data-ab-color].ab-motion .ab__field { transition: opacity 1300ms var(--ease-quiet) 150ms, transform 1700ms var(--ease-reveal) 150ms; }
html[data-ab-color].ab-motion .ab__art { transition: opacity 900ms var(--ease-quiet) 1200ms; }
