/* PhotoTriage landing page. The tokens, and the rules they follow, are in DESIGN.md. */

:root {
  color-scheme: light;

  /* Paper, one step deeper, and the hairline. */
  --color-eggshell: #fdfcfc;
  --color-taupe: #f5f3f1;
  --color-stone: #ebe8e4;
  /* The ink of the logo. */
  --color-ink: #14191c;
  --color-graphite: #44403b;
  /* The orange of the kept slide in the logo. It marks what is kept and nothing else, and it is
     too light to carry small text. */
  --color-kept: #e4531f;
  --color-kept-hover: #ee6a3a;

  /* Only the display face is requested. The page has to hold its shape when that request fails,
     so the fallback is the system face at the same light weight. */
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-xl: clamp(1.75rem, 1.5vw + 1.25rem, 2.25rem);
  --text-display: clamp(2.25rem, 3vw + 1.25rem, 3.5rem);

  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-section: clamp(4rem, 8vw, 6rem);
  --gutter: clamp(1rem, 4vw, 4rem);

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  /* An edge more than a shadow. */
  --shadow-whisper: 0 0 1px rgb(0 0 0 / 0.4), 0 1px 1px rgb(0 0 0 / 0.04), 0 2px 4px rgb(0 0 0 / 0.04);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* A rule with a `display` must not leave a hidden element on screen. */
[hidden] {
  display: none !important;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--color-eggshell);
  color: var(--color-graphite);
  font: 400 var(--text-base) / 1.5 var(--font-body);
}

::selection {
  background: var(--color-ink);
  color: var(--color-eggshell);
}

:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
figure,
pre {
  margin: 0;
}

h1,
h2,
h3,
dt,
th,
b,
.statement,
.wordmark {
  color: var(--color-ink);
}

h1,
h2,
.statement {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
}

h1 {
  font-size: var(--text-display);
  max-width: 16ch;
}

h2,
.statement {
  font-size: var(--text-xl);
  line-height: 1.15;
  max-width: 26ch;
}

h3 {
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.3;
}

p,
dd {
  max-width: 62ch;
  text-wrap: pretty;
}

