/* ==========================================================================
   usual.red — blocks: case head, blocks, vector art, text blocks, the
   typing block, the word flower, About photo, the Clay Pet adoption page.

   A block lies straight on the page, no frame (Figma 3732:2670, 3750:1279):
   its copy — title in .ts-title, text in .ts-quiet — and its media, 12px
   apart. Every image and video is rounded --r-media and lifted by a soft
   shadow. A project (a block with years) shows its media first and stands
   --project-gap from the next one (css/layout.css).
   ========================================================================== */

/* ---- loading (js/loader.js, js/lqip.js) ----
   A block — in a column or in a wide row (.wide) — waits invisible in its
   reserved space until it and everything above it in its column has
   loaded and its turn comes, wherever the screen is, then comes in quickly
   (--intro), its text like all text on the site, from --intro-blur. Its
   images and videos (and the typing block's plate) come in from
   --reveal-blur, the blur spilling past their edges: over --reveal while
   their file downloads, following it (--load, js/lqip.js), or twice as
   fast (--reveal-loaded) with nothing left to load. */

:is(.col, .wide) > * {
  transition: opacity var(--intro) ease, visibility 0s;
}

:is(.col, .wide) > .is-pending {
  opacity: 0;
  visibility: hidden;
}

/* The text in a block. */
:is(.col, .wide) > * :is(h3, p) {
  transition: filter var(--intro) ease;
}

:is(.col, .wide) > .is-pending :is(h3, p) {
  filter: blur(var(--intro-blur));
}

/* Media: in a block, the About photo. An inverted one keeps its invert in
   front (--invert), so the blur comes and goes smoothly. */
:is(.col, .wide) .block__media,
.about .lqip {
  transition: opacity var(--reveal-loaded) ease, filter var(--reveal-loaded) ease, visibility 0s;
}

:is(.col, .wide) .block__media.is-fetching,
.about .lqip.is-fetching {
  transition: opacity var(--reveal) ease, filter var(--reveal) ease, visibility 0s;
  filter: var(--invert,) blur(calc(var(--reveal-blur) * (1 - var(--load, 0))));
}

/* Vector art keeps its shadow (--vector) behind the blur, so the two
   lists match and the blur still eases away. */
:is(.col, .wide) > .is-pending .block__media {
  filter: var(--invert,) blur(var(--reveal-blur)) var(--vector,);
}

@media (prefers-reduced-motion: reduce) {
  :is(.col, .wide) > *,
  :is(.col, .wide) > * :is(h3, p),
  :is(.col, .wide) .block__media,
  .about .lqip,
  :is(.col, .wide) .block__media.is-fetching,
  .about .lqip.is-fetching {
    transition: none;
  }
}

/* ---- case head: tagline over the case links ----
   Spacing and ink как было: links 4px under the tagline (old .btn-row). */

.head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.head__tagline {
  font: var(--type-base);
  color: var(--ink-text);
}

.links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
}

/* ---- block ----
   Copy and media 12px apart, either way round. */

.block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The copy: title, paragraphs, links, note. Title 4px over the copy,
   paragraphs and the note 8px apart, links 4px under the copy. */
.block__text > * + * {
  margin-top: 8px;
}

.block__title + * {
  margin-top: 4px;
}

.block__links {
  margin-top: 4px;
}

/* Titles show as written in data.js (.ts-title): a capital first letter,
   file names (idle.md) as they are. */

/* The years after a title: a micro comment --note-gap after it, on the top
   of its line, as the notes in About. */
.block__years {
  margin-left: var(--note-gap);
}

/* Old .t-muted: fainter and 1px smaller than the copy around it. */
.block__note {
  font-size: 19px;
  color: var(--ink-faint);
}

.block__links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
}

/* A line break inside a paragraph (the old <br>) is a "\n" in data.js. */
.block__text p,
.text p {
  white-space: pre-line;
}

/* ---- media in a block ----
   Rounded, on a soft shadow, on white: transparent art (svg wordmarks,
   cut-out pngs) shows on the plate it was drawn for. */

.block__media {
  width: 100%;
  height: auto;
  border-radius: var(--r-media);
  object-fit: cover;
  box-shadow: var(--shadow-tile);
  background: var(--media-bg);
}

