/* jamiederooij.com — built from the Figma design "Jamie" (frames 57:917 and 57:865).
   Design frame is 1730px wide: 50px gutters, three 530px columns, 20px gaps.
   Everything is Switzer Medium on #131313. */

:root {
  --bg: #131313;
  --fg: #f5f5f5;
  --tile: #484848;
  --line: rgba(245, 245, 245, .28);
  --pill: rgba(245, 245, 245, .1);
  --dot: rgba(245, 245, 245, .3);

  --font: "Switzer", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 2.9vw, 50px);
  --gap: clamp(10px, 1.16vw, 20px);
  --space: clamp(72px, 9.25vw, 160px);
  /* body size follows gilhuybrecht.com: 1.7 x (0.6667vw root) = 1.133vw, medium weight */
  --text: clamp(15px, 1.1333vw, 22px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
/* smooth scrolling (Lenis) */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 500;
  font-size: var(--text);
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, dl, dd { margin: 0; font-weight: 500; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
a:not(.button):not(.plain):hover { opacity: .6; }
a { transition: opacity .3s ease; }

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.right { text-align: right; justify-self: end; }

/* No single word alone on a line: the browser balances the breaks, and main.js also
   ties the last two words of each text together for browsers that can't yet. */
p, dd { text-wrap: pretty; }
.row h3, .card-title, .lb-title { text-wrap: balance; }
/* The large statements and titles are animated word by word. Browser balancing breaks
   those lines far too early (seen in Safari), so they wrap normally and fill each line;
   only their last two words are kept together. */
.lead, .h2, [data-split] { text-wrap: wrap; }
.nw { white-space: nowrap; }

/* ---------- BUTTON (text rolls up on hover, like the Framer "slideUpBack") ---------- */
.button {
  display: inline-block;
  padding: .5em .667em;
  background: var(--fg);
  color: var(--bg);
  line-height: 1.21;
  white-space: nowrap;
}
.button-roll { display: block; height: 1.21em; overflow: hidden; }
.button-roll span { display: block; transition: transform .5s var(--ease); }
.button:hover .button-roll span { transform: translateY(-100%); }
/* in the hero and footer, the button text sits on the same line as the column labels */
.topbar .right .button, .footer-top .right .button { margin-top: -.56em; }

/* ---------- HERO ---------- */
.hero {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  --edge: clamp(16px, 2.5vw, 43px);
  padding: var(--edge) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 4.6vw, 80px);
  overflow: hidden;
  background: var(--bg);
}
/* the hero uses the footer's four columns: name · services · socials · button */
.topbar { position: relative; z-index: 3; line-height: 1; }
.hero-nav, .socials, .footer-list { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; line-height: 1; }

.fit { width: 100%; white-space: nowrap; text-align: center; line-height: .8; user-select: none; }
.fit span { display: inline-block; }
.hero-name {
  position: relative;
  z-index: 1;
  margin-top: auto;
  font-size: 34vw;               /* replaced by the fit-to-width script */
  text-box: trim-both cap alphabetic;   /* same spacing around the name as in the footer */
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, filter;
}
.hero-spacer { height: 100vh; height: 100dvh; }

.trail {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  perspective: 1200px;
}
.trail-item {
  position: absolute;
  top: 0; left: 0;
  width: 200px;
  height: 250px;
  object-fit: cover;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

/* ---------- PAGE (the layer that slides over the hero) ---------- */
.page {
  position: relative;
  z-index: 2;
  background: var(--bg);
  padding: var(--space) var(--gutter) clamp(16px, 2.5vw, 43px);
  display: flex;
  flex-direction: column;
  gap: var(--space);
}
.block { display: flex; flex-direction: column; gap: clamp(24px, 2.6vw, 45px); }

.lead {
  font-size: clamp(26px, 3.24vw, 56px);
  line-height: 1.07;
  text-indent: 21.5%;
}
/* Section headings: the size of the intro text, with the number of items raised beside it */
.h2 {
  margin: 0;
  font-size: clamp(26px, 3.24vw, 56px);
  line-height: 1.07;
}
/* heading on the left, "Last updated" on the far right, sharing the baseline */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px var(--gap); }
.section-head > p { margin: 0; }

/* ---------- WORKS: masonry ---------- */
.masonry { display: flex; align-items: flex-start; gap: var(--gap); }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }

.card {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(28px);
  /* cards come in slowly: a long fade and an even longer, soft rise */
  transition: opacity 1.6s cubic-bezier(.33, 0, .2, 1), transform 2s var(--ease), filter .6s ease;
}
.card.in { opacity: 1; transform: none; }
.card-media { position: relative; width: 100%; }
/* Grey stand-in while an item loads; it is removed once the image is in, so it can
   never show as a thin line along the edges. */
