/*
 * ALLUSIONS studio site
 * Achromatic publisher frame. The only colour on a page is inside a product plate.
 * Self-hosted Bricolage Grotesque and IBM Plex Mono (OFL 1.1, notices beside the files).
 */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Achromatic stock: every frame colour has zero chroma. */
  --paper: oklch(96.4% 0 0);
  --ink: oklch(17% 0 0);
  --muted: oklch(44% 0 0);
  --rule: oklch(80% 0 0);
  --rule-strong: oklch(17% 0 0);
  --night: oklch(14.5% 0 0);
  --night-ink: oklch(95% 0 0);
  --night-muted: oklch(74% 0 0);
  --night-rule: oklch(34% 0 0);

  /* Product grounds, used only as the mat around each product's real window. */
  --ground-afk: #eee8dc;
  --ground-demimedia: #080b0d;
  --ground-valclips: #141719;

  --display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --machine: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;

  --gutter: clamp(1.25rem, 3.4vw, 3rem);
  --measure: 38rem;
  --shell: 88rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--muted) var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-thickness 140ms ease-out;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

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

.shell {
  width: min(100% - 2 * var(--gutter), var(--shell));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus-visible {
  transform: none;
  outline-color: var(--ink);
}

.machine {
  font-family: var(--machine);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}

/* Masthead ---------------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--rule-strong);
}

.imprint {
  font-size: 0.9375rem;
  color: var(--muted);
}

.masthead nav,
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.masthead nav a,
.footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9375rem;
  text-decoration-color: transparent;
}

.masthead nav a:hover,
.footer nav a:hover {
  text-decoration-color: currentColor;
}

/* Opening ----------------------------------------------------------- */

.opening {
  padding-block: clamp(2.5rem, 7vw, 6rem) clamp(3rem, 7vw, 6.5rem);
}

.wordmark {
  font-family: var(--display);
  font-weight: 560;
  /* Sized to span the measure: the set word is about 4.6 ems wide. */
  font-size: min(19.25rem, calc((100vw - 2 * var(--gutter)) / 4.62));
  line-height: 0.8;
  letter-spacing: -0.035em;
  margin-left: -0.045em;
}

.opening-copy {
  display: grid;
  gap: 1rem;
  margin-top: clamp(1.75rem, 3.6vw, 3rem);
  max-width: var(--measure);
}

.lede {
  font-size: clamp(1.25rem, 1.9vw, 1.6rem);
  line-height: 1.4;
  text-wrap: pretty;
}

.handle {
  color: var(--muted);
  font-size: 1rem;
}

.handle a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* A contents line, as on a publisher's list: each title with its state. */
.contents {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2.25rem;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}

.contents li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}