/* White-on-transparent art drawn for the old dark theme (raw abo.svg).
   Inverted, как было; `invert: true` in data.js. Its plate is black, so the
   invert turns it white too. */
.block__media--invert {
  --invert: invert(1);
  filter: var(--invert);
  background: #000000;
}

/* Vector art exported from Figma (`vector: true`; the Clay Pet adoption
   page): no plate and no frame, the shapes themselves on the page, the
   shadow right under them (--shadow-vector) instead of under a tile. */
.block__media--vector {
  --vector: drop-shadow(var(--shadow-vector));
  filter: var(--invert,) blur(0px) var(--vector);
  background: none;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}

/* Paired media on one line (fire front, bot works), как было. Each keeps
   its own aspect ratio and the pair top-aligns. */
.block__row {
  display: flex;
  align-items: flex-start;
  gap: var(--media-gap);
}

.block__row .block__media {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

/* ---- text block: paragraphs 8px apart, как было ---- */

.text p + p {
  margin-top: 8px;
}

/* A quiet line under the cards (`quiet: true`): the old .t-muted. */
.text--quiet {
  font: var(--type-base);
  font-size: 19px;
  color: var(--ink-faint);
}

/* ---- typing block (js/typer.js; obr var, Figma 3853:1512) ----
   A plate in a block, as an image is (.block__media: rounded, on the soft
   shadow, and coming in from the same blur, css above), but in --typer-bg
   and --typer-h tall (css/base.css: in proportion to its width, taller on
   a phone); the field across it in .ts-obr, 9px in on a 102px plate, its
   letters, caret and selection in --typer-ink. The text grows from the
   middle; longer than the field, it scrolls in it. The font's letters sit
   low in its line: 0.2em under the field lifts them to the plate's middle,
   12px from top and bottom at 96px (as in Figma). Until the visitor is in
   it, an empty field types its prompt to itself in the same place, letter
   by letter, over and over (js/typer.js); a click or tap takes it away,
   and the caret blinks in its place. */

.typer {
  position: relative;
  height: var(--typer-h);
  background: var(--typer-bg);
  overflow: hidden;
}

.typer__field {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 calc(var(--typer-h) * 9 / 102) 0.2em;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  text-align: center;
  color: var(--typer-ink);
  caret-color: var(--typer-ink);
  -webkit-appearance: none;
  appearance: none;
}

/* The field's placeholder is a space, only so :placeholder-shown tells an
   empty field; the prompt is set over it, where the field's own text would
   be (.ts-obr, the same paddings), and takes no clicks. */
.typer__prompt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--typer-h) * 9 / 102) 0.2em;
  color: var(--typer-ink);
  white-space: pre;
  pointer-events: none;
}

.typer__field:focus + .typer__prompt,
.typer__field:not(:placeholder-shown) + .typer__prompt {
  visibility: hidden;
}

.typer__field::selection {
  background: var(--typer-ink);
  color: var(--typer-bg);
}

/* ---- word flower (js/flower.js; raw, "Random flower") ----
   A square plate in a block, as an image is (.block__media: rounded, on the
   soft shadow, coming in from the same blur), in --flower-bg; the canvas
   fills it and takes clicks. While the words are changed, two fields lie
   over the canvas where the words are drawn (js/flower.js gives them their
   place and size), in Arial Narrow and --flower-ink, the caret in
   --flower-rows; focused already but unseen while the letters are still
   coming down (.is-returning). */

.flower {
  position: relative;
  aspect-ratio: 1;
  background: var(--flower-bg);
  overflow: hidden;
}

.flower__canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.flower.is-editing .flower__canvas {
  cursor: default;
}

.flower__canvas:focus {
  outline: none;
}

.flower__canvas:focus-visible {
  outline: var(--deco) solid var(--flower-ink);
  outline-offset: calc(-1 * var(--r-media));
}

.flower__field {
  position: absolute;
  left: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-arial-narrow);
  font-weight: 400;
  font-style: normal;
  text-align: center;
  color: var(--flower-ink);
  caret-color: var(--flower-rows);
  -webkit-appearance: none;
  appearance: none;
}

.flower:not(.is-editing) .flower__field {
  visibility: hidden;
}

