/* ==========================================================================
   ABOUT · The Person Behind the Practice — the studies
   html[data-about="editorial"]   Study A · The Editorial Portrait   → html[data-ab-layout="editorial"]
   html[data-about="living"]      Study B · The Living Portrait      → html[data-ab-layout="living"]
   html[data-about="color"]       The Portrait in Color, A           → html[data-ab-layout="living"]
   html[data-about="living-color"] The Portrait in Color, B          → html[data-ab-layout="living"]
     (the two colour studies add styles/about-color.css on top of the living layout)
   html[data-about="original"] (or no attribute: no JS)  the approved layout, unchanged
   Everything here is scoped to .ab inside #about. Tokens are read, never changed.
   ========================================================================== */

/* ---------- which layout shows ---------------------------------------------------- */
.ab { display: none; }
html[data-ab-layout] .ab { display: grid; }
html[data-ab-layout] .ab-original { display: none; }

.ab-vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.ab-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* the ICF link (also used in the original layout) */
.ab-ext {
  color: var(--light-text);
  text-decoration: underline;
  text-decoration-color: var(--c-orange);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-thickness 160ms var(--ease-quiet);
}
.ab-ext:hover { text-decoration-thickness: 2px; }
.ab-ext:focus-visible { outline: 2px solid var(--light-focus); outline-offset: 3px; border-radius: 2px; }

/* ==========================================================================
   SHARED · the studies
   ========================================================================== */
.ab {
  --ab-ink: var(--light-text);
  --ab-soft: var(--light-text-soft);          /* 8.6:1 on the paper */
  --ab-peach: #F9D7BD;                        /* soft peach: between the Encounter hand and cream, a touch deeper so it reads on the paper */
  --ab-rule: var(--light-rule);
  position: relative;
  color: var(--ab-ink);
}

