/*
 * Base layer and the typographic voices.
 *
 * The system has exactly three voices and they never blur into each other:
 *   .fg-dsp  display — Archivo at width 125, for the big statements
 *   .fg-ttl  title   — the same face, tighter leading, for headlines in lists
 *   .fg-em   the counter-voice — Gloock, upright, one phrase inside a headline
 * Everything else is body (Spectral) or data (IBM Plex Mono).
 */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--vir); color: var(--chalk); }

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

/* The skip link is visible the moment it is focused, and not before. */
.fg-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--chalk);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fg-skip:focus { left: 0; }

/* ── The measure ───────────────────────────────────────── */

.fg-wrap {
  margin-inline: auto;
  max-width: var(--page);
  padding-inline: var(--gut);
}

/* ── Voices ────────────────────────────────────────────── */

.fg-dsp {
  font-family: var(--font-grot);
  font-weight: 700;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  line-height: 0.9;
  letter-spacing: -0.032em;
  text-wrap: balance;
  margin: 0;
}

.fg-ttl {
  font-family: var(--font-grot);
  font-weight: 700;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  line-height: 1.05;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 0;
}

/*
 * Gloock has no italic, so this is set upright on purpose. Writing
 * `font-style: italic` here makes the browser synthesise a slant, which is
 * exactly the cheap effect the whole typographic scheme exists to avoid.
 */
.fg-em {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-variation-settings: normal;
  letter-spacing: -0.01em;
  padding-right: 0.04em;
}

/* Small uppercase grotesque label — the second most used thing in the system. */
.fg-lbl {
  font-family: var(--font-grot);
  font-weight: 700;
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-size: 9.5px;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  margin: 0;
}

/* Mono data atom: every code, date, score, price band and count. */
.fg-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}
.fg-code--ink { color: var(--ink); }
.fg-code--vir { color: var(--vir); }
.fg-code--muted { color: var(--nox-muted); }

/* ── The ledger rule — the brand's hairline ────────────── */

.fg-led {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--ink);
  padding-top: 10px;
}
.fg-led::before {
  content: "";
  position: absolute;
  left: 0;
  top: -5px;
  width: 1.5px;
  height: 10px;
  background: var(--vir);
}
.fg-led--inv { border-top-color: var(--nox-rule); }
.fg-led--inv::before { background: var(--vir-lift); }

/* ── The image plate ───────────────────────────────────── */

/*
 * One well for every picture, in one of eight ratios. The grain overlay is an
 * inline SVG so it costs no request; it is what keeps a flat photograph
 * sitting on a printed page rather than floating above it.
 */
.fg-plate {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--plate-1);
}
.fg-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.24'/%3E%3C/svg%3E");
}
.fg-plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-fg);
}
a:hover .fg-plate img,
.fg-group:hover .fg-plate img { transform: scale(1.04); }

.fg-tone-1 { background: var(--plate-1); }
.fg-tone-2 { background: var(--plate-2); }
.fg-tone-3 { background: var(--plate-3); }
.fg-tone-4 { background: var(--plate-4); }
.fg-tone-5 { background: var(--plate-5); }
.fg-tone-6 { background: var(--plate-6); }

/* The eight ratios. There are no others. */
.fg-r-21-9 { aspect-ratio: 21 / 9; }
.fg-r-16-9 { aspect-ratio: 16 / 9; }
.fg-r-3-2  { aspect-ratio: 3 / 2; }
.fg-r-5-4  { aspect-ratio: 5 / 4; }
.fg-r-1-1  { aspect-ratio: 1 / 1; }
.fg-r-4-5  { aspect-ratio: 4 / 5; }
.fg-r-5-7  { aspect-ratio: 5 / 7; }
.fg-r-2-3  { aspect-ratio: 2 / 3; }

/* A picture we do not hold: a tinted ground with the title's first letter. */
.fg-plate--mono {
  display: grid;
  place-items: center;
}
.fg-plate--mono span {
  font-family: var(--font-serif);
  font-size: clamp(28px, 6vw, 64px);
  color: color-mix(in srgb, var(--ink) 22%, transparent);
  line-height: 1;
}

/* ── Links that carry a rule ───────────────────────────── */

.fg-tlink {
  font-family: var(--font-grot);
  font-weight: 700;
  font-stretch: 112%;
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}
.fg-tlink::after {
  content: "";
  height: 1px;
  width: 22px;
  background: currentColor;
  transition: width 0.4s var(--ease-fg);
}
.fg-tlink:hover::after { width: 38px; }
.fg-tlink--inv { color: var(--nox-fg); }
.fg-tlink--inv:hover { color: var(--vir-lift); }

/* ── Motion, and the people who would rather not ───────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
