/* Tokens: every colour, typeface, type size and space on the site, named in one place.
   Taken from design/page/style.css; DESIGN.md says what each is for. */

@font-face { font-family: "Alegreya"; src: url("fonts/alegreya/Alegreya-Italic-wght.woff2") format("woff2"); font-style: italic; font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans/AlegreyaSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans/AlegreyaSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans/AlegreyaSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Alegreya Sans SC"; src: url("fonts/alegreya-sans-sc/AlegreyaSansSC-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans SC"; src: url("fonts/alegreya-sans-sc/AlegreyaSansSC-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* colour */
  --paper: #eef2ee;        /* chart white: the ground of every page */
  --field: #f8faf8;        /* the inside of the email field */
  --ink: #14363d;          /* spruce: type, hairlines, the neatline */
  --slate: #3c5b61;        /* small text: notes, captions, footer */
  --red: #a8382a;          /* canoe red: the button, and errors; nothing else */
  --red-deep: #8c2c20;     /* button hover; error text */
  --contour: #a77b52;      /* contour lines only; never text */
  --rule: rgba(20, 54, 61, .3);
  --placeholder: #587277;  /* placeholder text in the email field only */
  --mask-solid: #000;      /* the opaque stop of a mask; never painted */

  /* type */
  --serif: "Alegreya", Georgia, serif;
  --sans: "Alegreya Sans", system-ui, sans-serif;
  --sc: "Alegreya Sans SC", "Alegreya Sans", sans-serif;
  --fs-h1: clamp(2.5rem, 1.55rem + 3.9vw, 4.75rem);
  --fs-h1-quiet: clamp(2.25rem, 1.6rem + 2.6vw, 3.75rem);
  --fs-h2: clamp(1.875rem, 1.45rem + 1.6vw, 2.75rem);
  --fs-word: clamp(1.5rem, 1.3rem + .6vw, 1.875rem);
  --fs-leather: var(--fs-word);
  --fs-confirm: 1.625rem;
  --fs-body: 1.125rem;
  --fs-control: 1.0625rem;
  --fs-small: .9375rem;
  --fs-label: .875rem;
  --track-label: .16em;
  --track-display: -.012em;
  --track-control: .01em;
  --wm-lasso-size: 50px;   /* wordmark, in the SVG's own units */
  --wm-lasso-track: 13px;
  --wm-wallet-size: 21px;

  /* space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --gutter: 20px;
  --sheet-inset: 8px;
  --tap: 44px;             /* the least height of a link, to tap */
  --tap-bleed: 11px;       /* how far a small link's tap area reaches past its text, so its row keeps its height */
}

@media (max-width: 359px) {
  :root { --fs-h1: clamp(2.25rem, 1.55rem + 3.9vw, 4.75rem); }
}

@media (min-width: 640px) {
  :root { --gutter: 40px; --sheet-inset: 12px; }
}

@media (min-width: 960px) {
  /* the headline's column is narrow here; its size follows the column so the first sentence always fits */
  :root { --gutter: 64px; --sheet-inset: 16px; --fs-h1: clamp(3rem, 6.6vw - 12px, 4.75rem); }
}

/* Base: the reset, the sheet (one hairline neatline round the page), the headline, plates, and .vh. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--fs-body)/1.55 var(--sans); }
h1, h2, h3, p, figure, ol { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--red-deep); }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The sheet: one hairline neatline round the page, the edge of the chart. */
.sheet { position: relative; margin: var(--sheet-inset); border: 1px solid var(--ink); overflow: clip; min-height: calc(100vh - 2 * var(--sheet-inset)); display: flex; flex-direction: column; }
.sheet > main { flex: 1 0 auto; }

/* The one headline of every page. */
h1 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--fs-h1); line-height: 1.02; letter-spacing: var(--track-display); text-wrap: balance; }
/* Each sentence of a headline stays whole on its line. */
h1 > span { display: inline-block; white-space: nowrap; }

/* The plate: no box, no ground, no caption; its alt text says what it shows. */
.plate img { width: 100%; }

/* Masthead */
.masthead { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--gutter) 0; }
.wordmark { display: block; width: 96px; text-decoration: none; color: var(--ink); }
.wordmark svg { display: block; width: 100%; height: auto; overflow: visible; }
.wm-lasso { font-family: var(--sc); font-weight: 700; font-size: var(--wm-lasso-size); letter-spacing: var(--wm-lasso-track); fill: currentColor; }
.wm-wallet { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--wm-wallet-size); letter-spacing: .5px; fill: var(--slate); }
.notify-link { font-family: var(--sc); font-weight: 700; font-size: var(--fs-label); letter-spacing: var(--track-label); padding: var(--s3) 0; white-space: nowrap; text-decoration: none; border-bottom: 1px solid var(--rule); }
.notify-link:hover { border-bottom-color: currentColor; }

