/* ==========================================================================
   about.css — About page (spec: docs/about-spec.md, wireframe: docs/about-wireframe.html)
   Step 1: static layout. Same grid, tokens and fonts as the home; no motion yet.

   Scale: the site's 1em is `.body { font-size: var(--size-font) }`, not the <html> size.
   --size-font is root-agnostic (vw and px only), so spacing can be derived from it and
   still mean the same thing inside an element that has its own font-size.
   Type roles are written in em for desktop (same values as the wireframe, whose root is
   0.8333vw = the site's desktop scale). Tablet and mobile are converted: the wireframe
   uses its own root there (1.15vw tablet, 4.1vw mobile) while the site's root differs.
   ========================================================================== */

:root {
  --about-pad: calc(
    2 * var(--size-font)
  ); /* = --container-padding, but in a unit that does not depend on the element */
  --about-cols: 12;
  --about-col: calc((100vw - 2 * var(--about-pad)) / var(--about-cols));
  --about-line: color-mix(in srgb, var(--dark-brown) 9%, transparent);
  --about-tile: color-mix(in srgb, var(--dark-brown) 7%, var(--sand));
  --about-k: 1;

  --about-display: 7.2em;
  --about-statement: 4em;
  --about-title: 3.2em;
  --about-body: 1.3em;
  --about-label: 1em;
  --about-logo: 1.9em;
}

/* Tablet 768–991: the site root is 1.92vw, the wireframe's tablet root 1.15vw (x0.6) */
@media screen and (min-width: 768px) and (max-width: 991px) {
  :root {
    --about-display: 3.6em;
    --about-statement: 2.04em;
    --about-title: 1.68em;
    --about-body: max(14px, 0.81em);
    --about-label: max(10px, 0.6em);
    --about-logo: 1.15em;
  }
}

/* Mobile ≤767: 6 columns. 480–767 the site root is 2.9vw, the wireframe's 4.1vw (x1.414); ≤479 they match */
@media screen and (max-width: 767px) {
  :root {
    --about-cols: 6;
    --about-display: calc(2.65em * var(--about-k));
    --about-statement: calc(1.95em * var(--about-k));
    --about-title: calc(1.9em * var(--about-k));
    --about-body: calc(1em * var(--about-k));
    --about-label: max(10px, calc(0.72em * var(--about-k)));
    --about-logo: calc(1.15em * var(--about-k));
  }
}

@media screen and (min-width: 480px) and (max-width: 767px) {
  :root {
    --about-k: 1.414;
  }
}

/* --- Shared ------------------------------------------------------------- */

.about-section {
  position: relative;
  padding-block: 18vh;
}

@media screen and (max-width: 767px) {
  .about-section {
    padding-block: 14vh;
  }
}

/* The column lines come from the shell (.transition__lines, fixed, shared with the home): the page must not
   draw its own, or they show twice and drift apart when the menu slides the page. */
.about-section > * {
  position: relative;
  z-index: 1;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(var(--about-cols), minmax(0, 1fr));
  padding-inline: var(--about-pad);
}

.about-label {
  font-family: "Office Code Pro", monospace;
  font-size: var(--about-label);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}

.about-label__num {
  margin-right: 0.9em;
  opacity: 0.66; /* same as .home-label__num: 4.5:1 */
}

.about-label--muted {
  opacity: 0.65;
}

.about-display,
.about-statement,
.about-title {
  margin: 0;
  font-weight: 400;
  text-wrap: pretty;
}

.about-display {
  font-size: var(--about-display);
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.about-statement {
  font-size: var(--about-statement);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.about-title {
  font-size: var(--about-title);
  letter-spacing: -0.045em;
  line-height: 1;
}

.about-body {
  margin: 0;
  font-size: var(--about-body);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Placeholder image (dark block with a soft light and a label) */
.about-frame {
  position: relative;
  overflow: hidden;
  background-color: var(--dark-brown);
}

.about-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0.9em;
  color: color-mix(in srgb, var(--sand) 72%, transparent);
}

.about-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      60% 55% at 50% 38%,
      rgb(255 255 255 / 16%),
      transparent 70%
    ),
    radial-gradient(70% 45% at 50% 105%, rgb(0 0 0 / 55%), transparent 70%);
}

.about-ph > * {
  position: relative;
}