a {
  color: var(--color-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* File names, paths and commands: the things a reader would type or look up. */
code,
kbd,
pre,
td,
.path,
.mount-label,
.score {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

code {
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  background: var(--color-taupe);
  color: var(--color-ink);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 var(--space-2xs);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  text-align: center;
}

.note {
  font-size: var(--text-sm);
}

/* A drawn line under the words that carry the sentence. */
.mark {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

/* The line is orange only under the photos that were kept. */
.statement .mark {
  text-decoration-color: var(--color-kept);
}

/* Off the layout, still read aloud. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.plates {
  position: absolute;
  width: 0;
  height: 0;
}

.wax {
  fill: var(--color-kept);
}

/* ---------- shell ---------- */

.wrap {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  padding-block: var(--space-section);
}

section > * + *,
.wrap > * + *,
.split > div > * + * {
  margin-top: var(--space-lg);
}

.split {
  display: grid;
  gap: var(--space-xl);
}

.split > * {
  margin-top: 0;
  min-width: 0;
}

/* A band of the deeper paper, edge to edge, on a section that is itself only as wide as the text. */
.band {
  background: var(--color-taupe);
  box-shadow: 0 0 0 100vmax var(--color-taupe);
  clip-path: inset(0 -100vmax);
}

.band code,
.keep code,
.close code {
  background: var(--color-stone);
}

/* ---------- top ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-block: var(--space-sm);
}

.top > * {
  margin-top: 0;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-md);
  font-weight: 500;
}

.wordmark img {
  width: auto;
  height: 1em;
}

/* ---------- buttons ---------- */

.btn,
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 2.75rem;
  padding: var(--space-xs) var(--space-lg);
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-full);
  background: var(--color-ink);
  color: var(--color-eggshell);
  font: 500 0.875rem / 1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-micro) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.btn-outline,
.key {
  border-color: var(--color-stone);
  background: var(--color-eggshell);
  box-shadow: var(--shadow-whisper);
  color: var(--color-ink);
}

/* Keep is the one control that carries the colour. */
.key-keep {
  border-color: var(--color-kept);
  background: var(--color-kept);
  box-shadow: none;
}

@media (hover: hover) {
  .btn:hover {
    background: var(--color-graphite);
  }

  .btn-outline:hover,
  .key:hover:not(:disabled) {
    background: var(--color-taupe);
  }

  .key-keep:hover:not(:disabled) {
    background: var(--color-kept-hover);
  }
}

.btn:active,
.key:active:not(:disabled) {
  transform: translateY(1px);
}

.key:disabled {
  opacity: 0.4;
  cursor: default;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

/* ---------- the table ---------- */

.hero {
  padding-block: var(--space-2xl) var(--space-section);
}

.hero-copy {
  display: grid;
  gap: var(--space-xl);
}

.hero-copy > * {
  margin-top: 0;
  min-width: 0;
}

.hero-copy > div > * + * {
  margin-top: var(--space-lg);
}

.hero-copy p {
  font-size: var(--text-md);
}

.hero-copy .note {
  font-size: var(--text-sm);
}

.hero > .wrap + .wrap {
  margin-top: var(--space-2xl);
}

/* The one large panel of the page: a review the visitor runs. */
.bench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "stack stack"
    "left kept"
    "keys keys"
    "note note";
  gap: var(--space-lg) var(--space-md);
  align-items: end;
  padding: clamp(1rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  background: var(--color-taupe);
}

.bench-head {
  grid-area: head;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);
  max-width: none;
  color: var(--color-ink);
  font-weight: 500;
}

.score {
  color: var(--color-graphite);
  font-weight: 400;
}

/* A slide mount. The frame inside it is a photo, so it keeps its square corners. */
.mount {
  padding: 7% 7% 0;
  border-radius: var(--radius-md);
  background: var(--color-eggshell);
  box-shadow: var(--shadow-whisper);
}

.mount svg {
  display: block;
  width: 100%;
  background: var(--color-ink);
}

.mount-label {
  display: block;
  padding-block: var(--space-sm);
  color: var(--color-ink);
}

.mount-small {
  padding-bottom: 7%;
}

.stack {
  grid-area: stack;
  position: relative;
}

.stack > :last-child {
  position: relative;
}

/* The copy of a slide on its way to a tray. */
.mount-flying {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* The frame the next key press brings, already on the table. */
.mount-next {
  position: absolute;
  inset: 0;
  transform: translate(3%, 3%) rotate(2deg);
}

.tray {
  grid-area: left;
}

.tray-kept {
  grid-area: kept;
}

.tray-kept .mount {
  position: relative;
}

/* The kept mark on a kept slide. */
.tray-kept .mount::after {
  content: "";
  position: absolute;
  top: calc(var(--space-2xs) * -1);
  right: calc(var(--space-2xs) * -1);
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-kept);
}

.tray-count {
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
}

.tray-count b {
  /* A box of its own, so the count can move when it changes. */
  display: inline-block;
  font-size: var(--text-md);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.keys {
  grid-area: keys;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.bench-note {
  grid-area: note;
  max-width: none;
  text-align: center;
}

/* ---------- the pile ---------- */

.pile {
  padding-top: 0;
}

/* Forty mounts nobody has looked at yet. */
.heap-sheet {
  display: block;
  width: 100%;
}

.blank {
  fill: var(--color-eggshell);
  stroke: var(--color-stone);
  stroke-width: 0.25;
}

.blank-frame {
  fill: var(--color-stone);
}

.heap {
  margin-top: var(--space-2xl);
}

.heap figcaption {
  margin-top: var(--space-sm);
}

/* A term and what it means, one hairline apart. */
.rows > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-top: 1px solid var(--color-stone);
}

.rows dt {
  font-weight: 500;
}

.rows-wide > div {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs);
  padding-block: var(--space-lg);
}

.rows-wide dt {
  font-size: var(--text-md);
}

/* ---------- the rule ---------- */

.rule-grid {
  display: grid;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.rule-grid h3 + p {
  margin-top: var(--space-xs);
}

/* ---------- the pass ---------- */

.steps {
  margin-top: var(--space-xl);
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  gap: var(--space-xs) var(--space-xl);
  padding-block: var(--space-lg);
  border-top: 1px solid var(--color-stone);
}

.path {
  color: var(--color-graphite);
}

.tour {
  margin-top: var(--space-xl);
}

.tour video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background: var(--color-eggshell);
  box-shadow: var(--shadow-whisper);
}

.tour figcaption {
  margin-top: var(--space-sm);
  color: var(--color-graphite);
}

.path-kept {
  color: var(--color-ink);
}

/* ---------- the ledger ---------- */

.fine {
  border-top: 1px solid var(--color-stone);
}

.scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

caption {
  caption-side: bottom;
  padding-top: var(--space-sm);
  text-align: left;
}

th,
td {
  padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-bottom: 1px solid var(--color-stone);
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: var(--text-sm);
  font-weight: 500;
}

.is-kept td {
  color: var(--color-ink);
}

/* The kept mark, so a kept row is told by more than its ink. */
td:first-child::before,
.path-kept::before {
  content: "";
  display: inline-block;
  width: var(--space-xs);
  height: var(--space-xs);
  margin-right: var(--space-xs);
  border-radius: 50%;
}

.is-kept td:first-child::before,
.path-kept::before {
  background: var(--color-kept);
}

/* ---------- the keep ---------- */

.keep {
  background: var(--color-taupe);
}

/* The three kept frames arrive one after the other. */
.kept-one {
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 500ms var(--ease-out),
    transform 500ms var(--ease-out);
}

.kept-one:nth-of-type(2) {
  transition-delay: 150ms;
}

.kept-one:nth-of-type(3) {
  transition-delay: 300ms;
}

.is-waiting .kept-one {
  opacity: 0;
  transform: scale(0.8);
}

/* ---------- the guarantee ---------- */

.guarantee h2 {
  max-width: 30ch;
  line-height: 1.2;
}

.rows-wide {
  margin-top: var(--space-xl);
}

/* ---------- the fine print ---------- */

.fine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: var(--space-lg) var(--space-xl);
  margin-top: var(--space-xl);
}

.fine h3 {
  font-size: var(--text-base);
}

.fine p {
  margin-top: var(--space-2xs);
  font-size: var(--text-sm);
}

/* ---------- the close ---------- */

.close {
  padding-block: var(--space-section) var(--space-lg);
  background: var(--color-taupe);
}

.close .split > div > * + * {
  margin-top: var(--space-md);
}

pre {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-eggshell);
  box-shadow: var(--shadow-whisper);
  overflow-x: auto;
  line-height: 1.9;
}

pre code {
  padding: 0;
  background: none;
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-xl);
  margin-top: var(--space-2xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-stone);
  font-size: var(--text-sm);
}

.colophon > * {
  margin-top: 0;
}

.colophon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-lg);
}

/* Tall enough for a finger. */
.colophon-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  white-space: nowrap;
}

/* ========================================================================== Wider screens. */

@media (min-width: 40rem) {
  .rows-wide > div {
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: var(--space-xl);
  }

  .steps li {
    grid-template-columns: 14rem minmax(0, 1fr);
  }

  .steps .path {
    grid-row: span 2;
  }

  .bench {
    grid-template-columns: minmax(0, 1fr) minmax(0, 34rem) minmax(0, 1fr);
    grid-template-areas:
      "head head head"
      "left stack kept"
      "keys keys keys"
      "note note note";
    gap: var(--space-lg) var(--space-xl);
  }

  .tray {
    width: min(100%, 13rem);
    justify-self: end;
  }

  .tray-kept {
    justify-self: start;
  }
}

@media (min-width: 60rem) {
  .hero-copy,
  .split {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: var(--space-2xl);
  }

  .hero-copy {
    align-items: end;
  }

  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
