/* =====================================================================================================
   The About page (17 Oct): the part between the website's nav and footer, from the Paper boards "About · first
   draft (gardener, observer, watcher)" (1440) and "About · full page on a phone" (390). Five parts: the intro, the
   three roles, the agents, recognition and his photos. Words and sizes as in Paper. Narrower than 1440 the columns
   shrink; under 1000 the agents' row becomes the phone's rail; at 720 every part takes the phone board's sizes.
   Takes .lab, the soft rise and the last-line rule from case-study.css and case-study.js. The photo view: about.js.
   No text-wrap: pretty or balance here: they move Paper's line breaks. The last two words of a block stay together
   (case-study.js), so no line ends on one word.
   ===================================================================================================== */
:root { --rail: #C9C6BF; }

.ab { max-width: 1440px; margin: 0 auto; padding: 0 48px 160px; }
.ab > section { padding-top: 160px; }
.ab > .ab-intro { padding-top: 128px; scroll-margin-top: 100vh; }   /* About in the nav slides to the very top */
.ab-head { display: flex; flex-direction: column; gap: 16px; }
.ab-h2 { font-size: var(--step-3); font-weight: 500; line-height: 46px; letter-spacing: -0.02em; }
.ab-sub { font-size: var(--step-1); line-height: 30px; color: var(--muted); }
.ab ul, .ab ol { margin: 0; padding: 0; list-style: none; }
.ab dd { margin: 0; }
.ab-ph { display: none; }                                    /* a line break the phone board has */

/* ---------- 01 · Intro: the story on the left, the portrait on the right ---------- */
.ab-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 48px; }
.ab-story { flex: 0 1 880px; min-width: 0; display: flex; flex-direction: column; gap: 32px; }
.ab-h1 { font-size: var(--step-5); font-weight: 500; line-height: 72px; letter-spacing: -0.03em; }
.ab-lede { max-width: 840px; font-size: var(--step-2); line-height: 38px; letter-spacing: -0.01em; }
.ab-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 396px)); gap: 28px 48px; max-width: 840px; padding-top: 24px; }
.ab-facts > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ab-facts dd { font-size: var(--step-0); line-height: 22px; }
.ab-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.ab-links a { white-space: nowrap; }
.ab-links a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.ab-portrait { flex: 0 1 400px; min-width: 0; padding-top: 48px; }
.ab-portrait img { display: block; width: 100%; height: auto; aspect-ratio: 400 / 432; object-fit: cover; }