.card-media { background: var(--tile); }
.card-media:has(.is-loaded) { background: transparent; }

/* Images bleed 1px past the card on every side (the card clips it), so rounding
   and the scroll animation can't leave a hairline at the edge. */
.card-media > img,
.card-media > video,
.card-media > .slide {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  max-width: none;
  object-fit: cover;
}
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide { opacity: 0; transition: opacity 1.2s ease; }
/* media fades in once it has loaded, instead of popping in */
.card-media > :not(.slide), .wall-track img { opacity: 0; transition: opacity 1.2s ease; }
.card-media > .is-loaded:not(.slide), .wall-track img.is-loaded { opacity: 1; }
.slide.on { opacity: 1; }

/* title on hover: 24px, 12px from the left, 14px from the bottom */
.card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(19, 19, 19, .6), rgba(19, 19, 19, 0));
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
.card-title {
  position: absolute;
  z-index: 1;
  left: 12px;
  right: 12px;
  bottom: 14px;
  line-height: 1;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .6s ease, transform .8s var(--ease);
  pointer-events: none;
}
.card.has-dots .card-title { right: 96px; }
.card.is-hover::after, .card:focus-visible::after,
.card.is-hover .card-title, .card:focus-visible .card-title { opacity: 1; transform: none; }

/* while one card is hovered, the others step back */
.masonry.hovering .card.in:not(.is-hover) { filter: blur(2px); opacity: .9; }

