/*
  About (about.html), on the site's Main Street look: cream paper, bottle
  green, brick, mustard and ink, Fraunces and Figtree, 2.5px ink lines,
  round corners and offset shadows.

  The trade is old, the tools are new: a water mill and a modern office
  drawn part for part, then the two of us at one bench and the tools we
  build with. The words are all in the HTML; js/about/ draws and runs the
  three drawings.
*/

/* The motion curves, the green kicker and the press feedback are the site's own (css/styles.css). */
.ms-page { display: block; }

/* Fills the site doesn't name yet, all from its palette. */
.f-paper2 { fill: var(--paper-2) !important; }
.f-lit { fill: var(--lit) !important; }
.f-green-wash { fill: var(--green-wash) !important; }
.f-mustard-wash { fill: var(--mustard-wash) !important; }
.f-green-deep { fill: var(--green-deep) !important; }

.ms-page .page-hero .lead { margin-top: 22px; color: var(--ink-soft); }

/* A drawing. Text inside drawings uses the site's sans. */
.ab-stage { width: 100%; height: auto; }
.ab-stage text { font-family: var(--sans); stroke: none; fill: var(--ink); }

/* The dictionary entry. */
.ab-def { position: relative; max-width: 46rem; padding: clamp(22px, 3vw, 34px); border: var(--line) solid var(--ink); border-radius: var(--r-lg); background: var(--white); box-shadow: 6px 7px 0 var(--mustard); }
.ab-def-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ab-def-word b { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-weight: 600; font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1; }
.ab-def-say { font-size: 1.05rem; color: var(--ink-soft); }
.ab-def-pos { font-family: var(--serif); font-style: italic; color: var(--brick); font-size: 1.1rem; }
.ab-def ol { margin-top: 16px; display: grid; gap: 14px; counter-reset: sense; }
.ab-def li { position: relative; padding-left: 34px; counter-increment: sense; }
.ab-def li::before { content: counter(sense); position: absolute; left: 0; top: 0.1em; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink); font-weight: 800; font-size: 0.82rem; }
.ab-def li:last-child::before { background: var(--mustard); }
.ab-def-text { font-size: 1.12rem; line-height: 1.5; }
.ab-def-note { margin-top: 4px; font-size: 0.9rem; font-style: italic; color: var(--ink-soft); }
.ab-def li:last-child .ab-def-note { font-style: normal; font-weight: 700; color: var(--brick-deep); }

/* A small pause control for anything that loops on its own for more than a moment. */
.ab-pause { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); font: inherit; font-weight: 700; font-size: 0.88rem; color: var(--ink); cursor: pointer; }
.ab-pause-i { width: 12px; height: 12px; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.ab-pause[aria-pressed="true"] .ab-pause-i { border: 0; border-left: 11px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; width: 0; height: 0; }
.ab-pause[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) { .ab-pause:hover { background: var(--mustard-wash); } }

/* Until the script draws them in, each drawing keeps its place. */
.ab-art[data-scene]:empty { aspect-ratio: 640 / 440; }
.ab-shop .ab-art[data-scene]:empty { aspect-ratio: 520 / 302; }


.ab-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }

/* ---------- Part for part ---------- */
.ab-machinery { padding-top: clamp(16px, 3vw, 40px); }
.ab-m-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 24px; }
.ab-title { font-size: clamp(2.1rem, 4.2vw, 3.4rem); line-height: 1.08; }
.ab-title em { font-style: italic; color: var(--brick); }