.contents a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--display);
  font-weight: 560;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.contents span {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Products ---------------------------------------------------------- */

.products {
  display: grid;
}

.product {
  width: min(100% - 2 * var(--gutter), var(--shell));
  margin-inline: auto;
  display: grid;
  gap: 2rem;
  padding-block: clamp(2.75rem, 6vw, 5.5rem);
  border-top: 1px solid var(--rule-strong);
}

.product-text {
  display: grid;
  align-content: start;
  gap: 1rem;
  max-width: var(--measure);
}

.product h3 {
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(2.5rem, 4.6vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.job {
  font-size: clamp(1.125rem, 1.5vw, 1.3rem);
  line-height: 1.4;
  font-weight: 600;
  text-wrap: pretty;
}

.product-text > p:not(.job):not(.links) {
  color: var(--ink);
  text-wrap: pretty;
}

.facts {
  display: grid;
  margin-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

.facts div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.facts dt {
  color: var(--muted);
}

.links {
  margin-top: 0.5rem;
  font-weight: 600;
}

.links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.links a::after {
  content: " \2192";
  font-weight: 400;
}

.product-meta {
  display: grid;
  gap: 1rem;
}

.unlinked {
  color: var(--muted);
  font-weight: 400;
}

/* A plate is the product's real window on the product's own ground. */
.plate {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  min-width: 0;
}

.plate picture {
  display: block;
  min-width: 0;
}

.plate img {
  width: 100%;
  padding: clamp(0.75rem, 2.4vw, 2rem);
  background: var(--plate-ground);
}

.plate figcaption {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (max-width: 39.99rem) {
  /* On a phone the windows are small; give them the whole width. */
  .plate {
    margin-inline: calc(-1 * var(--gutter));
  }
  .plate img {
    padding: 0.5rem;
  }
  .plate figcaption {
    padding-inline: var(--gutter);
  }
}

.plate-afk { --plate-ground: var(--ground-afk); }
.plate-demimedia { --plate-ground: var(--ground-demimedia); }
.plate-valclips { --plate-ground: var(--ground-valclips); }

@media (min-width: 64rem) {
  .product {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.5rem, 3vw, 3rem);
  }

  /* AFK AI: text leads, window beside it. */
  .product-afk .product-text { grid-column: 1 / span 4; }
  .product-afk .plate { grid-column: 5 / -1; }

  /* DemiMedia: the picture takes the full measure; the words follow underneath. */
  .product-demimedia .plate { grid-column: 1 / -1; grid-row: 1; }
  .product-demimedia .plate img { padding: clamp(1.5rem, 4vw, 4.5rem); }
  .product-demimedia .product-text {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.5rem, 3vw, 3rem);
  }
  .product-demimedia .product-text > * { grid-column: 1 / span 4; }
  .product-demimedia .product-text > h3 { grid-column: 1 / span 4; grid-row: 1 / span 2; }
  .product-demimedia .product-text > .job { grid-column: 5 / span 4; grid-row: 1; }
  .product-demimedia .product-text > p:not(.job):not(.links) { grid-column: 5 / span 4; grid-row: 2; }
  .product-demimedia .product-text > .product-meta { grid-column: 9 / -1; grid-row: 1 / span 2; align-self: start; }
  .product-demimedia .product-meta .facts { margin-top: 0; }

  /* ValClips: the window leads from the left, the words answer on the right. */
  .product-valclips .plate { grid-column: 1 / span 8; grid-row: 1; }
  .product-valclips .product-text { grid-column: 9 / -1; grid-row: 1; }
}

/* Short desktop screens: pull the list up so the first product is in view. */
@media (min-width: 64rem) and (max-height: 50rem) {
  .opening {
    padding-block: 2rem 2.25rem;
  }
  .opening-copy {
    margin-top: 1.5rem;
  }
  .contents {
    margin-top: 1rem;
  }
  .product-afk {
    padding-top: 1.75rem;
  }
}

/* Motion: each window settles into its frame as it arrives. Content is fully
   visible without it, and it never runs for people who ask for less motion. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  @supports (animation-timeline: view()) {
    .plate img {
      animation: settle linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 28%;
    }
  }
}

@keyframes settle {
  from {
    clip-path: inset(4% 3% 4% 3%);
    transform: translateY(1.5rem);
  }
  to {
    clip-path: inset(0);
    transform: none;
  }
}

/* Standard ---------------------------------------------------------- */

.standard {
  background: var(--night);
  color: var(--night-ink);
  padding-block: clamp(3.5rem, 8vw, 7rem);
  scrollbar-color: var(--night-muted) var(--night);
}

.standard ::selection {
  background: var(--night-ink);
  color: var(--night);
}

.standard :focus-visible {
  outline-color: var(--night-ink);
}

.standard-grid {
  display: grid;
  gap: 2.25rem;
}

.standard h2 {
  font-family: var(--display);
  font-weight: 540;
  font-size: clamp(2.2rem, 4.4vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 12ch;
}

.principles {
  list-style: none;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--night-muted);
}

.principles li {
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--night-rule);
  color: var(--night-muted);
  text-wrap: pretty;
}

.principles strong {
  color: var(--night-ink);
  font-weight: 600;
}

@media (min-width: 64rem) {
  .standard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.5rem, 3vw, 3rem);
  }
  .standard h2 { grid-column: 1 / span 4; }
  .principles { grid-column: 5 / span 7; }
  .principles li { font-size: 1.15rem; }
}

/* Footer ------------------------------------------------------------ */

.footer {
  display: grid;
  gap: 0.75rem;
  padding-block: 2.5rem 2rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer-mark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

@media (min-width: 48rem) {
  .footer {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 2rem;
  }
}

/* Not found --------------------------------------------------------- */

.not-found {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(3rem, 10vw, 8rem);
}

.not-found h1 {
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 16ch;
}

.not-found .wordmark {
  font-size: clamp(2.5rem, 9vw, 7rem);
}

@media print {
  .skip-link,
  .masthead nav {
    display: none;
  }
  .standard {
    background: none;
    color: var(--ink);
  }
}