/* ---------- 02 · Who I am and how I work: one rose, three moments ---------- */
.ab-roles { display: flex; flex-direction: column; gap: 48px; }
.ab-role-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.ab-role { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ab-role-pic { aspect-ratio: 1; min-height: 0; padding: 24px; background: var(--paper); }   /* min-height: the ratio holds, the rose fits inside */
.ab-role-pic img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.ab-role-txt { display: flex; flex-direction: column; gap: 10px; }
.ab-role h3 { font-size: var(--step-2); font-weight: 500; line-height: 34px; letter-spacing: -0.01em; }
.ab-role-txt p:last-child { font-size: var(--step-0); line-height: 24px; color: var(--muted); }
.ab-role:nth-child(1) .ab-role-txt p:last-child { max-width: 340px; }
.ab-role:nth-child(2) .ab-role-txt p:last-child { max-width: 400px; }
.ab-role:nth-child(3) .ab-role-txt p:last-child { max-width: 310px; }

/* ---------- 03 · How I work with agents: five steps, the loop back, what it changed ---------- */
/* At 1440 the row is Paper's: steps of 220, 220, 320, 220 and 204 with a 40 arrow between. Narrower, the arrows keep
   40 and the steps share the rest in the same proportions (--k), so the loop still meets step 03's middle and step
   05's rose. Under 1000 the steps run down a rail, as on the phone board. */
.ab-agents { display: flex; flex-direction: column; gap: 56px; }
.ab-agents .ab-sub { max-width: 980px; }
.ab-diagram { container: flow / inline-size; display: flex; flex-direction: column; gap: 16px; }
.ab-flow { --k: calc((100cqw - 160px) / 1184); display: grid; align-items: start;
  grid-template-columns: calc(40px + 220 * var(--k)) calc(40px + 220 * var(--k)) calc(40px + 320 * var(--k)) calc(40px + 220 * var(--k)) minmax(0, 1fr); }
.ab-step { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-right: 40px; }
.ab-step:last-child { padding-right: 0; }
.ab-arrow { position: absolute; top: 0; right: 0; display: block; }
.ab-mark { display: flex; align-items: center; gap: 4px; height: 28px; }
.ab-rose { display: block; flex-shrink: 0; width: 28px; height: 28px; }
.ab-dot { display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border: 1.5px solid var(--rail); border-radius: 50%; }
.ab-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ab-line { flex: 1; height: 1.5px; margin-left: 4px; background: var(--rail); }
.ab-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ab-body > .lab, .ab-loop .lab { white-space: nowrap; }
.ab-body > .lab.me, .ab-loop .lab, .ab-back .lab { color: var(--rose); }
.ab-txt { display: flex; flex-direction: column; gap: 6px; }
.ab-step h3 { font-size: var(--step-1); font-weight: 500; line-height: 28px; }
.ab-txt p { font-size: var(--step-0); line-height: 22px; color: var(--muted); }
/* Paper's line widths, as parts of each step's column, so the lines break where they do on the board */
.ab-step:nth-child(1) .ab-txt p { width: 89.09%; }
.ab-step:nth-child(2) .ab-txt p { width: 107.27%; }
.ab-step:nth-child(4) .ab-txt p { width: 95.45%; }
.ab-step:nth-child(5) .ab-txt p { width: 98.04%; }
.ab-models { width: 93.75%; border-collapse: collapse; }
.ab-models tr { border-top: 1px solid var(--line); }
.ab-models tr:last-child { border-bottom: 1px solid var(--line); }
.ab-models th, .ab-models td { padding: 8px 0; vertical-align: baseline; }
.ab-models th { font-size: var(--step-0); font-weight: 400; line-height: 22px; text-align: left; }
.ab-models td { padding-left: 12px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: var(--step--1); line-height: 16px;
  color: var(--muted); text-align: right; white-space: nowrap; }
/* the loop: from under step 05's rose, along, and back up into step 03's middle (Paper's path, drawn in parts) */
.ab-loop { --k: calc((100cqw - 160px) / 1184); --l: calc(80px + 600 * var(--k)); --r: calc(174px + 980 * var(--k));
  position: relative; height: 44px; }
.ab-loop i { position: absolute; width: 1.5px; border-radius: 1px; background: var(--rose); }
.ab-loop .up { left: calc(var(--r) - 0.75px); top: 0; height: 30.75px; }
.ab-loop .across { left: calc(var(--l) - 0.75px); top: 29.25px; width: calc(var(--r) - var(--l) + 1.5px); height: 1.5px; }
.ab-loop .back { left: calc(var(--l) - 0.75px); top: 4px; height: 26.75px; }
.ab-loop svg { position: absolute; left: calc(var(--l) - 6px); top: 2px; display: block; }
/* the label sits 27.85% along the line, as in Paper; when the row is narrower it slides left so the line up stays clear */
.ab-loop .lab { position: absolute; left: var(--l); top: 22px; display: flex; width: calc(var(--r) - var(--l) - 24px); }
.ab-loop .lab::before { content: ''; flex: 0 1 calc((var(--r) - var(--l)) * 0.2785); }
.ab-loop .lab > span { flex: none; padding-inline: 10px; background: var(--ground); }
.ab-back { display: none; align-items: center; gap: 8px; padding-top: 10px; }
.ab-back svg { display: block; flex-shrink: 0; }

.ab-out { display: flex; flex-direction: column; gap: 24px; padding-top: 24px; }
.ab-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; align-items: start; }
.ab-stat { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.ab-num { font-size: 48px; font-weight: 500; line-height: 52px; letter-spacing: -0.03em; white-space: nowrap; }
.ab-stat > div { display: flex; flex-direction: column; gap: 4px; }
.ab-stat-t { font-size: var(--step-0); line-height: 22px; }
.ab-stat-d { font-size: 14px; line-height: 20px; color: var(--muted); }
.ab-stat:nth-child(1) .ab-stat-d { max-width: 204px; }
.ab-stat:nth-child(2) .ab-stat-d, .ab-stat:nth-child(3) .ab-stat-d { max-width: 240px; }
.ab-stat:nth-child(4) .ab-stat-d { max-width: 250px; }
.ab-source { max-width: 755px; font-size: 14px; line-height: 20px; color: var(--muted); }

@container flow (max-width: 999px) {
  .ab-flow { display: flex; flex-direction: column; align-items: stretch; }
  .ab-step { flex-direction: row; gap: 16px; padding-right: 0; }
  .ab-arrow, .ab-loop { display: none; }
  .ab-mark { flex-direction: column; flex-shrink: 0; gap: 6px; width: 28px; height: auto; }
  .ab-line { flex: 1; width: 1.5px; height: auto; margin-left: 0; }
  .ab-body { flex: 1; max-width: 420px; gap: 10px; padding: 6px 0 36px; }
  .ab-step:last-child .ab-body { padding-bottom: 0; }
  .ab-step:nth-child(n) .ab-txt p { width: auto; }
  .ab-models { width: 100%; }
  .ab-back { display: flex; }
}

/* ---------- 04 · Recognition: four columns, a rule on top of each ---------- */
.ab-rec { display: flex; flex-direction: column; gap: 48px; }
.ab-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; align-items: start; }
.ab-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.ab-col ul { display: flex; flex-direction: column; gap: 20px; }
.ab-col li { display: flex; flex-direction: column; gap: 4px; }
.ab-col li p:first-child { font-size: var(--step-0); line-height: 22px; }
.ab-col li p + p { font-size: 14px; line-height: 20px; color: var(--muted); }
.ab-col .w200 { max-width: 200px; }