/*
  The heading, once, on first view, and quickly:
  the kicker wipes in, the words rise out of a mask 45ms apart, then a gear
  rolls along under "mill" and lays the line behind it (js/about/about.js, WAAPI).
*/
.ab-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0 0.04em 0.12em; margin: 0 -0.04em -0.12em; }
.ab-w > span { display: inline-block; }
.ab-mill { position: relative; display: inline-block; }
.ab-ul { position: absolute; left: 0.02em; right: 0.5em; bottom: -0.14em; height: 22px; pointer-events: none; }
.ab-ul-line { position: absolute; left: 0; right: 0; top: 9px; height: 5px; border-radius: 3px; background: var(--mustard); transform-origin: 0 50%; }
.ab-ul-gear { position: absolute; right: -11px; top: 0; width: 22px; height: 22px; overflow: visible; }
.ab-kicker { display: inline-block; }
html.ms-motion :is(.ab-m-head, .ab-rise).is-waiting .ab-kicker { clip-path: inset(0 100% 0 0); }
html.ms-motion :is(.ab-m-head, .ab-rise).is-waiting .ab-w > span { transform: translateY(110%); }
html.ms-motion .ab-m-head.is-waiting :is(.ab-ul-line, .ab-ul-gear) { opacity: 0; }
html.ms-motion .ab-m-head.is-waiting .ab-m-tools { opacity: 0; transform: translateY(6px); }
.is-in > .ab-kicker, .ab-m-head.is-in .ab-kicker { clip-path: inset(0 0 0 0); transition: clip-path 380ms var(--ease-out); }
.ab-rise.is-in .ab-w > span, .ab-m-head.is-in .ab-w > span { transform: none; transition: transform 520ms var(--ease-out); transition-delay: calc(var(--i) * 45ms); }
.ab-m-head.is-in .ab-m-tools { opacity: 1; transform: none; transition: opacity 300ms ease 240ms, transform 300ms var(--ease-out) 240ms; }

/* ---------- The two plates: a drawing, and a title strip under it ---------- */
.ab-board { margin-top: 26px; }
.ab-stages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2vw, 24px); }
.ab-plate { margin: 0; display: grid; grid-template-rows: auto auto; border: var(--line) solid var(--ink); border-radius: var(--r-lg); background: var(--white); box-shadow: 0 8px 0 var(--ink); overflow: hidden; }
.ab-art { position: relative; border-bottom: var(--line) solid var(--ink);
  background-color: var(--white);
  background-image: linear-gradient(rgba(34, 50, 44, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(34, 50, 44, 0.07) 1px, transparent 1px);
  background-size: 20px 20px; }
.ab-stage { display: block; overflow: hidden; }
.ab-stage text { font-weight: 800; letter-spacing: 0.04em; }
.ab-plate figcaption { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px 18px 16px; }
.ab-era { display: inline-grid; place-items: center; min-width: 64px; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--mustard-wash); font-weight: 800; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; }
.ab-era-now { background: var(--green); color: var(--white); }
.ab-pt { display: grid; gap: 2px; }
.ab-pt b { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-weight: 600; font-size: 1.2rem; line-height: 1.2; }
.ab-pt span { font-size: 0.92rem; line-height: 1.45; color: var(--ink-soft); }

/* Lines in the drawings that should read finer than the 2.5px outline. */
.ab-stage .ab-fine { stroke-width: 1.5 !important; opacity: 0.55; }
.ab-stage .ab-leader { stroke-width: 1.8 !important; }
.ab-stage .ab-motes circle { fill: var(--white); stroke: none; opacity: 0.9; }
.ab-stage .ab-lamp.is-on { fill: var(--lit) !important; }
.ab-stage .ab-ai { font-size: 15px; }
/* Faces: a smile by default, or the mood the routine asks for. */
.ab-stage .rg-m { display: none; }
.ab-stage .rg-shut { display: none; }
.ab-stage .rg:is([data-mood="smile"], [data-mood="bliss"]) .rg-m-smile, .ab-stage .rg:is([data-mood="flat"], [data-mood="shut"]) .rg-m-flat, .ab-stage .rg[data-mood="o"] .rg-m-o { display: inline; }
/* Eyes closed: listening to the machinery, or a good stretch. */
.ab-stage .rg:is([data-mood="shut"], [data-mood="bliss"]) .rg-shut { display: inline; }
.ab-stage .rg:is([data-mood="shut"], [data-mood="bliss"]) .rg-eyes { display: none; }