.flower__field::selection {
  background: var(--flower-rows);
  color: var(--flower-bg);
}

.flower.is-returning .flower__field {
  color: transparent;
  caret-color: transparent;
}

.flower.is-returning .flower__field::selection {
  background: transparent;
  color: transparent;
}

/* ---- a block's hint (js/render.js; raw's flower, obr var's typing block) ----
   A micro comment (.ts-micro, hint: in data.js) right over the plate it
   tells about, 4px above it: the least of the block's gaps, as a title
   over its copy. It stays put while the plate is in use. */

.block__hinted {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- blurred placeholder (scripts/lqip.mjs, js/lqip.js) ----
   A frame (the About photo, a block's media) around an image or a
   video, with its tiny copy (--lqip, in the page or pages/lqip.js) blown up
   and blurred under it; the media waits unseen (.is-loading) until it has
   arrived and fades in over it. The frame takes the media's classes. */

.lqip {
  display: block;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: opacity var(--reveal) ease, filter var(--reveal) ease, visibility 0s;
}

.lqip::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--lqip) center / cover no-repeat;
  filter: blur(var(--lqip-blur));
  transform: scale(1.15); /* the blur's soft rim stays outside the frame */
  /* Goes once the media is in (.is-sharp), after its fade, so nothing shows
     through between them — nor later through a transparent image. */
  transition: opacity var(--lqip-out) ease var(--lqip-fade);
}

/* Art with its own border (edge: in data.js): a line just inside the frame
   in the border's colour (--media-edge-color, set by js/render.js),
   --media-edge-thick, so the rounded corners seem to be the art's own. An
   inset shadow on a layer above the picture, following the corners. */
.lqip.block__media--edge::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 var(--media-edge-thick) var(--media-edge-color);
  pointer-events: none;
}

.lqip.is-sharp::before {
  opacity: 0;
}

.lqip > img,
.lqip > video {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity var(--lqip-fade) ease, filter var(--lqip-fade) ease;
}

/* Waiting, the media is the placeholder's twin: clear and as blurred, so it
   takes over from it seamlessly. */
.lqip > .is-loading {
  opacity: 0;
  filter: blur(var(--lqip-blur));
}

/* A frame outside the columns (the About photo) rests fully blurred from
   the page's markup until js/lqip.js takes it over, as a block's media in a
   column does (.is-pending): its blur only ever lifts. Its block waits
   unseen in the queue until the placeholder can be drawn (js/loader.js). */
.lqip.is-waiting {
  filter: blur(var(--reveal-blur));
}

/* Media downloaded earlier in the visit come in without the fade. */
.lqip.is-instant::before,
.lqip.is-instant > img,
.lqip.is-instant > video {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .lqip,
  .lqip::before,
  .lqip > img,
  .lqip > video {
    transition: none;
  }
}

/* ==========================================================================
   About — under the common header, lined up with the
   first column of the case pages (Figma 3455:4190 web, 3554:5111 mobile).
   ========================================================================== */

