/* returntohuman.now site styles. Loaded after /brand/tokens.css and
   /brand/base.css. Colours, type and spacing come from the tokens; the brand
   files are read-only. */

/* The signature: the Enigma on the left, Re:Human with By Humans, for Humans.
   under it on the right, as one file in assets/ (made from the brand's logo and
   wordmark files and EB Garamond Italic; see tools/make_signature.py). The two
   lines of text span exactly the logo's ink, in the proportions of the brand's
   tagline lockup. Day and Night each have a file, and so does the small cut of
   the logo used below 97px. --sig is the height of the logo. */
.signature { --sig: clamp(64px, min(17vh, 19.5vw), 176px); display: flex; justify-content: center; margin: 0; }
.signature img { height: var(--sig); width: auto; max-width: none; }
/* the signature is the same size on every page: by the window's height, and
   by its width on a narrow screen, so it never runs off the side */
@media (max-height: 820px) { .signature { --sig: clamp(64px, min(15vh, 19.5vw), 176px); } }
@media (max-width: 600px), (max-height: 719px) { .signature { --sig: min(19.5vw, 10svh); } }

/* The plaque: writing set on a raised tablet of pale clay (clay-wash), lit from
   above. A soft shadow lies under it, its top edge catches the light and its
   bottom edge falls into shade, a line is cut into its face a step inside the
   edge, and the letters sit pressed into the clay. Text is ink, as on any
   wash. The manifesto on the front page sits on one, and so does every piece
   in Discover. The shadows, the light across the face and the see-through
   tints are Alan's exception to the rules (sections 3, 5 and 8), for the
   plaque only. A plaque is a thing on the wall, so it keeps its Day colours
   at night: mark every one data-theme="light". Only its shadow deepens. */
/* the shadow under a plaque follows the page: deeper on a dark one */
:root {
  --plaque-lo: rgb(60 30 15 / 0.16);
  --plaque-cast: rgb(40 20 10 / 0.24);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --plaque-lo: rgb(0 0 0 / 0.4); --plaque-cast: rgb(0 0 0 / 0.6); }
}
[data-theme="dark"] { --plaque-lo: rgb(0 0 0 / 0.4); --plaque-cast: rgb(0 0 0 / 0.6); }
.plaque {
  --plaque-cut: var(--space-2);
  --plaque-face: var(--clay-wash);
  --plaque-lit: color-mix(in srgb, var(--plaque-face), white 14%);
  --plaque-dim: color-mix(in srgb, var(--plaque-face), black 5%);
  --plaque-hi: rgb(255 255 255 / 0.6);
  --plaque-groove: rgb(90 45 25 / 0.32);
  --plaque-press: 0 1px 0 rgb(255 255 255 / 0.55);
  position: relative;
  color: var(--ink);
  background: linear-gradient(172deg, var(--plaque-lit), var(--plaque-face) 45%, var(--plaque-dim));
  box-shadow:
    inset 0 1px 0 var(--plaque-hi),
    inset 1px 0 0 var(--plaque-hi),
    inset -1px 0 0 var(--plaque-lo),
    inset 0 -2px 0 var(--plaque-lo),
    0 1px 1px var(--plaque-lo),
    0 6px 12px -4px var(--plaque-cast),
    0 18px 34px -14px var(--plaque-cast);
  text-shadow: var(--plaque-press);
}
/* the cut line: dark where its wall is in shade, light where the far wall catches the light */
.plaque::before {
  content: '';
  position: absolute;
  inset: var(--plaque-cut);
  border: 1px solid var(--plaque-groove);
  box-shadow: 1px 1px 0 var(--plaque-hi), inset 1px 1px 0 var(--plaque-hi);
  pointer-events: none;
}
/* phones: a lower tablet throws a shorter shadow */
@media (max-width: 600px), (max-height: 719px) {
  .plaque {
    box-shadow:
      inset 0 1px 0 var(--plaque-hi),
      inset 1px 0 0 var(--plaque-hi),
      inset -1px 0 0 var(--plaque-lo),
      inset 0 -2px 0 var(--plaque-lo),
      0 1px 1px var(--plaque-lo),
      0 4px 8px -3px var(--plaque-cast),
      0 10px 20px -10px var(--plaque-cast);
  }
}