/* slideshow toggles */
.dots {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border-radius: 40px;
  background: var(--pill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 1000px;
  background: var(--dot);
  cursor: pointer;
  transition: width .5s var(--ease), background-color .3s ease;
}
.dot.on { width: 22px; background: var(--fg); }

/* ---------- POSTER WALL ---------- */
.wall { overflow: hidden; }
.wall-track { display: flex; gap: var(--gap); will-change: transform; }
.wall-track img {
  flex: none;
  width: calc((100% - 2 * var(--gap)) / 3);   /* three posters fit in full */
  max-width: none;
  aspect-ratio: 662 / 937;
  object-fit: cover;
  background: var(--tile);
}
.wall-track img.is-loaded { background: transparent; }
/* arrows under the wall: the same round buttons as the lightbox */
.wall-nav { display: flex; justify-content: flex-end; gap: 10px; }
.wall-nav .round { position: static; }

/* ---------- ABOUT ---------- */
.about { display: flex; flex-direction: column; gap: var(--space); }
.rows { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: clamp(22px, 1.85vw, 32px) 0;
  border-bottom: 1px solid var(--line);
}
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row h3 { font-size: inherit; line-height: 1; max-width: 11em; }
.row-text { grid-column: 2 / 4; display: flex; flex-direction: column; gap: 1.21em; }


/* ---------- FOOTER ---------- */
.footer {
  /* a full screen, like the hero: links at the top, the name and last line at the bottom */
  --edge: clamp(16px, 2.5vw, 43px);
  min-height: calc(100vh - var(--edge));
  min-height: calc(100dvh - var(--edge));
  padding-top: var(--edge);
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 4.6vw, 80px);
}
.footer-name { margin-top: auto; }
/* poster trail: under the links, over the big name (same layering as the hero) */
.footer { position: relative; }
/* from just under the four columns to the bottom (top is set by main.js) */
.footer-trail { inset: 0; overflow: hidden; }
.footer-name { position: relative; z-index: 1; }
.footer-top, .footer-bottom { position: relative; z-index: 3; }
/* top row of the footer: services · recognition · socials · button */
.grid4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
/* every line sits on one grid: 1em text + .35em gap, and the list starts two lines under its label */
.footer-col { display: flex; flex-direction: column; gap: 1.7em; }
.footer-label { font-size: inherit; line-height: 1; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.last-col { grid-column: 4; }   /* bottom line follows the same four columns */
.footer-name {
  font-size: 34vw;
  /* trim the line box to the letters themselves, so the space above and below is what you see */
  text-box: trim-both cap alphabetic;
  padding-bottom: .2em;   /* room for the tail of the j in "de Rooij" */
}
.footer-bottom { line-height: 1; }   /* same distance to the name as the links above it */
.back { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- LIGHTBOX ----------
   The media is always centred on the screen. Equal margins on the left and right keep
   room for the narrow description column (top left) and the arrows; equal margins at
   the top and bottom keep room for the title row. Nothing ever sits on the image. */
.lightbox {
  --edge: clamp(16px, 2.5vw, 43px);                 /* distance to the screen edge */
  --space: clamp(16px, 2vw, 32px);                  /* distance between text and image */
  --desc-w: clamp(170px, 15vw, 260px);              /* description column */
  --side: calc(var(--gutter) + var(--desc-w) + var(--space));
  --vert: calc(var(--edge) + 1.25em + var(--space));
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(19, 19, 19, .78);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
  opacity: 0;
  transition: opacity .4s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lightbox.no-desc { --side: calc(var(--gutter) + 44px + var(--space)); }   /* room for the arrows only */
.lb-stage {
  position: absolute;
  top: var(--stage-y, var(--vert));
  bottom: var(--stage-y, var(--vert));
  left: var(--side);
  right: var(--side);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(.96);
  transition: transform .6s var(--ease);
}
.lightbox.open .lb-stage { transform: none; }
.lb-frame { position: relative; max-width: 100%; max-height: 100%; display: flex; }
.lb-frame img, .lb-frame video {
  max-width: 100%;
  max-height: var(--stage-h, calc(100dvh - 190px));   /* measured height of the centred area */
  width: auto;
  height: auto;
  object-fit: contain;
}
.lb-frame .dots { left: 50%; right: auto; transform: translateX(-50%); }
.lb-info {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--edge);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--gap);
}
.lb-title { line-height: 1; }
.lb-desc {
  position: absolute;
  top: var(--edge);
  left: var(--gutter);
  width: var(--desc-w);
  max-height: calc(100% - 2 * var(--vert));
  overflow-y: auto;                              /* long texts scroll inside their column */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6em;
  white-space: pre-wrap;
  text-wrap: pretty;
}
.lb-desc[hidden] { display: none; }
.lb-desc a { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.lb-prof { line-height: 1; }
/* bottom right: profession, then "Visit project" in the very corner */
.lb-meta { display: flex; align-items: flex-end; gap: var(--gap); margin-left: auto; text-align: right; }
.lb-meta p { margin: 0; }
.lb-url { line-height: 1; white-space: nowrap; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.lb-url[hidden] { display: none; }

.round {
  position: absolute;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  cursor: pointer;
  transition: background-color .3s ease;
}
.round:hover { background: rgba(245, 245, 245, .2); }
.lb-close { top: clamp(16px, 2.5vw, 43px); right: var(--gutter); }
.lb-prev, .lb-next { top: calc(50% - 60px); }
.lb-prev { left: var(--gutter); }
.lb-next { right: var(--gutter); }
body.locked { overflow: hidden; }

/* ---------- SCROLL REVEAL (subtle) ---------- */
/* Body blocks: the live site's scroll appear (from 20px above, 0.6s, ease .44,0,.56,1, 0.3s apart) */
[data-reveal] { --appear: cubic-bezier(.44, 0, .56, 1); }
[data-reveal]:not(:has(.stagger)) { opacity: 0; transform: translateY(-20px); transition: opacity .6s var(--appear), transform .6s var(--appear); }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal] .stagger { opacity: 0; transform: translateY(-20px); transition: opacity .6s var(--appear), transform .6s var(--appear); transition-delay: calc(var(--i, 0) * .3s); }
[data-reveal].in .stagger { opacity: 1; transform: none; }

/* Titles and the large statements: the live site's text effect, word by word,
   each word coming up 10px out of a 10px blur */
[data-split] .w {
  display: inline-block;
  text-indent: 0;              /* the indent belongs to the paragraph, not to each word */
  opacity: 0;
  transform: translateY(10px);
  filter: blur(10px);
  transition: opacity .6s ease, transform .6s var(--ease), filter .6s ease;
  transition-delay: calc(var(--i, 0) * 45ms);
  will-change: transform, filter;
}
[data-split].in .w { opacity: 1; transform: none; filter: none; }

/* Hero entrance, with the live site's values:
   top items drop in from 20px above, 0.6s each, 0.3s after one another;
   the big name comes down 150px over 2.3s, starting after 0.7s. */
.topbar > * { animation: bar-in .6s cubic-bezier(.44, 0, .56, 1) both; }
.topbar > :nth-child(2) { animation-delay: .3s; }
.topbar > :nth-child(3) { animation-delay: .6s; }
.topbar > :nth-child(4) { animation-delay: .9s; }
@keyframes bar-in { from { opacity: 0; transform: translateY(-20px); } }

.hero-name span {
  animation:
    name-move 2.3s cubic-bezier(.16, 1, .3, 1) .7s both,
    name-fade 2.3s cubic-bezier(.44, 0, .56, 1) .7s both;   /* the fade takes the full 2.3s */
}
@keyframes name-move { from { transform: translateY(-150px); } }
@keyframes name-fade { from { opacity: 0; } }

/* Touch screens: no titles on the cards; the title shows in the lightbox after a tap. */
@media (hover: none) {
  .card::after, .card-title { display: none; }
}

/* ---------- TABLET ---------- */
@media (max-width: 1199.98px) {
}

/* ---------- PHONE MENU (hidden on larger screens) ---------- */
.m-bar, .m-menu { display: none; }
.burger { position: relative; width: 30px; height: 20px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.burger span { position: absolute; left: 0; right: 0; height: 2px; background: currentColor; transition: transform .45s cubic-bezier(.22, 1, .36, 1), top .45s cubic-bezier(.22, 1, .36, 1); }
.burger span:first-child { top: 4px; }
.burger span:last-child { top: 14px; }
.burger.is-open span { top: 9px; }
.burger.is-open span:first-child { transform: rotate(45deg); }
.burger.is-open span:last-child { transform: rotate(-45deg); }

/* ---------- PHONE ---------- */
@media (max-width: 809.98px) {
  /* hero: only the name and a hamburger, the big name stays at the bottom */
  .topbar.grid4 { display: none; }
  .m-bar { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 3; line-height: 1; animation: bar-in .6s cubic-bezier(.44, 0, .56, 1) both; }
  /* the menu drops down from the top as a light panel over the page */
  .m-menu {
    display: flex; flex-direction: column; gap: 44px;
    position: fixed; inset: 0 0 auto 0; z-index: 60;
    padding: clamp(16px, 2.5vw, 43px) var(--gutter) 32px;
    background: var(--fg); color: var(--bg);
    transform: translateY(-100%);
    transition: transform .6s cubic-bezier(.22, 1, .36, 1);
  }
  .m-menu .m-bar { animation: none; }
  .m-menu.open { transform: none; }
  .m-links { display: flex; flex-direction: column; gap: 6px; font-size: 32px; line-height: 1.05; letter-spacing: -.01em; }
  .m-meta { display: flex; flex-direction: column; gap: 20px; }
  .m-meta p { margin: 0; }
  /* footer: everything stacked in one column */
  .lead { text-indent: 12%; }
  .wall-track img { width: calc((100% - var(--gap)) / 2); }   /* two on a phone */
  .row { grid-template-columns: 1fr; gap: 14px; padding: 28px 0; }
  .row h3 { max-width: none; }
  .row-text { grid-column: auto; }
  .footer-top { grid-template-columns: 1fr; row-gap: 32px; }
  .footer-top > .right { justify-self: start; text-align: left; }
  .footer-bottom.grid4 { grid-template-columns: 1fr; row-gap: 8px; }
  .footer-bottom .right { justify-self: start; text-align: left; }
  .last-col { grid-column: auto; }
  .card-title { left: 10px; bottom: 10px; }
  .dots { right: 8px; bottom: 8px; gap: 4px; padding: 4px; }
  .dot { width: 7px; height: 7px; }
  .dot.on { width: 18px; }
  .card.has-dots .card-title { right: 76px; }
  .trail-item { width: 140px; height: 175px; }

  .lb-prev, .lb-next { display: none; }      /* swipe instead */
  /* phones: no room beside the image, so the description sits above it; main.js moves
     the centred area down (and up from the bottom by the same amount) to stay clear */
  .lightbox, .lightbox.no-desc { --side: var(--gutter); }
  .lb-desc { right: calc(var(--gutter) + 56px); width: auto; max-height: 34vh; }
  /* title on its own line, then profession left and "Visit project" in the corner */
  .lb-info { flex-wrap: wrap; row-gap: 12px; }
  .lb-title { flex: 1 0 100%; }
  .lb-meta { flex: 1 0 100%; justify-content: space-between; margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, [data-reveal] { opacity: 1; transform: none; transition: none; }
  [data-reveal], [data-reveal] .stagger, [data-split] .w { opacity: 1 !important; transform: none !important; filter: none; transition: none; }
  .topbar > *, .m-bar, .hero-name span { animation: none; }
  .m-menu { transition: none; }
  .card-media > :not(.slide), .wall-track img { opacity: 1; transition: none; }
  .slide, .dot, .lightbox, .lb-stage, .button-roll span, .card-title, .card::after { transition: none; }
}

/* lightbox slideshows show the whole image */
.lb-frame .slide { object-fit: contain; }
