/* ---------- Typeface: Geist (variable) ---------- */
@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/geist/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/geist/Geist-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
/* ---------- Mono: DM Mono (labels, tokens, code) ---------- */
@font-face {
  font-family: "DM Mono";
  src: url("../assets/fonts/dm-mono/DMMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("../assets/fonts/dm-mono/DMMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ==========================================================================
   BASE — reset, page surface, type roles, layout helpers
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  overflow-x: clip; /* wide effects (the About photo fan) may reach the viewport edge, never scroll it */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip; /* same again here: phones read the body's width when they set the page's scale */
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-md);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Paper grain — the noise visible across every Figma frame */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: var(--grain-opacity);
  /* No mix-blend-mode: the noise is pure black, so normal blending looks the same as
     multiply — and a full-screen blend layer flashes black in page-transition snapshots. */
  background-image: url("../assets/grain.png"); /* pre-rendered feTurbulence noise (was an inline SVG filter, re-rasterised on every page snapshot) */
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

/* ---------- Type roles ----------
   Use these classes in markup; edit sizes in tokens.css. */

.t-display {        /* "Product Designer / Engineer" hero */
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-weight: var(--weight-regular);
  color: var(--color-text-strong);
  letter-spacing: -0.02em;
}

.t-heading {        /* big statements: Works intro, About "personal world", case study title */
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-regular);
  color: var(--color-text);
}

.t-title {          /* case study title (same as .t-heading, strongest colour) */
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-regular);
  color: var(--color-text-strong);
}

.t-lead {           /* About intro, Contact message */
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.t-nav {            /* menu panel links */
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  font-weight: var(--weight-regular);
}

.t-body {
  font-size: var(--text-md);
  line-height: var(--leading-md);
  font-weight: var(--weight-regular);
}

.t-body-strong {    /* section labels, company names, sub-headings */
  font-size: var(--text-md);
  line-height: var(--leading-md);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.t-small {          /* supporting paragraphs, years, nav items */
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  font-weight: var(--weight-regular);
}

.t-small-strong {   /* case study intro label */
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.t-caption {        /* tags, counts, labels */
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-regular);
}

/* colour modifiers */
.c-strong { color: var(--color-text-strong); }
.c-default { color: var(--color-text); }
.c-secondary { color: var(--color-text-secondary); }
.c-muted { color: var(--color-text-muted); }

/* ---------- Layout helpers ---------- */

.page {
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

/* 12-column site grid. Place children with grid-column, e.g. `grid-column: 5 / span 4`. */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  column-gap: var(--grid-gutter);
}

.section {
  padding-block: var(--section-y);
}

.measure-narrow { max-width: var(--measure-narrow); }
.measure-body { max-width: var(--measure-body); }
.measure-lead { max-width: var(--measure-lead); }
.measure-wide { max-width: var(--measure-wide); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Page transition (cross-document View Transitions) ----------
   The new page rises in from the bottom over the old one, which eases up and dims.
   Back/forward reverses it (the old page drops away to reveal the previous one). Browsers without support simply navigate. */
/* (opt-in is inline in each page's <head>: @view-transition { navigation: auto; }) */
/* Paper behind the pages (never the browser's black), and no additive blend: the UA
   default (plus-lighter) brightens wherever the two pages overlap. */
::view-transition { background: var(--color-bg); }
::view-transition-old(root),
::view-transition-new(root) { mix-blend-mode: normal; }
::view-transition-group(root) { animation-duration: 900ms; }
::view-transition-old(root) { animation: page-out 900ms cubic-bezier(0.76, 0, 0.24, 1) both; }
::view-transition-new(root) { animation: page-in 900ms cubic-bezier(0.76, 0, 0.24, 1) both; }
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: page-out-back; z-index: 1; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: page-in-back; }
@keyframes page-out      { to   { transform: translateY(-18%); opacity: 0.4; } }
@keyframes page-in       { from { transform: translateY(100%); } }
@keyframes page-out-back { to   { transform: translateY(100%); } }
@keyframes page-in-back  { from { transform: translateY(-18%); opacity: 0.4; } }

/* Page-load reveal (scripts/page-reveal.js): hidden until the script poses them */
.reveal-pending [data-reveal] { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
  .reveal-pending [data-reveal] { opacity: 1; }
}