/* --- 01 Profile --------------------------------------------------------- */

.about-hero {
  padding-block: 20vh 16vh;
}

.about-hero__row {
  align-items: end;
}

.about-hero__portrait {
  grid-column: 4 / 6;
}

.about-hero__portrait .about-frame {
  aspect-ratio: 4 / 5;
}

/* The photo fills its 4:5 frame; the face sits in the upper half, so the crop trims the bottom */
.about-frame__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

/* Two slices, each one grid column wide (the frame is exactly two columns), cover the photo until it is revealed */
.about-slices {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
}

.about-slices i {
  background-color: var(--sand);
  transform: scaleY(0);
  transform-origin: 50% 0;
}

.about-hero__caption {
  grid-column: 6 / 8;
  align-self: end;
  padding-left: 0.9em;
}

.about-hero__statement-row {
  margin-top: 1.6vh;
}

.about-hero__statement {
  grid-column: 1 / -1;
  text-indent: calc(3 * var(--about-col));
}

@media screen and (max-width: 767px) {
  .about-hero__portrait {
    grid-column: 3 / 5;
  }

  .about-hero__caption {
    grid-column: 5 / 7;
  }

  .about-hero__statement {
    text-indent: calc(2 * var(--about-col));
  }
}

/* --- 02 Approach -------------------------------------------------------- */

.about-approach__label {
  grid-column: 1 / 4;
  position: sticky;
  top: 6em;
  align-self: start;
}

.about-approach__body {
  grid-column: 5 / 13;
}

.about-approach__statement {
  text-indent: calc(2 * var(--about-col));
}

.about-mark {
  position: relative;
  display: inline-block;
  isolation: isolate;
  text-indent: 0;
  white-space: nowrap;
}

/* underline-04: short and dense, it holds up under a short word at Statement size. A hairline of stroke adds the
   weight it loses at this scale. Shared styles: .mz-underline (shell.css). */
.about-mark .mz-underline {
  --underline-weight: 1px;
  left: -15%;
  top: calc(100% - 0.05em);
  width: 135%;
}

.about-facts {
  margin: 9vh 0 0;
  padding: 0;
  list-style: none;
}

.about-facts__row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 1.05em;
}

/* --rule is animated by js/reveals.js (0 = not drawn yet, 1 = drawn); without JS the rules are simply there */
.about-facts__row:first-child::before,
.about-facts__row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: currentcolor;
  opacity: 0.25;
  transform: scaleX(var(--rule, 1));
  transform-origin: 0 50%;
}

.about-facts__row:first-child::before {
  top: 0;
}

.about-facts__row::after {
  bottom: 0;
}

@media screen and (max-width: 767px) {
  .about-approach__label {
    grid-column: 1 / -1;
    position: static;
    margin-bottom: 2.5em;
  }

  .about-approach__body {
    grid-column: 1 / -1;
  }
}

/* --- 03 Clients: logo grid on the site grid ------------------------------
   Each cell spans exactly 3 columns, so its edges sit on the visible lines. */

.about-clients__head {
  row-gap: 0;
}

.about-clients__label {
  grid-column: 1 / 4;
}

.about-clients__note {
  grid-column: 5 / 10;
}

.about-logos {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--about-cols), minmax(0, 1fr));
  margin: 6vh 0 0;
  padding: 0 var(--about-pad);
  list-style: none;
}

.about-logos::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--about-pad);
  right: var(--about-pad);
  height: 1px;
  background-color: var(--about-line);
}

.about-logos__cell {
  position: relative;
  display: grid;
  grid-column: span 3;
  place-items: center;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--about-line);
}

/* The hover fill: the tile tone rises from the bottom (hover states at the end of this block) */
.about-logos__cell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--about-tile);
  clip-path: inset(100% 0 0 0);
}

/* Optical balance: width grows with the square root of the logo's aspect ratio (--r, set per cell),
   so a wide wordmark and a square mark cover about the same area. Capped at 70% of the cell. */
.about-logos__mark {
  width: min(70%, calc(var(--r, 2) * var(--about-logo-base, 22%)));
  margin: 0;
}

/* The logo lifts on hover; the reveal moves the mark itself, so they never fight.
   The SVG is a mask, so it takes the text colour (currentColor) and keeps its grey layers as transparency. */