/* The front page fits on one screen in one centred column. The signature
   stays at the top and the bottom line at the foot of the window; whatever
   height is left is shared evenly around the copy, so a tall window breathes
   and a short one closes up to the gaps below. */
.front-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.front { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 900px; margin: 0 auto; text-align: center; }
.front-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-2);
}
.front-body p.body { max-width: 36em; text-wrap: balance; }
.front-body .turn { margin: 0; }
/* The wall: the painting fills the band between the signature and the
   buttons, and the manifesto hangs on it as three plaques, pegged at their
   top corners. The painting shows whole, from the chained pair on the left
   to the last person on the right: as tall as the band and as wide as that
   makes it, centred on the column, never narrower than the column and never
   out to the edges of the page. Where the page is too narrow for all of it
   (tablets, phones), it keeps its middle. On a wide window the band stops
   at 1280px of painting and the paper takes the rest. The first plaque hangs
   at the top of the painting and the other two at the bottom, so the room
   between them opens on the scene: the sun and the two people talking. The
   painting is the one picture besides the logo: Alan's exception to section
   8 of the rules. */
.wall { position: relative; isolation: isolate; flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; padding: var(--space-3) var(--space-4); }
@media (min-width: 1000px) { .wall { max-height: calc(1280px * 1085 / 2560); } }
.painting img {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 50%;
  height: 100%;
  width: auto;
  min-width: 100%;
  max-width: calc(100vw - 2 * var(--space-4));
  translate: -50% 0;
  object-fit: cover;
  object-position: 50% 40%;
}
.plaques { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); width: 100%; max-width: 900px; }
.plaque.hung:first-child { margin-bottom: auto; }
.plaque.hung { width: fit-content; max-width: 100%; padding: var(--space-3) var(--space-4); text-align: center; }
.plaque.hung .turn { margin: 0; }
/* two pegs hold each plaque to the wall */
.plaque.hung::after {
  --peg: radial-gradient(circle, rgb(255 245 230 / 0.9) 0 1px, rgb(120 95 70) 1.5px 3.5px, rgb(55 40 28) 4.5px, transparent 5.5px);
  content: '';
  position: absolute;
  inset: 4px 4px auto 4px;
  height: 16px;
  background: var(--peg) left center / 16px 16px no-repeat, var(--peg) right center / 16px 16px no-repeat;
  pointer-events: none;
}
/* with the email box showing there is more to fit: the plaques close up a step */
.has-form .front-body { gap: var(--space-2); padding-top: var(--space-2); }
.has-form .plaques { gap: var(--space-2); }
.has-form .plaque.hung { --plaque-cut: var(--space-1); padding-block: var(--space-2); }
/* Join the mission. and Discover. side by side, the message under both */
.front-join { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-3); }
.front-join .note { flex-basis: 100%; }
.front .join { margin: 0; max-width: 640px; padding: var(--space-3) var(--space-4); }
.front .join-row { justify-content: center; }
/* short windows: close the gaps a step so the page still fits */
@media (max-height: 820px) {
  .front-page { padding-top: var(--space-3); padding-bottom: var(--space-3); }
  .front-body { gap: var(--space-3); padding: var(--space-2) 0 0; }
  .wall { padding-block: var(--space-2); }
  .plaques { gap: var(--space-2); }
  .has-form .wall { padding-block: var(--space-1); }
  .front .join { padding: var(--space-2) var(--space-3); }
}

/* Phones and short windows: nothing scrolls. Sizes follow the height of the
   window as it first opens (svh: with the browser's bars showing), and on the
   narrowest phones by the width too, so the whole front page always fits. On a phone this sets the reading text below the
   system's 21px; the field keeps 16px so iPhones do not zoom into it. */