@media (min-width: 640px) {
  .wordmark { width: 118px; }
}

@media (min-width: 960px) {
  .masthead { padding-top: var(--s5); }
  .wordmark { width: 134px; }
}

/* The contour sheet is drawn round a clearing (65% across, 47% down the drawing); --cx/--cy put
   that clearing under the plate. The lines never go behind words: the layer is only placed where
   there are none (top.css, quiet.css), and every edge of it fades out, never a cut. */
.contours { --cw: 1000px; --cx: 50%; --cy: 50%; position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent);
          mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent); }
.contours img { position: absolute; width: var(--cw); max-width: none; left: calc(var(--cx) - var(--cw) * .65); top: calc(var(--cy) - var(--cw) * .29375); opacity: .85; }

/* Top: headline, sign-up, and the plate lying in the clearing the contours leave. */
.top { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); padding: var(--s6) var(--gutter) var(--s8); }
.top-copy { grid-column: 1; grid-row: 1; }
.top .plate { grid-column: 1; grid-row: 2; }
/* The contours share the plate's grid cell and nothing else, so no line can sit behind a word. */
.top .contours { position: relative; inset: auto; grid-column: 1; grid-row: 2; align-self: stretch; justify-self: stretch; margin: 0 calc(-1 * var(--gutter)); --cw: 820px; --cy: calc(50% + var(--s3)); }
.top-copy, .plate { position: relative; z-index: 1; }
.soon { margin-top: var(--s3); font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--fs-body); letter-spacing: 0; color: var(--slate); }
.top .plate { margin-top: var(--s6); justify-self: center; width: min(100%, 520px); }

/* While everything is one column, the cinch follows the plate closely (cinch.css). */
@media (max-width: 959px) {
  .top { padding-bottom: var(--s6); }
}

@media (min-width: 640px) {
  .top .contours { --cw: 1300px; }
}

@media (min-width: 960px) {
  .top { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--s7); align-items: center; padding-top: var(--s7); padding-bottom: var(--s9); min-height: min(720px, calc(100vh - 110px)); }
  .top-copy { grid-column: 1; grid-row: 1; }
  .top .plate { grid-column: 2; grid-row: 1; margin-top: 0; width: min(100%, 680px); }
  /* the plate's column, bleeding into the top and bottom padding, the right gutter and half the column gap */
  .top .contours { grid-column: 2; grid-row: 1; margin: calc(-1 * var(--s7)) calc(-1 * var(--gutter)) calc(-1 * var(--s9)) calc(-1 * var(--s7) / 2);
    --cw: 1750px; --cx: calc(var(--s7) / 4 + 50% - var(--gutter) / 2); --cy: calc(var(--s7) + (100% - var(--s7) - var(--s9)) / 2);
    -webkit-mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent), linear-gradient(to right, transparent, var(--mask-solid) 30%);
            mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent), linear-gradient(to right, transparent, var(--mask-solid) 30%);
    -webkit-mask-composite: source-in; mask-composite: intersect; }
}

/* Sign-up: a field and a button on a hairline, nothing round them. */
.signup-block { margin-top: var(--s6); max-width: 28rem; }
.signup label { display: block; margin-bottom: var(--s2); font-family: var(--sc); font-weight: 700; font-size: var(--fs-label); letter-spacing: var(--track-label); }
.row { display: flex; gap: var(--s2); }
.signup input { flex: 1 1 0; width: 0; min-width: 0; height: 48px; padding: 0 var(--s3); font: 400 var(--fs-control) var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--ink); border-radius: 0; caret-color: var(--red); }
.signup input::placeholder { color: var(--placeholder); opacity: 1; }
.signup input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.signup input[aria-invalid="true"] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.signup button { flex: 0 0 auto; height: 48px; padding: 0 var(--s5); font: 700 var(--fs-control) var(--sans); letter-spacing: var(--track-control); color: var(--paper); background: var(--red); border: 0; border-radius: 0; cursor: pointer; }
.signup button:hover { background: var(--red-deep); }
.signup button:active { transform: translateY(1px); }
.signup button[disabled] { cursor: progress; background: var(--red-deep); }
.msg { margin-top: var(--s2); font-size: var(--fs-small); font-weight: 500; color: var(--red-deep); }
.msg:empty { display: none; }
.note { margin-top: var(--s2); font-size: var(--fs-small); color: var(--slate); }
.done { padding: var(--s3) 0 var(--s1); border-top: 1px solid var(--rule); }
.done:focus { outline: none; }
.done-h { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--fs-confirm); line-height: 1.2; }