.about-logos__word {
  display: block;
  width: 100%;
  background-color: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}

/* An odd count leaves the last row with an empty cell: only the lines, no hover */
.about-logos__cell--empty::before {
  display: none;
}

/* A cell with a case is one link, the size of the cell */
.about-logos__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.about-logos__link:focus-visible {
  outline: 2px solid var(--main);
  outline-offset: -2px;
}

/* --meta is 1 unless js/about/logos.js says otherwise: the sector is visible without JS, on touch and on mobile */
.about-logos__sector {
  position: absolute;
  left: 0.9em;
  right: 0.9em;
  bottom: 1.1em;
  text-align: center;
  opacity: 0.5;
}

/* Hover, mouse only, 768px and up: the fill rises, the word lifts and the sector comes up from below.
   Elsewhere the sector is always visible. Keyboard focus on a linked cell gets the same state. */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .about-logos__cell::before {
    transition: clip-path var(--d-smooth) var(--e-smooth);
  }

  .about-logos__word {
    transition: transform var(--d-smooth) var(--e-smooth);
  }

  .about-logos__sector {
    opacity: 0;
    transform: translateY(0.5em);
    transition:
      opacity var(--d-smooth) var(--e-smooth),
      transform var(--d-smooth) var(--e-smooth);
  }

  .about-logos__cell:hover::before,
  .about-logos__cell:focus-within::before {
    clip-path: inset(0 0 0 0);
  }

  .about-logos__cell:hover .about-logos__word,
  .about-logos__cell:focus-within .about-logos__word {
    transform: translateY(-0.35em);
  }

  .about-logos__cell:hover .about-logos__sector,
  .about-logos__cell:focus-within .about-logos__sector {
    opacity: 1;
    transform: none;
  }
}

@media screen and (max-width: 767px) {
  .about-clients__label {
    grid-column: 1 / 4;
  }

  .about-clients__note {
    grid-column: 4 / 7;
  }

  .about-logos__cell {
    aspect-ratio: 1;
  }

  .about-logos__mark {
    width: min(80%, calc(var(--r, 2) * 32%));
  }

  .about-logos__sector {
    left: 0.6em;
    right: 0.6em;
    bottom: 0.7em;
  }
}

/* --- 04 Index ------------------------------------------------------------ */

.about-index {
  padding-top: 6vh;
}

.about-index__label {
  grid-column: 1 / 4;
}

.about-block {
  align-items: start;
  padding-block: 6vh;
}

.about-block__title {
  grid-column: 1 / 5;
  padding-top: 0.1em;
}

.about-block__list {
  grid-column: 5 / 13;
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1em;
  align-items: baseline;
  padding: 1.05em 0.9em;
  isolation: isolate;
}

/* Hover fill, wiped in from the left (mouse only, 768px and up) */
.about-row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--main);
  clip-path: inset(0 100% 0 0);
}

@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .about-row::before {
    transition: clip-path var(--d-smooth) var(--e-smooth);
  }

  .about-row:hover::before {
    clip-path: inset(0 0 0 0);
  }
}

.about-row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background-color: currentcolor;
  opacity: 0.25;
  transform: scaleX(var(--rule, 1));
  transform-origin: 0 50%;
}

.about-row__n {
  font-size: var(--about-label);
  opacity: 0.5;
}

@media screen and (max-width: 767px) {
  .about-block__title {
    grid-column: 1 / -1;
    margin-bottom: 1em;
  }

  .about-block__list {
    grid-column: 1 / -1;
  }
}

/* --- 05 Off the clock -----------------------------------------------------
   Step 1 lays the cards out statically (their resting spots). The velcro board
   with springs replaces this in the motion step.                              */

.about-clock {
  padding-top: 8vh;
}

.about-clock__label {
  grid-column: 1 / 4;
}

.about-clock__hint {
  grid-column: 5 / 9;
}

.about-field {
  position: relative;
  grid-column: 1 / -1;
  height: 78vh;
  margin: 4vh 0 0;
  padding: 0;
  list-style: none;
  z-index: 30;
}

.about-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(2 * var(--about-col));
  padding: 0.55em 0.55em 1.1em;
  background-color: color-mix(in srgb, var(--sand) 92%, white);
  box-shadow: 0 0.15em 0.5em rgb(28 25 23 / 12%);
  transform: translate(-50%, -50%) rotate(var(--r));
}