/* ---------- 05 · Outside: his photos, two mirrored blocks ---------- */
.ab-outside { display: flex; flex-direction: column; gap: 48px; }
.ab-photos { display: flex; flex-direction: column; gap: 16px; }
.ab-block { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ab-four { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ab-photo { position: relative; display: block; overflow: hidden; border-radius: 2px; background: var(--paper);
  aspect-ratio: 4 / 5; cursor: zoom-in; }
.ab-photo.big { aspect-ratio: auto; }                         /* as tall as the four beside it, as in Paper (664 x 826) */
.ab-photo img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.ab-photo:focus-visible { outline-offset: 4px; }
.ab-photo.lifted { visibility: hidden; }                      /* while its photo is open over the page */

/* ---------- The photo view (Paper "About · photo opens on the page"): the case study's veil and close, plus arrows ---------- */
.ab-lb { touch-action: pan-y pinch-zoom; }
.ab-lb .cs-lb-bar { justify-content: flex-end; }
.ab-lb-pic { position: absolute; z-index: 1; left: 0; top: 0; display: grid; overflow: hidden; border-radius: 2px;
  transform-origin: 0 0; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.ab-lb-pic.moving { transition: transform 600ms var(--calm); }
.ab-lb-pic img { grid-area: 1 / 1; display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.ab-lb-pic img.in { opacity: 0; transition: opacity 700ms var(--calm); }
.ab-lb-pic img.in.on { opacity: 1; }
.ab-lb-go { position: absolute; z-index: 2; left: 0; top: 0; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--ground);
  color: var(--ink); cursor: pointer; opacity: 0; transition: opacity 500ms var(--calm); -webkit-tap-highlight-color: transparent; }
.ab-lb.open .ab-lb-go { opacity: 1; }
.ab-lb-go:hover { border-color: var(--ink); }
.ab-lb-go:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.ab-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  .ab-lb .cs-lb-close, .ab-lb-go { width: 44px; height: 44px; }   /* the size a thumb needs; desktop keeps 40 */
}

@media (prefers-reduced-motion: reduce) {
  .ab-lb-pic.moving, .ab-lb-pic img.in, .ab-lb-go { transition: none; }
}

/* ---------- Narrower ---------- */
@media (max-width: 1100px) {
  .ab-h1 { font-size: var(--step-4); line-height: 56px; }
}
@media (max-width: 1000px) {
  .ab-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 32px; }
  .ab-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
}
@media (max-width: 900px) {
  .ab { padding: 0 32px 120px; }
  .ab-intro { flex-direction: column; gap: 32px; }
  .ab-story { flex: none; width: 100%; }
  .ab-portrait { flex: none; width: 100%; max-width: 400px; padding-top: 0; }
}
/* the phone board's sizes: 72 between parts, headings 28/36, lines 16/24 */
@media (max-width: 720px) {
  .ab { padding-bottom: 64px; }
  .ab > section { padding-top: 72px; }
  .ab > .ab-intro { padding-top: 48px; }
  .ab-head { gap: 12px; }
  .ab-h2 { font-size: var(--step-2); line-height: 36px; }
  .ab-sub { font-size: var(--step-0); line-height: 24px; }
  .ab-story { gap: 20px; }
  .ab-h1 { font-size: var(--step-3); line-height: 46px; }
  .ab-lede { font-size: var(--step-1); line-height: 30px; }
  .ab-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; padding-top: 12px; }
  .ab-facts > div:nth-child(n + 3) { grid-column: 1 / -1; }
  .ab-facts .w240 { max-width: 240px; }
  .ab-portrait { max-width: none; }
  .ab-portrait img { aspect-ratio: 350 / 378; }

  .ab-roles, .ab-rec, .ab-outside { gap: 32px; }
  .ab-role-list { grid-template-columns: 1fr; gap: 40px; }
  .ab-role { gap: 16px; }
  .ab-role-pic { aspect-ratio: 350 / 320; padding: 20px; }
  .ab-role-txt { gap: 8px; }
  .ab-role h3 { font-size: var(--step-1); line-height: 28px; }
  .ab-role:nth-child(n) .ab-role-txt p:last-child { max-width: 330px; }

  .ab-agents { gap: 40px; }
  .ab-out { padding-top: 40px; }
  .ab-stats { gap: 32px 16px; }
  .ab-num { font-size: var(--step-3); line-height: 44px; }

  .ab-cols { grid-template-columns: 1fr; gap: 32px; }
  .ab-col, .ab-col ul { gap: 16px; }
  .ab-col .w200 { max-width: none; }

  .ab-photos, .ab-block, .ab-four { gap: 12px; }
  .ab-block { grid-template-columns: 1fr; }
  .ab-photo.big { aspect-ratio: 350 / 438; }
  .ab-block.flip .big { order: -1; }                          /* on a phone big and small take turns */
}
@media (max-width: 640px) {
  .ab { padding-inline: 20px; }
  .ab-ph { display: inline; }
  /* the phone board's widow fixes, by width */
  .ab-agents .ab-sub { max-width: 305px; }
  .ab-step:nth-child(2) .ab-txt p, .ab-step:nth-child(4) .ab-txt p { max-width: 280px; }
  .ab-stat:nth-child(2) .ab-stat-d { max-width: 140px; }
  .ab-stat:nth-child(4) .ab-stat-t { max-width: 135px; }
  .ab-rec .ab-h2 { max-width: 280px; }
}