/*
  First view, as one movement (js/about/about.js, coat and lift): a line-only copy of the
  drawing sits over the live colour one. Its outlines ink in part after part
  (ease-in-out, 45ms apart); then it is wiped away left to right through a
  soft-edged mask while the machinery underneath spins up.
*/
.ab-coat { position: absolute; inset: 0; pointer-events: none; background: inherit;
  -webkit-mask-image: linear-gradient(90deg, transparent 0 44%, #000 56%); mask-image: linear-gradient(90deg, transparent 0 44%, #000 56%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0; }
.ab-coat .ab-ink :is(path, rect, circle, ellipse):not([stroke-dasharray]) { stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0; }
.ab-coat :is(.ab-ink text, .ab-calls, .ab-ink [stroke-dasharray], .ab-motes, .ab-race) { opacity: 0; }
.ab-coat.is-drawn .ab-ink :is(path, rect, circle, ellipse):not([stroke-dasharray]) { stroke-dashoffset: 0; transition: stroke-dashoffset 450ms var(--ease-in-out); transition-delay: calc(var(--seq, 0) * 45ms + var(--coat-delay, 0ms)); }
.ab-plate + .ab-plate .ab-coat { --coat-delay: 80ms; }

/* Constant motion in the drawings (water, grain, flour, dust, clouds): linear, and only while running. */
@keyframes ab-dash { to { stroke-dashoffset: -48; } }
@keyframes ab-dash-down { to { stroke-dashoffset: -30; } }
@keyframes ab-race { to { transform: translateX(-32px); } }
@keyframes ab-drift { from { transform: translateX(-10px); } to { transform: translateX(12px); } }
@keyframes ab-mote { 0% { transform: translate(0, 0); opacity: 0; } 30% { opacity: 0.9; } 100% { transform: translate(-30px, -26px); opacity: 0; } }
@keyframes ab-drip { from { transform: translateY(-4px); opacity: 1; } to { transform: translateY(18px); opacity: 0; } }
.is-running .ab-run { animation: ab-dash 1.6s linear infinite; }
.is-running :is(.ab-fall, .ab-trickle, .ab-flow) { animation: ab-dash-down 0.6s linear infinite; }
.is-running .ab-race { animation: ab-race 2.2s linear infinite; }
.is-running .ab-race-2 { animation-duration: 3.1s; }
.is-running .ab-cloud { animation: ab-drift 9s var(--ease-in-out) infinite alternate; }
.is-running .ab-cloud-2 { animation-duration: 13s; animation-delay: -4s; }
.is-running .ab-motes circle { animation: ab-mote 6s linear infinite; }
.ab-motes circle:nth-child(2) { animation-delay: -1.2s !important; }
.ab-motes circle:nth-child(3) { animation-delay: -2.4s !important; }
.ab-motes circle:nth-child(4) { animation-delay: -3.6s !important; }
.ab-motes circle:nth-child(5) { animation-delay: -4.8s !important; }
.is-running .ab-drops circle { animation: ab-drip 0.9s linear infinite; }
.ab-drops circle:nth-child(2) { animation-delay: -0.3s !important; }
.ab-drops circle:nth-child(3) { animation-delay: -0.6s !important; }

/* A part in the key shows in both drawings: everything else steps back. Opacity only. */
.ab-stage [data-part] { transition: opacity 220ms ease; }
.ab-board:not([data-hl="0"]) .ab-stage [data-part] { opacity: 0.16; }
.ab-board[data-hl="1"] .ab-stage [data-part="1"], .ab-board[data-hl="2"] .ab-stage [data-part="2"], .ab-board[data-hl="3"] .ab-stage [data-part="3"],
.ab-board[data-hl="4"] .ab-stage [data-part="4"], .ab-board[data-hl="5"] .ab-stage [data-part="5"] { opacity: 1; }
.ab-board[data-hl="1"] .ab-call[data-part="1"] circle, .ab-board[data-hl="2"] .ab-call[data-part="2"] circle, .ab-board[data-hl="3"] .ab-call[data-part="3"] circle,
.ab-board[data-hl="4"] .ab-call[data-part="4"] circle, .ab-board[data-hl="5"] .ab-call[data-part="5"] circle { fill: var(--mustard) !important; }

/* ---------- The key: one ruled strip, five parts, then and now ---------- */
.ab-parts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 30px; border: var(--line) solid var(--ink); border-radius: var(--r-md); background: var(--white); box-shadow: 0 6px 0 var(--ink); overflow: hidden; }
.ab-parts li + li { border-left: 1.5px solid var(--ink); }
.ab-part { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 10px; align-content: start; width: 100%; height: 100%; padding: 16px 16px 18px; border: 0; background: none; font: inherit; text-align: left; color: var(--ink); cursor: pointer; transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.ab-n { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); background: var(--white); font-weight: 800; font-size: 0.82rem; transition: background-color 150ms ease; }
.ab-then { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); text-decoration: line-through; text-decoration-color: rgba(179, 67, 43, 0.55); text-decoration-thickness: 2px; }
.ab-now { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.ab-d { grid-column: 2; margin-top: 6px; font-size: 0.88rem; line-height: 1.45; color: var(--ink-soft); }
.ab-part[aria-pressed="true"], .ab-board[data-hl="1"] .ab-part[data-n="1"], .ab-board[data-hl="2"] .ab-part[data-n="2"], .ab-board[data-hl="3"] .ab-part[data-n="3"], .ab-board[data-hl="4"] .ab-part[data-n="4"], .ab-board[data-hl="5"] .ab-part[data-n="5"] { background: var(--mustard-wash); }
.ab-part[aria-pressed="true"] .ab-n, .ab-board[data-hl="1"] .ab-part[data-n="1"] .ab-n, .ab-board[data-hl="2"] .ab-part[data-n="2"] .ab-n, .ab-board[data-hl="3"] .ab-part[data-n="3"] .ab-n, .ab-board[data-hl="4"] .ab-part[data-n="4"] .ab-n, .ab-board[data-hl="5"] .ab-part[data-n="5"] .ab-n { background: var(--mustard); }

/* ---------- The team ---------- */
.ab-team { padding-top: clamp(40px, 6vw, 88px); }
.ab-team-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(28px, 4.5vw, 64px); align-items: center; }
.ab-team-lead { margin-top: 18px; max-width: 34em; }
.ab-title-sm { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
.ab-shop figcaption { grid-template-columns: auto minmax(0, 1fr) auto; }
.ab-shop .ab-pause { min-height: 36px; padding: 4px 12px 4px 9px; font-size: 0.82rem; }
.ab-shop-svg image { pointer-events: none; }

/*
  The three points. Each bullet is a small mustard gear in the page's ink
  line, kin to the one that rolls out the line under "mill". It is one text
  line tall and sits level with the lower-case letters of its heading's first
  line: the heading's line box centres on the capitals, so the gear drops by
  half the difference between cap height and x-height (0.115em in Fraunces). On first view
  each one rolls into place from the left (three teeth of turn for the
  distance it travels), 70ms after the last, and its words follow. Pointing
  at a point turns its gear on by one tooth.
*/
.ab-marks { --mark: 24px; --h: 1.15rem; display: grid; gap: 20px; margin-top: 28px; }
.ab-marks li { display: grid; grid-template-columns: var(--mark) minmax(0, 1fr); gap: 12px; align-items: start; }
.ab-mark { display: block; width: var(--mark); height: var(--mark); margin-top: calc((var(--h) * 1.25 - var(--mark)) / 2 + var(--h) * 0.115); overflow: visible; }
.ab-mark path { stroke-width: 1.5px; }
.ab-mark circle { stroke: none; }
.ab-marks h3 { font-size: var(--h); line-height: 1.25; }
.ab-marks p { margin-top: 4px; font-size: 0.97rem; line-height: 1.5; color: var(--ink-soft); }
html.ms-motion .ab-marks-in.is-waiting .ab-mark { opacity: 0; transform: translateX(-23px) rotate(-135deg); }
html.ms-motion .ab-marks-in.is-waiting li > div { opacity: 0; transform: translateY(8px); }
.ab-marks-in.is-in .ab-mark { transition: transform 520ms var(--ease-out), opacity 160ms ease; transition-delay: calc(var(--i) * 70ms + 60ms); }
.ab-marks-in.is-in li > div { transition: transform 380ms var(--ease-out), opacity 300ms ease; transition-delay: calc(var(--i) * 70ms + 120ms); }
@media (hover: hover) {
  html.ms-motion .ab-mark-g { transition: transform 420ms var(--ease-out); }
  html.ms-motion .ab-marks li:hover .ab-mark-g { transform: rotate(45deg); }
}

/* ---------- The shadow board ---------- */
.ab-board-head { margin-top: clamp(48px, 7vw, 96px); max-width: 44em; }
.ab-board-lead { margin-top: 12px; color: var(--ink-soft); }
.ab-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 26px; padding: clamp(14px, 2vw, 22px);
  border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 8px 0 var(--ink);
  background-color: var(--mustard-wash);
  background-image: radial-gradient(circle, rgba(34, 50, 44, 0.28) 2.2px, transparent 2.6px);
  background-size: 22px 22px; background-position: 11px 11px; }