.about {
  width: var(--frame);
  margin: var(--after-list) auto 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* The photo: rounded and lifted like every image in a case, turned −2°, and
   that much smaller, so that turned it is no wider than its place: the box
   round it turned is as wide as the photo was (--photo-ratio, its height
   over its width: 1782 / 1200 in About). The Clay Pet adoption page has
   one the same way. Its block comes in as a block in a column does, only
   fading in: the blur is its frame's, not the text's own. */
.about .photo {
  --photo-turn: 2deg;
  --photo-ratio: calc(1782 / 1200);
  width: 196px;
  rotate: calc(-1 * var(--photo-turn));
  scale: calc(1 / (cos(var(--photo-turn)) + var(--photo-ratio) * sin(var(--photo-turn))));
}

.about > .photo.is-intro {
  animation-name: photo-in;
}

@keyframes photo-in {
  from {
    opacity: 0;
  }
}

/* Contact links, level, one per line every 40px, stepping in by 11 / 23 /
   12px (Figma 3613:949). Each line is a row: the link keeps its size, the
   comment takes what is left of the line and wraps in it on a phone. Their
   size is the common link style (33px lines), so the gap makes up the
   rest. */
.about__links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.about__links li {
  display: flex;
  align-items: flex-start;
}

.about__links .ts-link {
  flex: none;
}

.about__links li:nth-child(2) {
  transform: translateX(11px);
}

.about__links li:nth-child(3) {
  transform: translateX(23px);
}

.about__links li:nth-child(4) {
  margin-left: 12px;
}

/* LinkedIn holds a 155px slot, so cv lands where Figma puts it. */
.about__pair {
  display: inline-block;
  min-width: 155px;
}

/* Micro comments hung on the top of a line, --note-gap after the name and
   after each contact link. */
.about__note {
  margin-left: var(--note-gap);
}


/* ==========================================================================
   Clay Pet: how to adopt one — index/clay.pet/adopt.html (Figma 3883:1728,
   drawn for a phone). Laid out as About is (.about): one column under the
   common header, no grid, its lines broken as About's are — on the web
   long, a paragraph split where a .br-web says, on a phone wherever the
   column ends (the .br-web hidden). Its first line and links are a case's
   (.head: the tagline's grey, --ink-text); the rest is About's: copy in
   .ts-quiet with red marks, a photo turned as About's, About's contact
   links; new are the price tag (.block__media--vector) and New homes at
   the bottom (.homes). Its pieces stand --stack apart as About's do, the lines
   of one piece run on without a gap, and two pieces start a new part
   (.adopt__break: "So inside you will find ↴" and New homes) one --stack
   further down (Figma: 29 and 24px). */

/* "More about Clay Pet" and Clay Pet in the page's own menu light each
   other: either one hovered, both glow (css/base.css); the sheet's list
   stays as it is. */
.case__page:has(.adopt a[href="/index/clay.pet"]:hover) > .top .item[data-id="clay.pet"] > .item__name,
.case__page:has(> .top .item[data-id="clay.pet"] > .item__name:hover) .adopt a[href="/index/clay.pet"] {
  color: var(--ink-lit);
  text-shadow: 0 0 var(--glow-blur) var(--glow);
  transition-duration: var(--glow-fade);
}

/* Lying down, as wide as New homes at the bottom (.homes): 369px on the
   web; on a phone it fills the column between the gutters, as About's
   does. Turned, its box is that wide. */
.adopt .photo {
  --photo-ratio: calc(1280 / 1920);
  width: 369px;
}

.adopt__break {
  margin-top: var(--stack);
}

/* What is in the box: each line hangs on a ↳ (lists have no marks
   elsewhere, css/base.css), grey as the text is; a line that wraps goes on
   under its text, not under the arrow. */
.adopt__break ul {
  list-style: "↳ ";
  padding-left: 1.25em;
}

/* "price is →" with the price tag it points at, --note-gap apart, on one
   bottom line. The tag at its Figma size: an SVG saved from Illustrator has
   no size of its own, only its proportions. */
.adopt__price {
  display: flex;
  align-items: flex-end;
  gap: var(--note-gap);
}

.adopt__price > .block__media--vector {
  width: 101px;
}

/* New homes, at the bottom (Figma 3883:1728: logo.svg and the five pieces
   by it): the logo, two round photos over it, an arrow from "New homes" to
   each. One piece, its parts placed by Figma's own numbers on its 369 × 357
   box (--u: one Figma px), so all of it scales as one, the words too: on
   the web as wide as the logo alone was, 369px; on a phone the full width
   between the gutters (below). */
.homes {
  --u: calc(100cqw / 369);
  container-type: inline-size;
  position: relative;
  width: 369px;
  aspect-ratio: 369 / 357;
}

.homes > * {
  position: absolute;
}

.homes > .homes__logo {
  left: calc(7 * var(--u));
  top: 0;
  width: calc(284 * var(--u));
}

/* Round, on the shadow every image has, cut from the middle of the
   picture. (The logo keeps its own, --shadow-vector.) */
.homes > .homes__photo {
  width: calc(154 * var(--u));
  border-radius: 50%;
  box-shadow: var(--shadow-tile);
}

.homes__photo > :is(img, video) {
  height: 100%;
  object-fit: cover;
}

.homes__photo--house {
  left: 0;
  top: calc(202 * var(--u));
  aspect-ratio: 154 / 155;
}

.homes__photo--sill {
  left: calc(215 * var(--u));
  top: calc(148 * var(--u));
  aspect-ratio: 1;
}

/* The video (home-2.webm) comes already cut round, on white: a touch
   larger than its frame, so no white shows at the rim. */
.homes__photo--sill > video {
  scale: 1.03;
}

.homes__arrows {
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--ink);
  pointer-events: none;
}

