/* ---------- Fonts ----------
   Epicene Text Light (Klim Type Foundry), self-hosted from /fonts */
@font-face {
  font-family: "Epicene Text";
  src: url("fonts/epicene-text-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Epicene Text";
  src: url("fonts/epicene-text-light-italic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --font: "Epicene Text", Georgia, "Times New Roman", serif;
  --ink: #000;
  --paper: #F7F7F5;

  /* desktop */
  --pad-x: 27px;
  --body-size: 20px;
  --list-size: 16px;
  --gallery-left: 49.72vw;   /* 720 / 1448 in the Figma frame */
  --gallery-gap: 8px;
}

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

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: none;
}
a:hover { opacity: 0.55; }

h1, h2, p, ul { margin: 0; padding: 0; font-weight: inherit; }
ul { list-style: none; }

/* ---------- Left column ---------- */
.intro {
  width: var(--gallery-left);
  padding: 30px var(--pad-x) 30px;   /* same space below the Follow row as above the bio */
  container-type: inline-size;   /* lets the lists react to the text column's own width */
}

/* Name stays in the page for search engines and screen readers, but isn't shown */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.bio {
  max-width: 567px;
  font-size: var(--body-size);
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.bio p + p { margin-top: 1.3em; }   /* one blank line, as in the design */

.actions {
  display: flex;
  flex-wrap: wrap;
  column-gap: 45px;
  row-gap: 8px;
  margin-top: calc(var(--body-size) * 1.3);
  padding-left: 3px;
  font-size: var(--list-size);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.lists {
  display: grid;
  /* Clients starts 426px in (as in the Figma), moving left as the column narrows */
  grid-template-columns: minmax(max-content, 426px) minmax(max-content, 1fr);
  column-gap: 32px;
  margin-top: 100px;
  padding-left: 5px;
  font-size: var(--list-size);
  line-height: 1.3;
}

.label {
  font-size: calc(var(--list-size) - 1.5px);   /* PRESS / CLIENTS / FOLLOW, a touch smaller than the lists */
  line-height: 1.3;
  text-transform: uppercase;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);   /* thin rule under Press / Clients */
  margin-bottom: 22px;
}
/* Make the rule one continuous line across both columns, starting just left of the text */
.lists section:first-child .label {
  margin-left: -10px;
  padding-left: 10px;
  margin-right: -32px;   /* bridges the gap between the columns */
}

.lists ul { letter-spacing: -0.02em; white-space: nowrap; }

/* Stack Clients under Press only when the two can no longer fit side by side
   (Press needs ~182px, Clients ~134px, plus the 32px gap) */
@container (max-width: 360px) {
  .lists { grid-template-columns: minmax(0, 1fr); }
  .lists section:first-child .label { margin-right: 0; }
  .lists section + section { margin-top: 48px; }
}

/* Follow row: social links between two thin rules, matching the Press / Clients rule */
.follow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 52px;
  row-gap: 8px;
  margin: 56px 0 0 -5px;        /* rules start exactly where the Press rule does */
  padding: 20px 0 20px 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  font-size: var(--list-size);
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.follow .label {
  margin: 0;
  padding: 0;
  border: 0;
  letter-spacing: 0;
}

/* ---------- Bio hover pictures ---------- */
.peek { font-style: italic; }

.peek-img {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  height: auto;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) translate(-50%, -50%) scale(0.92);
  transition: opacity 0.2s ease, transform 0.2s ease;
  will-change: transform, opacity;
}
.peek-img.is-visible {
  opacity: 1;
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) translate(-50%, -50%) scale(1);
  transition: opacity 0.2s ease;   /* position follows the cursor without lag from the transition */
}

/* ---------- Scrolling gallery ---------- */
.gallery {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--gallery-left);
  right: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  column-gap: var(--gallery-gap);
  overflow: hidden;
}

.column {
  position: relative;
  overflow: hidden;
}

.track {
  will-change: transform;   /* moved by main.js */
}

/* Padding (not gap) so the two halves of the track are identical and the loop is seamless */
.tile {
  position: relative;
  display: block;
  padding-bottom: var(--gallery-gap);
  color: var(--ink);
  text-decoration: none;
}
.tile img {
  display: block;
  width: 100%;
  height: auto;
}

/* Case-study tiles: project name appears on hover */
a.tile { cursor: pointer; }
a.tile:hover { opacity: 1; }
.tile-label {
  position: absolute;
  top: calc(50% - var(--gallery-gap) / 2);
  left: 50%;
  width: max-content;                  /* stays on one line when it fits… */
  max-width: calc(100% - 24px);        /* …and wraps inside the pill when it doesn't */
  padding: 0.6em 1.2em 0.55em;
  border-radius: 999px;
  background: var(--paper);   /* same #F7F7F5 as the page */
  font-size: clamp(12px, 0.95vw, 14px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
a.tile:hover .tile-label,
a.tile:focus-visible .tile-label {
  opacity: 1;
  transform: translate(-50%, -50%);
}
a.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---------- Mobile (iPhone frame: 393px) ---------- */
@media (max-width: 640px) {
  :root {
    --pad-x: 21px;
    --body-size: 12px;
    --list-size: 12px;
    --gallery-left: 74vw;     /* 291 / 393 */
    --gallery-gap: 4px;
  }

  .intro {
    width: var(--gallery-left);
    padding: 24px 0 24px var(--pad-x);
    padding-right: 37px;
  }

  .bio { letter-spacing: -0.02em; }

  .lists {
    display: block;
    margin-top: 52px;
    padding-left: 0;
  }
  .actions { column-gap: 28px; padding-left: 0; }
  .lists section + section { margin-top: 48px; }

  .label { font-size: calc(var(--list-size) - 1px); padding-bottom: 7px; margin-bottom: 16px; }
  .follow { column-gap: 24px; margin: 44px 0 0; padding: 14px 0; }
  .follow .label { flex-basis: 100%; margin-bottom: 6px; }   /* phones: label on its own line */
  .lists section:first-child .label { margin-left: 0; padding-left: 0; margin-right: 0; }
  .lists ul { white-space: nowrap; }
  .tile-label { display: none; }   /* no hover on phones; tapping an image opens its case study */
}