.ab-tool { display: grid; grid-template-rows: auto auto 1fr; }
.ab-tool-art { padding: 6px 10px 0; }
.ab-tool-art svg { display: block; width: 100%; height: auto; overflow: visible; }
/*
  The painted outline behind each tool: one flat coat of mustard paint, the
  tool's own shape and a little wider, so it shows as a rim while the tool
  hangs there and as the whole outline when the tool is lifted off. It is
  paint on the board, not a cast shadow: every part is the same solid colour
  (nothing see-through to pile up where shapes overlap) and it never moves.
*/
.ab-tools { --paint: #eec566; --paint: color-mix(in srgb, var(--mustard) 55%, var(--mustard-wash)); }
.ab-tools .ab-tool-shadow :is(path, rect, circle) { fill: var(--paint) !important; stroke: var(--paint) !important; stroke-width: 8px !important; }
.ab-tools .ab-tool-shadow .nofill { fill: none !important; stroke-width: 11px !important; }
.ab-tool-it { transform-box: view-box; transform-origin: 60px 6px; transition: transform 220ms var(--ease-out); }
.ab-tool h3, .ab-tool p { position: relative; }
.ab-tool > h3 { margin-top: 8px; padding: 10px 14px 0; border: 2px solid var(--ink); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--white); font-size: 1.05rem; line-height: 1.25; }
.ab-tool > p { padding: 4px 14px 14px; border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--white); font-size: 0.9rem; line-height: 1.45; color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) {
  /* Pointed at, a tool comes straight up off its outline with a small tilt, as if lifted from the peg. */
  .ab-tool:hover .ab-tool-it { transform: translateY(-8px) rotate(-4deg); }
}
/* First view: the board is bare outlines, then each tool is hung on its peg, 40ms apart, with a small swing as it settles. */
@keyframes ab-hang { 0% { transform: translateY(-22px) rotate(0); opacity: 0; } 40% { opacity: 1; } 60% { transform: translateY(0) rotate(4deg); } 82% { transform: rotate(-1.5deg); } 100% { transform: none; } }
html.ms-motion .ab-hang-in.is-waiting .ab-tool-it { opacity: 0; }
.ab-hang-in.is-in .ab-tool-it { animation: ab-hang 600ms var(--ease-out) backwards; animation-delay: calc(var(--i) * 40ms + 60ms); }