.homes__caption {
  left: calc(263 * var(--u));
  top: calc(337 * var(--u));
  font: 400 calc(20 * var(--u)) / 1 var(--font-arial);
  color: var(--ink);
  white-space: nowrap;
}

/* ==========================================================================
   A bare page (js/site.js): in no list, without header or sheet, opened
   only by a direct link. Laid out as About is (.about): one column, its
   pieces --stack apart, copy in .ts-quiet, the photo turned as About's.
   On the web its lines run to 523px (Figma's widest box but one, so a
   short quote keeps to one line); the photo is 429px wide. On a phone, all
   of it between the gutters, as About.

   The photo is the page's first piece and stands in the middle of the
   screen, top to bottom, as the page opens: the page starts half a screen
   down less half the photo (--photo-w × its ratio). svh: the screen as it
   is with the browser's bars out, as a page opens on a phone. Never less
   than four gutters, so a short screen still has room for Instagram, which
   hangs --stack above the photo and takes no place of its own.
   ========================================================================== */

.about.bare {
  --photo-w: 429px;
  --photo-h: calc(var(--photo-w) * 889 / 964);
  position: relative;
  margin-top: max(calc(4 * var(--gutter)), calc(50vh - var(--photo-h) / 2));
  margin-top: max(calc(4 * var(--gutter)), calc(50svh - var(--photo-h) / 2));
}

.bare > :not(.photo) {
  max-width: 523px;
}

/* The drawing at the end (Figma 3993:1957): vector art at its Figma size,
   131px, as the adoption page's price tag (.block__media--vector); a new
   part, one --stack further down. */
.bare__sign {
  width: 131px;
  height: auto;
  margin-top: var(--stack);
}

/* Instagram, with its micro comment on the top of the line as About's,
   over the photo. */
.bare__link {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--stack));
  display: flex;
  align-items: flex-start;
}

/* The photo lies down: its own ratio (in --photo-h too), turned −2° as
   About's, the same scale keeping the turned box as wide as the column. */
.bare .photo {
  --photo-ratio: calc(889 / 964);
  width: var(--photo-w);
}

/* Who said it: in bold italic after the line, --note-gap away, never split
   across lines. Its colour is .ts-mark's. */
.bare__by {
  margin-left: var(--note-gap);
  white-space: nowrap;
  font-weight: 700;
  font-style: italic;
}

/* ==========================================================================
   404 —Figma "404" (3780:4017). An ordinary page under the common header:
   "(404)" and its line sit --after-list below the list as on every other
   page, on the frame's left edge with the names in the list, 4px apart;
   the scheme (an SVG drawn by hand, its words set in .ts-highlight) 48px
   under them, 24px in from the left edge of the frame. Nothing hangs on
   the screen's height (which iOS Safari changes as its toolbar folds); the
   standard sheet follows.
   ========================================================================== */

.notfound__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: var(--after-list) 0 0;
}

.notfound__scheme {
  display: block;
  overflow: visible;
  margin: 48px 0 0 24px;
}

@media (max-width: 768px) {
  .about {
    width: auto;
    margin: var(--after-list) var(--gutter) 0;
  }

  .about.bare {
    --photo-w: calc(100vw - 2 * var(--gutter));
  }

  /* On a phone, the full width between the gutters, as every image. */
  .about .photo {
    width: 100%;
  }

  /* Figma's text boxes are narrower than the column on a phone; the widths
     keep its line breaks. */
  .about__intro {
    max-width: 329px;
  }

  .about__outro {
    max-width: 351px;
  }

  /* A line break the web layout wants and a phone does not. */
  .br-web {
    display: none;
  }

  /* On a phone the links sit 12px in from the copy. */
  .about__links {
    margin-left: 12px;
  }

  .homes {
    width: auto;
    align-self: stretch;
  }
}