.about-card .about-frame {
  aspect-ratio: 1;
}

.about-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.about-card .about-label {
  margin-top: 0.8em;
}

.about-card__note {
  display: block;
  margin-top: 0.25em;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.65;
}

/* Elevation shadow driven by the lift spring (--lift 0 = pressed on the board, 1 = in the air) */
.about-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    0 1.4em 2.8em rgb(28 25 23 / 24%),
    0 0.4em 0.9em rgb(28 25 23 / 10%);
  opacity: var(--lift, 0);
}

/* JS takes over: cards are positioned by springs (transform), start hidden and fall in when the board is reached.
   Without JS they stay where the static layout puts them; a failsafe shows that layout if the script never arrives. */
.about-field {
  touch-action: pan-y;
}

.w-mod-js .about-field:not(.is-enhanced) .about-card {
  visibility: hidden;
  animation: about-show 0.01s 2.5s forwards;
}

.about-field.is-enhanced .about-card {
  left: 0;
  top: 0;
  visibility: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.about-field.is-enhanced .about-card.is-live {
  visibility: visible;
}

.about-field.is-enhanced .about-card.is-grabbing {
  cursor: grabbing;
}

.about-card .about-frame,
.about-card .about-label {
  pointer-events: none;
}

.about-card:nth-child(1) {
  --x: 16%;
  --y: 26%;
  --r: -0.08rad;
}
.about-card:nth-child(2) {
  --x: 46%;
  --y: 20%;
  --r: 0.05rad;
}
.about-card:nth-child(3) {
  --x: 80%;
  --y: 28%;
  --r: -0.04rad;
}
.about-card:nth-child(4) {
  --x: 24%;
  --y: 70%;
  --r: 0.07rad;
}
.about-card:nth-child(5) {
  --x: 56%;
  --y: 74%;
  --r: -0.06rad;
}
.about-card:nth-child(6) {
  --x: 86%;
  --y: 68%;
  --r: 0.09rad;
}

@media screen and (min-width: 768px) and (max-width: 991px) {
  .about-card {
    width: calc(2.4 * var(--about-col));
  }
}

@media screen and (max-width: 767px) {
  .about-clock__label {
    grid-column: 1 / 4;
  }

  .about-clock__hint {
    grid-column: 4 / 7;
  }

  .about-field {
    height: 92vh;
  }

  .about-card {
    width: calc(2.6 * var(--about-col));
    padding: 0.4em 0.4em 0.8em;
  }

  .about-card__note {
    display: none;
  }

  .about-card:nth-child(1) {
    --x: 30%;
    --y: 14%;
  }
  .about-card:nth-child(2) {
    --x: 72%;
    --y: 22%;
  }
  .about-card:nth-child(3) {
    --x: 28%;
    --y: 42%;
  }
  .about-card:nth-child(4) {
    --x: 70%;
    --y: 52%;
  }
  .about-card:nth-child(5) {
    --x: 30%;
    --y: 74%;
  }
  .about-card:nth-child(6) {
    --x: 70%;
    --y: 84%;
  }
}

/* --- 06 Contact ---------------------------------------------------------- */

.about-contact {
  padding-block: 16vh 12vh;
}

.about-contact__grid {
  row-gap: 3.5em;
}

.about-contact__label,
.about-contact__statement,
.about-contact__action {
  grid-column: 1 / -1;
}

.about-contact__label {
  grid-column: 1 / 4;
}

.about-email {
  display: inline-flex;
  gap: 0.6em;
  align-items: baseline;
  padding: 0;
  border: 0;
  border-bottom: 2px solid currentcolor;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--about-statement);
  line-height: 1.05;
  letter-spacing: -0.045em;
  cursor: pointer;
}

.about-email .about-label {
  letter-spacing: 0.04em;
}

.about-contact__copied {
  margin-left: 1em;
  opacity: 0;
  transition: opacity 0.3s;
}

.about-contact__copied.is-on {
  opacity: 1;
}

/* --- Entrance states --------------------------------------------------------------------
   Things that start hidden are hidden only while JS is expected to run (.w-mod-js is set in
   the <head>), and a failsafe shows them after 2.5 s in case a script never arrives.         */