@media (max-width: 1100px) {
  .ab-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-parts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ab-parts li + li { border-left: 0; }
  .ab-parts li { border-bottom: 1.5px solid var(--ink); }
  .ab-parts li:not(:nth-child(3n + 1)) { border-left: 1.5px solid var(--ink); }
}
@media (max-width: 900px) {
  .ab-hero-grid, .ab-stages, .ab-team-grid { grid-template-columns: minmax(0, 1fr); }
  .ab-parts { grid-template-columns: minmax(0, 1fr); }
  .ab-parts li:not(:nth-child(3n + 1)) { border-left: 0; }
  .ab-parts li:last-child { border-bottom: 0; }
}
@media (max-width: 560px) { .ab-tools { grid-template-columns: minmax(0, 1fr); } .ab-shop figcaption { grid-template-columns: minmax(0, 1fr); } .ab-shop .ab-pause { justify-self: start; } .ab-plate figcaption { grid-template-columns: minmax(0, 1fr); gap: 8px; } .ab-era { justify-self: start; } }

/* ---------- Motion: each part rises in once ---------- */

html.ms-motion .ms-page [data-reveal],
html.ms-motion .ms-page [data-once] { transition: opacity 0.38s var(--ease-out), transform 0.38s var(--ease-out); transition-delay: var(--d, 0ms); }
html.ms-motion .ms-page [data-reveal]:not(.is-in),
html.ms-motion .ms-page [data-once]:not(.is-in) { opacity: 0; transform: translateY(12px); }
/* A missing script must never leave the page unreadable. */
html.ms-motion:not(.ms-live) .ms-page :is([data-reveal], [data-once]) { animation: ms-failsafe 0s 2.5s forwards; }
@keyframes ms-failsafe { to { opacity: 1; transform: none; } }

/* Reduced motion: fewer and gentler, not none. Fades and colour changes stay; movement and loops go. */
@media (prefers-reduced-motion: reduce) {
  .ms-page *, .ms-page *::before, .ms-page *::after { transition-property: opacity, color, background-color, border-color, fill !important; animation: none !important; scroll-behavior: auto !important; }
}