/* identity */
.ab__role { margin: 0 0 var(--space-4); font-size: var(--fs-small); font-weight: 500; color: var(--ab-soft); }
.ab__name { margin: 0; font-family: var(--font-display); font-weight: 320; line-height: 0.95; letter-spacing: -0.018em; }
.ab__name-mask { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.ab__name-main { display: block; font-size: var(--ab-name, clamp(3rem, 1.6rem + 4.4vw, 6.75rem)); }
.ab__name-cred {
  display: block;
  margin-top: 0.55em;
  font-size: clamp(1.25rem, 1rem + 0.7vw, 1.75rem);
  font-weight: 380; letter-spacing: 0.01em; line-height: 1.2;
  color: var(--ab-soft);
}

/* the standfirst */
.ab__lede {
  margin: 0;
  max-width: 30ch;
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(1.375rem, 1.1rem + 0.8vw, 1.875rem);
  line-height: 1.32;
  text-wrap: pretty;
}

/* the portrait: Sarah stands on the page itself. The cutout has a transparent background, so the paper
   colour behind her is the section's own (--paper-bg), exactly. One peach form sits behind her outer
   shoulder, never near the face. */
.ab__portrait { position: relative; margin: 0; isolation: isolate; }
.ab__photo {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: transparent;
  /* the arch only trims empty paper at the top corners, never Sarah */
  border-radius: 47% 53% 6px 6px / 31% 31% 6px 6px;
  /* the jacket runs off the photograph's bottom and left edges: it settles into the paper there
     instead of ending on a hard line (the face and hair are well inside both fades) */
  -webkit-mask-image: linear-gradient(to bottom, #000 86%, transparent 100%), linear-gradient(to right, transparent 0, #000 10%);
          mask-image: linear-gradient(to bottom, #000 86%, transparent 100%), linear-gradient(to right, transparent 0, #000 10%);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
}
.ab__photo img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 9%;      /* head and shoulders, with headroom under the arch */
}
.ab__form {
  position: absolute; z-index: -1;
  left: -8%; bottom: -6%; width: 50%; height: 34%;
  fill: var(--ab-peach);
  pointer-events: none;
}
.ab__motif { display: none; }

/* the disciplines */
.ab__list { margin: 0; padding: 0; list-style: none; }
.ab-d { position: relative; }
.ab-d__mark { display: flex; align-items: center; gap: 0.75rem; }
.ab-d__num { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--ab-soft); transition: color 300ms var(--ease-quiet); }
.ab-glyph { width: 2.75rem; height: 2.75rem; overflow: visible; flex: none; }
.ab-glyph path, .ab__motif path { fill: none; stroke: var(--ab-ink); stroke-width: 1.35; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ab-glyph circle, .ab__motif circle { fill: var(--c-orange); }
.ab-d__title { margin: 0; font-family: var(--font-display); font-weight: 360; line-height: 1.12; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.ab-d__title-in { display: inline-block; }
.ab-d__desc { margin: 0; color: var(--ab-soft); line-height: 1.62; max-width: 40ch; text-wrap: pretty; }

/* the shared note at the end, in both studies */
html[data-ab-layout] #about .scope { margin-top: clamp(4.5rem, 3rem + 5vw, 8rem); }

/* ==========================================================================
   STUDY A · THE EDITORIAL PORTRAIT
   ========================================================================== */
@media (min-width: 900px) {
  html[data-ab-layout="editorial"] .ab {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas: "portrait identity" "portrait lede" "portrait list";
    grid-template-rows: auto auto 1fr;
    column-gap: clamp(3rem, 1rem + 6vw, 8.5rem);
    align-items: start;
  }
  html[data-ab-layout="editorial"] .ab__lead { display: contents; }
  html[data-ab-layout="editorial"] .ab__identity { grid-area: identity; padding-top: clamp(0.5rem, 2vw, 2.5rem); }
  html[data-ab-layout="editorial"] .ab__portrait { grid-area: portrait; max-width: 34rem; width: 100%; }
  html[data-ab-layout="editorial"] .ab__lede { grid-area: lede; margin-top: clamp(1.75rem, 1rem + 1.6vw, 2.75rem); }
  html[data-ab-layout="editorial"] .ab__list { grid-area: list; margin-top: clamp(2.5rem, 1.5rem + 2.4vw, 4rem); }
}
html[data-ab-layout="editorial"] .ab-d {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  grid-template-areas: "mark title" "mark desc";
  column-gap: clamp(1rem, 2vw, 2rem); row-gap: 0.65rem;
  padding-block: clamp(1.5rem, 1rem + 1vw, 2.125rem);
  border-top: 1px solid var(--ab-rule);
}
html[data-ab-layout="editorial"] .ab-d:last-child { border-bottom: 1px solid var(--ab-rule); }
html[data-ab-layout="editorial"] .ab-d__mark { grid-area: mark; flex-direction: column; align-items: flex-start; gap: 0.6rem; padding-top: 0.35rem; }
html[data-ab-layout="editorial"] .ab-d__title { grid-area: title; font-size: clamp(1.625rem, 1.25rem + 0.9vw, 2.25rem); }
html[data-ab-layout="editorial"] .ab-d__desc { grid-area: desc; }
/* the active row: a short orange line runs out along its rule; the number warms */
html[data-ab-layout="editorial"] .ab-d::before {
  content: ""; position: absolute; left: 0; top: -1px; height: 1.5px; width: 4.5rem;
  background: var(--c-orange);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 520ms var(--ease-reveal);
}
html[data-ab-layout="editorial"] .ab-d.is-hot::before { transform: scaleX(1); }
html[data-ab-layout="editorial"] .ab-d.is-hot .ab-d__num { color: var(--c-orange); }

/* ==========================================================================
   STUDY B · THE LIVING PORTRAIT
   ========================================================================== */
html[data-ab-layout="living"] .ab { --ab-name: clamp(2.75rem, 1.4rem + 3.3vw, 5.25rem); }
@media (min-width: 900px) {
  html[data-ab-layout="living"] .ab {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas: "lead lede" "lead list";
    grid-template-rows: auto 1fr;
    column-gap: clamp(4.5rem, 2rem + 6vw, 9.5rem);
    align-items: start;
  }
  html[data-ab-layout="living"] .ab__lead { grid-area: lead; }
  html[data-ab-layout="living"] .ab__identity { margin-bottom: clamp(1.5rem, 1rem + 1.2vw, 2.5rem); }
  html[data-ab-layout="living"] .ab__portrait { width: min(100%, 30rem); }
  html[data-ab-layout="living"] .ab__lede { grid-area: lede; padding-top: clamp(1.25rem, 3vw, 3.5rem); }
  html[data-ab-layout="living"] .ab__list { grid-area: list; margin-top: clamp(3rem, 2rem + 3vw, 5rem); }
}
/* the shared motif: beside the portrait, in the space between the columns (only with the anchored layout) */
@media (min-width: 1100px) and (min-height: 640px) {
  html[data-about="living"] .ab__motif {
    display: block; position: absolute;
    width: clamp(5.5rem, 3rem + 4vw, 8rem); height: auto; aspect-ratio: 1;
    right: calc(-1 * (clamp(5.5rem, 3rem + 4vw, 8rem) + clamp(1rem, 0.25rem + 1.2vw, 2rem)));
    bottom: 14%;
    overflow: visible;
  }
}
html[data-ab-layout="living"] .ab-d { padding-top: clamp(1.75rem, 1rem + 1.4vw, 2.5rem); border-top: 1px solid var(--ab-rule); }
html[data-ab-layout="living"] .ab-d + .ab-d { margin-top: clamp(2rem, 1.5rem + 1.5vw, 3rem); }
html[data-ab-layout="living"] .ab-d__title { margin-top: 1rem; margin-bottom: calc(0.85rem - 0.1em); font-size: clamp(1.875rem, 1.3rem + 1.4vw, 3rem); }
html[data-ab-layout="living"] .ab-d__desc { font-size: var(--fs-lede); }

/* sticky only where there is room for it: wide and tall enough. The portrait column is anchored while
   the chapters pass and releases with the grid; its height always fits the screen under the header. */
@media (min-width: 1100px) and (min-height: 640px) {
  html[data-ab-layout="living"] .ab__lead {
    position: sticky;
    top: calc(var(--header-h) + clamp(1.25rem, 3vh, 2.5rem));
    align-self: start;
  }
  html[data-ab-layout="living"] .ab__portrait {
    /* 4:5, as tall as the screen allows under the header and the name, within limits */
    width: min(100%, calc(clamp(17rem, 100svh - var(--header-h) - 17rem, 38rem) * 0.8));
  }
  /* each discipline is a chapter: room to read it before the next one arrives */
  html[data-ab-layout="living"] .ab-d { min-height: max(15rem, 46svh); }
  html[data-ab-layout="living"] .ab-d:last-child { min-height: max(12rem, 30svh); padding-bottom: clamp(1.5rem, 4vh, 3rem); }   /* room for the last chapter while the portrait is still anchored */
  /* the chapter being read is fully inked; the others stay readable */
  html[data-ab-layout="living"] .ab-d .ab-d__title { color: var(--ab-soft); transition: color 420ms var(--ease-quiet); }
  html[data-ab-layout="living"] .ab-d.is-active .ab-d__title { color: var(--ab-ink); }
  html[data-ab-layout="living"] .ab-d.is-active .ab-d__num { color: var(--c-orange); }
  html[data-ab-layout="living"] .ab-d::before {
    content: ""; position: absolute; left: 0; top: -1px; height: 1.5px; width: 5rem;
    background: var(--c-orange); transform: scaleX(0); transform-origin: 0 50%;
    transition: transform 620ms var(--ease-reveal);
  }
  html[data-ab-layout="living"] .ab-d.is-active::before { transform: scaleX(1); }
}

/* ==========================================================================
   NARROW · one editorial column for both studies
   label · name · portrait · standfirst · the three disciplines · the note
   ========================================================================== */
@media (max-width: 899.98px) {
  html[data-ab-layout] .ab { display: block; }
  html[data-ab-layout] .ab__name-main { font-size: clamp(2.875rem, 1.6rem + 6.4vw, 4.5rem); }
  html[data-ab-layout] .ab__portrait { width: min(100%, 26rem); margin: clamp(1.75rem, 5vw, 2.5rem) 0 0; }
  html[data-ab-layout] .ab__form { left: -8%; }
  html[data-ab-layout] .ab__lede { margin-top: clamp(2.5rem, 7vw, 3.5rem); }
  html[data-ab-layout] .ab__list { margin-top: clamp(2rem, 6vw, 3rem); }
  html[data-ab-layout] .ab-d {
    display: block; padding-block: 1.75rem 0; border-top: 1px solid var(--ab-rule); min-height: 0;
  }
  html[data-ab-layout] .ab-d + .ab-d { margin-top: 2rem; }
  html[data-ab-layout] .ab-d:last-child { border-bottom: 0; }
  html[data-ab-layout] .ab-d__mark { flex-direction: row; }
  html[data-ab-layout] .ab-d__title { margin: 0.9rem 0 calc(0.6rem - 0.1em); font-size: clamp(1.75rem, 1.3rem + 2vw, 2.25rem); color: var(--ab-ink); }
  html[data-ab-layout] .ab-d__desc { font-size: var(--fs-body); }
}

/* ==========================================================================
   MOTION (html.ab-motion: motion allowed and scripts/about.js running)
   Held back only until the section is reached; nothing moves once it has arrived.
   ========================================================================== */
html.ab-motion .ab:not(.is-in) .ab__role,
html.ab-motion .ab:not(.is-in) .ab__lede { opacity: 0; transform: translateY(12px); }
html.ab-motion .ab:not(.is-in) .ab__name-main,
html.ab-motion .ab:not(.is-in) .ab__name-cred { transform: translateY(108%); }
html.ab-motion .ab:not(.is-in) .ab__form { opacity: 0; transform: translate(-3%, 4%) scale(0.96); }
html.ab-motion .ab:not(.is-in) .ab__motif { opacity: 0; }
html.ab-motion .ab__role { transition: opacity 700ms var(--ease-quiet) 120ms, transform 900ms var(--ease-reveal) 120ms; }
html.ab-motion .ab__name-main { transition: transform 1100ms var(--ease-reveal) 280ms; }
html.ab-motion .ab__name-cred { transition: transform 1000ms var(--ease-reveal) 480ms; }
html.ab-motion .ab__lede { transition: opacity 800ms var(--ease-quiet) 760ms, transform 1000ms var(--ease-reveal) 760ms; }
html.ab-motion .ab__form { transition: opacity 1200ms var(--ease-quiet) 350ms, transform 1500ms var(--ease-reveal) 350ms; }
html.ab-motion .ab__motif { transition: opacity 900ms var(--ease-quiet) 1100ms; }

html.ab-motion .ab-d:not(.is-in) .ab-d__mark { opacity: 0; }
html.ab-motion .ab-d:not(.is-in) .ab-d__title-in { transform: translateY(105%); }
html.ab-motion .ab-d:not(.is-in) .ab-d__desc { opacity: 0; transform: translateY(10px); }
html.ab-motion .ab-d__mark { transition: opacity 700ms var(--ease-quiet) var(--d, 0ms); }
html.ab-motion .ab-d__title-in { transition: transform 950ms var(--ease-reveal) var(--d, 0ms); }
html.ab-motion .ab-d__desc { transition: opacity 750ms var(--ease-quiet) calc(var(--d, 0ms) + 180ms), transform 900ms var(--ease-reveal) calc(var(--d, 0ms) + 180ms); }