@keyframes about-show {
  to {
    visibility: visible;
  }
}

@keyframes about-uncover {
  to {
    transform: scaleY(0);
  }
}

.w-mod-js [data-reveal-lines]:not(.is-ready) {
  visibility: hidden;
  animation: about-show 0.01s 2.5s forwards;
}

.w-mod-js [data-portrait-reveal]:not(.is-ready) .about-slices i {
  transform: scaleY(1);
  animation: about-uncover 0.01s 2.5s forwards;
}

/* The mask must not inherit the hero's text-indent (it would indent each word). */
/* A word in its mask (js/reveals.js). Room below for descenders, taken back so the lines keep their leading. */
/* Room all round for what sticks out of the word's box (negative tracking pushes the last letter past its
   advance; accents rise above the cap height), taken back with negative margins so nothing moves. */
[data-reveal-lines] .reveal-word {
  display: inline-block;
  margin: -0.12em -0.12em -0.18em -0.05em;
  padding: 0.12em 0.12em 0.18em 0.05em;
  overflow: hidden;
  text-indent: 0;
  vertical-align: top;
}

[data-reveal-lines] .reveal-word > span {
  display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
  .w-mod-js [data-reveal-lines]:not(.is-ready),
  .w-mod-js [data-portrait-reveal]:not(.is-ready) .about-slices i {
    animation-delay: 0s;
  }

  /* Hovers become cuts, and nothing moves */
  .about-row::before,
  .about-logos__cell::before,
  .about-logos__word,
  .about-logos__sector {
    transition: none;
  }

  .about-logos__cell:hover .about-logos__word,
  .about-logos__cell:focus-within .about-logos__word {
    transform: none;
  }

  .about-logos__sector {
    transform: none;
  }
}

/* --- 404 (404.html) -------------------------------------------------------------------------
   Same hero setting as About: label, statement with the 3-column indent, one way out.       */
.not-found {
  min-height: 82vh;
}

.not-found__label {
  grid-column: 1 / 4;
  margin: 0 0 6vh;
}

.not-found__action {
  grid-column: 1 / -1;
  margin: 3.5em 0 0;
}

.not-found__action .about-email {
  text-decoration: none;
  color: inherit;
}

/* --- A word with a meaning (js/about/term-tip.js) ---------------------------------------------
   Underlined with dots, like the words you can choose on Contact: it says "touch me". The padding is the tap
   target (about 44px tall on a phone), taken back with margins so the line does not move. */
.about-term {
  margin: -0.7em -0.3em;
  padding: 0.7em 0.3em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: underline dotted 1.5px;
  text-decoration-color: color-mix(in srgb, currentcolor 55%, transparent);
  text-underline-offset: 0.28em;
  cursor: help;
  touch-action: manipulation;
  transition: text-decoration-color var(--d-smooth) var(--e-smooth);
}

.about-term:hover,
.about-term:focus-visible {
  text-decoration-color: var(--main);
}

.about-term:focus-visible {
  outline: 2px solid var(--main);
  outline-offset: 0.05em;
}

/* The card's caption does not take presses (so a card is grabbed from anywhere on it); the word does */
.about-card .about-term {
  pointer-events: auto;
}

/* The box: paper, a hairline, a light shadow, mono, as the hover tag of the cases */
.term-tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 66;
  padding: 0.55em 0.8em;
  border: 1px solid color-mix(in srgb, var(--dark-brown) 22%, var(--sand));
  background-color: var(--sand);
  color: var(--dark-brown);
  box-shadow: 0 0.4em 1em color-mix(in srgb, var(--dark-brown) 12%, transparent);
  font: 400 max(11px, 0.82rem) / 1.3 "Office Code Pro", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

/* The notch points at the word: a square turned 45 degrees on the box's edge */
.term-tip__notch {
  position: absolute;
  left: var(--notch, 50%);
  bottom: -5px;
  width: 8px;
  height: 8px;
  border: solid color-mix(in srgb, var(--dark-brown) 22%, var(--sand));
  border-width: 0 1px 1px 0;
  background-color: var(--sand);
  transform: translateX(-50%) rotate(45deg);
}

.term-tip.is-below .term-tip__notch {
  top: -5px;
  bottom: auto;
  border-width: 1px 0 0 1px;
}