@media (max-width: 600px), (max-height: 719px) {
  .front-page { padding-top: var(--space-3); padding-bottom: var(--space-3); }
  .front-body { gap: var(--space-2); padding: var(--space-1) 0 0; }
  .wall { padding: var(--space-1) var(--space-2); }
  .plaques { gap: var(--space-1); }
  .plaque.hung { --plaque-cut: var(--space-1); padding: var(--space-2) var(--space-3); }
  .plaque.hung::after { inset: 2px 2px auto 2px; height: 10px; background-size: 10px 10px; }
  .front-body p.body { font-size: clamp(12px, min(2.4svh, 4.1vw), 21px); line-height: 1.4; }
  .front-body .turn { font-size: clamp(18px, 3.8svh, 36px); line-height: 1.15; }
  .front .button, .front .button-quiet { height: clamp(36px, 6svh, 64px); padding: 0 var(--space-3); font-size: clamp(13px, 2.4svh, 21px); }
  .front .field { height: clamp(36px, 6svh, 64px); font-size: max(16px, 2.4svh); }
  .front .join { padding: var(--space-2) var(--space-3); }
  .front .join .label { margin-bottom: var(--space-1); }
  .front .join .consent { margin-top: var(--space-2); font-size: clamp(12px, 2svh, 18px); line-height: 1.3; }
  .front .colophon { gap: 0; }
  /* with the email box showing there is an eighth more to fit, so everything steps down by that */
  .has-form .front-body p.body { font-size: clamp(11px, 1.95svh, 21px); }
  .has-form .front-body .turn { font-size: clamp(16px, 3.1svh, 36px); }
  .has-form .front-body { gap: var(--space-1); padding-top: var(--space-1); }
  .has-form .plaques { gap: var(--space-1); }
  .has-form .front .button, .has-form .front .button-quiet, .has-form .front .field { height: clamp(32px, 5.2svh, 64px); }
  /* and the field and its button share one line */
  .has-form .front .join-row { flex-wrap: nowrap; gap: var(--space-2); }
  .has-form .front .join-row .field { flex: 1 1 0; min-width: 0; }
}

/* a phone on its side is wide and very short: let the copy run the full width
   so it takes fewer lines, and close up the space under the signature */
@media (orientation: landscape) and (max-height: 500px) {
  .front-page { padding-bottom: var(--space-1); }
  .front-body { padding-top: 0; }
  .front-body p.body { max-width: none; }
  .wall { padding: var(--space-1) var(--space-3); }
  .plaques { gap: 0; }
  .plaque.hung { --plaque-cut: var(--space-1); padding: var(--space-2) var(--space-3); }
  .plaque.hung::after { inset: 2px 2px auto 2px; height: 10px; background-size: 10px 10px; }
  .doc-fill .doc > h1 { margin-top: var(--space-3); }
  /* with the email box showing on a phone on its side, close every gap to the smallest step */
  .has-form .front-body { gap: var(--space-1); padding: 0; }
  .has-form .front .join { padding: var(--space-1) var(--space-2); }
  .has-form .front .join .label { margin-bottom: 0; }
  .has-form .front .join .consent { margin-top: var(--space-1); }
  /* the label sits on the field's line instead of above it */
  .has-form .front .join { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--space-2); }
  .has-form .front .join .label { margin: 0; }
  .has-form .front .join-row { flex: 1 1 auto; }
  .has-form .front .join .check, .has-form .front .join .consent { flex-basis: 100%; }
  /* and the box shares its line with Discover. */
  .has-form .front .join { flex: 1 1 0; }
  .has-form .front .button-quiet { flex: none; }
  /* and the plaques sit edge to edge */
  .has-form .plaques { gap: 0; }
}
/* the shortest of those: the plaques lose the cut line and close up to their words */
@media (orientation: landscape) and (max-height: 330px) {
  .plaque.hung, .has-form .plaque.hung { padding-block: var(--space-1); }
  .plaque.hung::before { display: none; }
}

/* A phone held upright has no room to hang the plaques on the whole painting,
   so the painting comes off the wall: the plaques stand on the page, the full
   width of the column, and between the first plaque and the turn hangs a band
   of the painting, from the chained figures on the left, past the sun, to the
   people with their halos on the right. The band takes the height that is
   left, from 15% of its width (the halos and the chains still both show) to
   26% (the two people talking stay in the middle of the crowd); past that
   the paper takes the rest, above and below. A tall band shows the
   painting's full height from its left edge; a short one its full width from
   the top. The strip is cut from the painting with the tip of one hand print
   painted out of its corner. A phone on its side keeps the wall. */