/* Cinch: three plates, a word and one line under each; one column until 960, then a row. */
.cinch { position: relative; z-index: 1; padding: var(--s8) var(--gutter); }
.steps { list-style: none; padding: 0; margin-top: var(--s5); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.steps img { width: min(100%, 360px); }
/* Round and Press share Pull's frame, which has room above for the pull mark; in one column that room is cropped away. */
.steps .trim { object-fit: cover; object-position: 50% 100%; }
.steps .trim-round { aspect-ratio: 402 / 266; }
.steps .trim-press { aspect-ratio: 402 / 222; }
.steps p { margin-top: var(--s3); font-size: var(--fs-body); max-width: 30ch; text-wrap: pretty; }
.steps strong { display: block; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--fs-word); line-height: 1.1; margin-bottom: var(--s1); }

@media (max-width: 959px) {
  .cinch { padding-top: var(--s5); }
}

@media (min-width: 960px) {
  .cinch { padding-top: var(--s8); padding-bottom: var(--s8); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
  .steps .trim { aspect-ratio: auto; }
}

/* Leather: one close plate and one line. */
.leather { position: relative; z-index: 1; padding: var(--s8) var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: center; }
.leather .plate { width: min(100%, 440px); }
.leather-copy p { max-width: 30ch; font-family: var(--serif); font-style: italic; font-size: var(--fs-leather); line-height: 1.35; text-wrap: pretty; }

@media (min-width: 960px) {
  .leather { padding-top: var(--s8); padding-bottom: var(--s8); grid-template-columns: minmax(0, 440px) minmax(0, 30ch); justify-content: start; column-gap: var(--s8); }
}

/* Sign-up again, at the foot of the page. */
.again { position: relative; z-index: 1; padding: var(--s8) var(--gutter) var(--s9); }
.again h2 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--fs-h2); line-height: 1.08; }
.again .signup-block { margin-top: var(--s5); }

@media (min-width: 960px) {
  .again { padding-top: var(--s8); padding-bottom: var(--s8); }
  .again { padding-bottom: var(--s10); }
}

/* Footer */
.foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3) var(--s5); margin: 0 var(--gutter); padding: var(--s4) 0 var(--s5); border-top: 1px solid var(--rule); font-family: var(--sc); font-weight: 500; font-size: var(--fs-label); letter-spacing: var(--track-label); color: var(--slate); }
/* 44px to tap, without making the footer taller */
.foot a { display: inline-flex; align-items: center; min-height: var(--tap); margin: calc(-1 * var(--tap-bleed)) 0; color: var(--ink); }

/* Quiet pages: privacy, not found, the sign-up result pages. */
.quiet { position: relative; padding: var(--s8) var(--gutter) var(--s9); }
.quiet > :not(.contours) { max-width: 44rem; }
.quiet h1 { font-size: var(--fs-h1-quiet); }
.quiet p { margin-top: var(--s4); max-width: 62ch; text-wrap: pretty; }
.quiet .lede { margin-top: var(--s5); }
.quiet .back { display: inline-flex; align-items: center; min-height: var(--tap); margin-top: var(--s6); font-family: var(--sc); font-weight: 700; font-size: var(--fs-label); letter-spacing: var(--track-label); }
/* The contours take the room the words leave: a band under them on a narrow screen,
   the field to their right on a wide one. */
.quiet { display: flex; flex-direction: column; }
.quiet .back { align-self: flex-start; }
.quiet > .contours { position: relative; inset: auto; order: 1; flex: 1 0 200px; margin: var(--s7) calc(-1 * var(--gutter)) calc(-1 * var(--s9)); max-width: none; --cw: 1100px; --cx: 60%; --cy: 75%; }
.quiet > :not(.contours) { position: relative; z-index: 1; }
/* DESIGN.md: the sign-up block is at most 28rem wide everywhere, the result pages included. */
.quiet > .signup-block { max-width: 28rem; }

@media (min-width: 1100px) {
  .quiet > .contours { position: absolute; inset: 0 0 0 calc(var(--gutter) + 44rem + var(--s7)); margin: 0; --cw: 1500px; --cx: 55%; --cy: 50%;
    -webkit-mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent), linear-gradient(to right, transparent, var(--mask-solid) 35%);
            mask-image: linear-gradient(to bottom, transparent, var(--mask-solid) 15%, var(--mask-solid) 85%, transparent), linear-gradient(to right, transparent, var(--mask-solid) 35%);
    -webkit-mask-composite: source-in; mask-composite: intersect; }
}