@media (max-width: 600px) and (orientation: portrait) {
  .wall { container-type: inline-size; flex-direction: column; gap: var(--space-1); padding: 0; }
  .plaques { display: contents; }
  .plaque.hung { order: 2; }
  /* the first plaque comes before the band, and its shadow falls on it */
  .plaque.hung:first-child { order: 0; z-index: 1; margin-bottom: 0; }
  .painting { order: 1; position: relative; flex: 1 1 0; align-self: stretch; min-height: 15cqw; max-height: 26cqw; }
  .painting img { inset: 0; z-index: auto; width: 100%; height: 100%; min-width: 0; max-width: none; translate: none; object-position: left top; }
  /* a hairline round the band */
  .painting::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--rule-strong); pointer-events: none; }
  /* with the email box showing, the band takes whatever height is left, cut
     lower in the painting so the chains still show */
  .has-form .painting { min-height: 0; }
  .has-form .painting img { object-position: left 30%; }
}
/* a short phone with the email box has no room for the band at all, so it goes */
@media (max-width: 600px) and (orientation: portrait) and (max-height: 700px) {
  .has-form .painting { display: none; }
}
/* a tall, narrow phone, where the band reaches its full height, gives it a
   step of paper above and below */
@media (max-width: 600px) and (orientation: portrait) and (max-aspect-ratio: 10/19) {
  .wall { gap: var(--space-2); }
}
/* the narrowest phones: the two paragraphs close up a step at their sides, so
   the mission takes a line fewer and the band keeps its height */
@media (max-width: 340px) and (orientation: portrait) {
  .plaque.hung:first-child, .plaque.hung:last-child { padding-inline: var(--space-2); }
  .has-form .front .join { padding: var(--space-1) var(--space-2); }
}

/* On a phone the one-screen pages (front, Discover, 404) do not move at all:
   no scrolling and no rubber-band bounce. They are sized above to fit the
   window with the browser's bars showing, so nothing is cut off. */
@media (max-width: 600px), (max-height: 719px) {
  :root:has(.front-page, .doc-fill), :root:has(.front-page, .doc-fill) body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
}

/* The legal pages: the signature at the head, the title and the bottom line
   centred, and the text in a wide column of its own, set from the left, with
   a line of space between paragraphs and two before each section. */
.doc-page { padding-top: var(--space-4); padding-bottom: var(--space-5); }
/* the same top margin as the front page, so the signature sits in the same place */
@media (max-height: 820px), (max-width: 600px) { .doc-page { padding-top: var(--space-3); } }
.doc { max-width: 880px; margin: 0 auto; }
.doc > h1 { margin-top: var(--space-5); text-align: center; }
.doc > h1 + p.meta { margin-top: var(--space-2); text-align: center; }
.doc > h1 + .body { margin-top: var(--space-4); text-align: center; }
.doc-text { max-width: 36em; margin: var(--space-5) auto 0; }
.doc-text > * + * { margin-top: var(--space-4); }
.doc-text > h2 { margin-top: var(--space-5); }
.doc-text > h2 + * { margin-top: var(--space-3); }
.doc-text ul { margin-bottom: 0; padding-left: var(--space-4); }
.doc-text li + li { margin-top: var(--space-3); }
.doc .colophon { align-items: center; margin-top: var(--space-6); }
/* a short page (Discover, 404): the bottom line goes to the foot of the window */
.doc-fill { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-top: var(--space-4); padding-bottom: var(--space-4); }
@media (max-width: 600px), (max-height: 820px) { .doc-fill { padding-top: var(--space-3); padding-bottom: var(--space-3); } }
.doc-fill .doc { flex: 1; display: flex; flex-direction: column; width: 100%; }
.doc-fill .colophon { margin-top: auto; padding-top: var(--space-5); }
/* a phone on its side: less space above the bottom line (after the rule above, so it wins) */
@media (orientation: landscape) and (max-height: 500px) { .doc-fill .colophon { padding-top: var(--space-3); } }

/* Discover is a strip of pieces, swiped sideways. A piece is sized from the
   window's width, up to the width of the front column (900px), and the strip
   holds exactly one piece, two gaps and a fifth of each neighbour: the full
   width of the window until the pieces reach 900px, centred with paper either
   side after that. The piece in the middle shows whole and the neighbours peek
   in at either side, so it is plain there is more to swipe to. A lone piece
   sits in the centre at the same size. A
   piece fills the room between the signature and the bottom line, but is
   never taller than it is wide. Each piece sits on a plaque (the component
   further down). */
/* the window's width, for the sizes below (cqw: the body is the container) */
:root:has(.strip) body { container-type: inline-size; }
.discover .pieces {
  --strip-gap: var(--space-4);
  --shadow-room: var(--space-4);
  --piece: min(900px, calc((100cqw - 2 * var(--strip-gap)) / 1.4));
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
}
.strip {
  flex: 1;
  display: flex;
  gap: var(--strip-gap);
  width: calc(var(--piece) * 1.4 + 2 * var(--strip-gap));
  /* room under the pieces for their shadows, which the strip would otherwise clip */
  padding-block: var(--space-1) var(--shadow-room);
  max-height: calc(var(--piece) + var(--space-1) + var(--shadow-room));
  margin-block: auto;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
/* the two sides fade across the fifth of a piece that peeks in, so a
   neighbour softens away at the edge instead of being cut; the piece in the
   middle is untouched. The fade would hide a focus outline drawn round the
   strip, so with keyboard focus the plaques' own edge carries it instead. */
.strip {
  --fade: linear-gradient(to right, transparent, black calc(var(--piece) * 0.2), black calc(100% - var(--piece) * 0.2), transparent);
  -webkit-mask-image: var(--fade);
  mask-image: var(--fade);
}
.strip:focus-visible { outline: none; }
.strip:focus-visible > .plaque { outline: 2px solid var(--rule-focus); outline-offset: -2px; }
/* room before the first piece and after the last, so they too can sit in the middle */
.strip::before, .strip::after { content: ''; flex: 0 0 calc(var(--piece) * 0.2); }
.strip > .plaque { flex: 0 0 var(--piece); scroll-snap-align: center; scroll-snap-stop: always; display: grid; place-items: center; text-align: center; }
/* while a mouse drags the strip, it follows the mouse and settles when let go */
.strip.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
/* what a piece says sits in its middle, clear of the cut line */
.strip > .plaque > * { margin: var(--space-4); }
@media (max-width: 600px) { .strip > .plaque > * { margin: var(--space-3); } }
/* phones and short windows: the gaps close a step */
@media (max-width: 600px), (max-height: 820px) {
  .discover .pieces { --strip-gap: var(--space-3); --shadow-room: var(--space-3); padding: var(--space-2) 0; }
}
/* a phone on its side: the smallest steps, so a piece keeps what height there is */
@media (orientation: landscape) and (max-height: 500px) {
  .discover .pieces { --strip-gap: var(--space-2); --shadow-room: var(--space-3); padding: var(--space-1) 0; }
}

/* a heading that screen readers hear and the page does not show */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the bottom line: Built for people not profiles., and the legal links on the line under it */
.colophon { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.front .colophon { align-items: center; margin-top: 0; }
.foot-line { display: flex; align-items: center; gap: var(--space-2); }
.foot-links { display: flex; gap: var(--space-3); }

/* a second action beside the primary button: the same box, drawn in outline */
.button-quiet {
  display: inline-flex;
  align-items: center;
  height: 64px;
  padding: 0 var(--space-4);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-none);
  text-decoration: none;
}
.button-quiet:hover { border-color: var(--ink); }

/* the hidden attribute wins over the brand's display rules (the button is inline-flex) */
[hidden] { display: none !important; }

/* the subscribe box: a consent line under the field, and room for the spam
   check's checkbox on the rare visit when Cloudflare needs a click */
.join .consent { margin-top: var(--space-3); }
.join .check.open { margin-top: var(--space-3); }
.join .button[aria-disabled="true"] { cursor: progress; }

/* the message after the form keeps its place while empty, so its first sentence is announced */
.note:empty { margin-top: 0; }

/* a field people never see; only bots fill it in */
.trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
