/* project page styles — owned by the project page agent */

.proj { position: relative; }
.proj-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ===== Hero ===== */
.proj-hero {
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: var(--pbg);
  color: var(--pfg);
}
.proj-hero__stage { position: absolute; inset: 0; will-change: transform; }
.proj-hero__field { position: absolute; inset: 0; width: 100%; height: 100%; }
.proj-hero__body {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding-bottom: clamp(20px, 3.2vw, 44px);
  pointer-events: none;
}
.proj-hero__body a { pointer-events: auto; }
.proj-hero.is-animal { cursor: pointer; }

.proj-hero__kicker {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: clamp(14px, 1.6vw, 22px);
}
.proj-hero__idx { font-variant-numeric: tabular-nums; }
.proj-hero__rule { width: 28px; height: 1px; background: currentColor; opacity: .5; transform-origin: left; }

.proj-hero__name {
  font-size: min(var(--t-3xl), calc((100vw - 2 * var(--gutter)) / (var(--len, 8) * 0.6)));
  max-width: 100%;
  margin-left: -0.04em;
  hyphens: none; overflow-wrap: normal;
}
/* Word masks get horizontal slack: negative tracking makes each word box narrower than its ink,
   and overflow:hidden would shave the last glyph. Padding + equal negative margin = same layout. */
.proj-hero__name .w { padding-left: .03em; margin-left: -.03em; padding-right: .1em; margin-right: -.1em; }
.proj-sum .w { padding-right: .05em; margin-right: -.05em; }
/* The global ring is the accent, which is AdFlint's hero colour: use the project ink instead. */
.proj-hero :focus-visible { outline-color: var(--pfg); }

.proj-hero__foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: clamp(24px, 4vw, 64px);
  margin-top: clamp(20px, 2.4vw, 36px);
}
.proj-hero__meta {
  flex: 1 1 auto; max-width: max(900px, 50vw); margin: 0;
  display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
  gap: 0 clamp(16px, 2vw, 28px);
}
.proj-hero__item { padding-top: 12px; position: relative; }
.proj-hero__item::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: currentColor; opacity: .32;
  transform: scaleX(0); transform-origin: left;
  transition: transform 1.1s var(--ease-out); transition-delay: var(--d, 0ms);
}
/* Small text stays at full strength; the label/value hierarchy comes from face, size and tracking. */
.proj-hero__item dt { margin-bottom: 7px; letter-spacing: .09em; font-weight: 500; }
.proj-hero__item dd { margin: 0; font-size: clamp(15px, calc(12.5px + .24vw), 20px); line-height: 1.3; font-weight: 500; letter-spacing: -0.005em; }
.proj-hero__link { position: relative; display: inline-flex; gap: .3em; padding-bottom: 1px; }
/* The only tappable item in the hero gets a finger-sized hit area; the text, underline and focus
   ring keep their size. */
@media (any-pointer: coarse) {
  .proj-hero__link::after { content: ""; position: absolute; inset: -12px -6px; }
}
.proj-hero__arr { display: inline-block; transition: transform .45s var(--ease-spring); }
.proj-hero__link:hover .proj-hero__arr { transform: translate(2px, -2px); }

.proj-hero__why {
  flex: 0 1 30ch; max-width: 30ch; min-width: min(21ch, 100%); text-align: right;
  font-family: var(--f-mono); font-size: clamp(12px, calc(10.5px + .16vw), 14px); line-height: 1.55; letter-spacing: 0; font-weight: 500;
  text-wrap: balance;
}

/* hero arrival (driven by .is-ready, not the scroll reveal: it sits below the reveal margin) */
.proj-hero__kicker, .proj-hero__item dt, .proj-hero__item dd, .proj-hero__why {
  opacity: 0; transform: translateY(14px);
  transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.proj-hero__kicker { --d: 200ms; }
.proj-hero__item dd { transition-delay: calc(var(--d, 0ms) + 60ms); }
.proj-hero.is-ready .proj-hero__kicker,
.proj-hero.is-ready .proj-hero__item dt,
.proj-hero.is-ready .proj-hero__item dd,
.proj-hero.is-ready .proj-hero__why { opacity: 1; transform: none; }
.proj-hero.is-ready .proj-hero__item::before { transform: none; }

/* ===== Body ===== */
.proj-body {
  position: relative; z-index: 1;
  background: var(--ink); color: var(--sand);
  padding-top: clamp(96px, 13vw, 210px);
  padding-bottom: clamp(110px, 13vw, 210px);
}
.proj-sum {
  font-size: var(--t-xl);
  font-weight: 650; line-height: 1.02; letter-spacing: -0.032em;
  max-width: 22ch;
  margin-bottom: clamp(72px, 10vw, 160px);
  text-wrap: balance;
}

.proj-sec {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  column-gap: var(--gutter);
  padding-top: clamp(56px, 7vw, 120px);
}
.proj-sec__label {
  grid-column: 1; align-self: start;
  position: sticky; top: calc(var(--hdr-h) + 20px);
  display: flex; gap: 14px; align-items: baseline;
  font: 500 var(--t-xs)/1.4 var(--f-mono); letter-spacing: .02em; text-transform: lowercase;
  color: var(--sand);
  padding-top: 4px;
}
.proj-sec__idx { color: var(--sand-dim); }
.proj-sec__main { grid-column: 2; min-width: 0; }
.proj-sec--wide .proj-sec__label { position: static; }
.proj-sec--wide .proj-sec__main { grid-column: 1 / -1; margin-top: clamp(28px, 3vw, 44px); }

/* overview */
.proj-overview { max-width: 36em; }
.proj-overview p { font-size: clamp(19px, 1.55vw, 24px); line-height: 1.5; letter-spacing: -0.006em; }
.proj-overview p + p { margin-top: 1.05em; color: var(--sand-2); }

/* what I did */
.proj-did { max-width: 40em; border-bottom: 1px solid var(--line); counter-reset: none; }
.proj-did__item {
  display: grid; grid-template-columns: 3.4em minmax(0, 1fr); align-items: baseline;
  gap: 12px; padding: clamp(20px, 2.1vw, 30px) 0;
}
.proj-did__n { color: var(--sand-dim); }
.proj-did__t { font-size: var(--t-lg); line-height: 1.24; letter-spacing: -0.016em; font-weight: 500; text-wrap: pretty; }

/* numbers */
.proj-stats {
  display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 0 var(--gutter);
  --stat: clamp(56px, 7.4vw, 132px);
}
.proj-stats[data-n="4"] { --stat: clamp(56px, 6.2vw, 120px); }
/* a lone figure lines up with the list above it, hairline for hairline */
.proj-stats--solo { grid-template-columns: minmax(0, 1fr); max-width: 40em; }
.proj-stats--solo .proj-stat { display: flex; align-items: flex-end; gap: clamp(20px, 3vw, 44px); }
.proj-stats--solo .proj-stat__label { margin: 0 0 .5em; max-width: 30ch; font-size: 13px; }
.proj-stat { padding: clamp(22px, 2.2vw, 32px) 0 6px; min-width: 0; }
.proj-stat__num {
  display: flex; align-items: baseline; white-space: nowrap;
  font-size: var(--stat); line-height: .9; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
/* the invisible final value reserves the exact width, so the suffix never jumps while counting;
   without a suffix the count sits flush with the column edge instead */
.proj-stat__val { display: inline-grid; justify-items: end; }
.proj-stat__val.is-start { justify-items: start; }
.proj-stat__ghost, .proj-stat__count { grid-area: 1 / 1; }
.proj-stat__ghost { visibility: hidden; }
.proj-stat__pre { font-size: .26em; font-weight: 500; letter-spacing: -0.01em; margin-right: .45em; color: var(--sand-2); align-self: baseline; }
.proj-stat__suf { letter-spacing: -0.03em; }
.proj-stat__suf.is-small { font-size: .38em; align-self: flex-start; margin-left: .06em; letter-spacing: 0; transform: translateY(.18em); }
.proj-stat__label { margin-top: 18px; color: var(--sand-dim); max-width: 30ch; line-height: 1.5; text-wrap: balance; }

/* stack */
.proj-stack { display: flex; flex-wrap: wrap; gap: 10px; }
.proj-stack li {
  border: 1px solid var(--sand-faint); border-radius: 999px;
  padding: .55em 1.15em .6em; font-size: var(--t-md); line-height: 1.2; letter-spacing: -0.01em;
}

/* visit */
.proj-sec--cta { padding-top: clamp(64px, 8vw, 128px); }
.proj-visit {
  position: relative; display: inline-grid; isolation: isolate;
  border: 1px solid var(--sand-faint); border-radius: 999px; overflow: hidden;
  font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.02em; line-height: 1;
  transition: border-color .5s var(--ease-out), transform .5s var(--ease-spring);
}
.proj-visit:hover { border-color: var(--pbg); }
.proj-visit:focus-visible { outline-color: var(--sand); }
.proj-visit:active { transform: scale(.98); }
.proj-visit__label { display: inline-flex; align-items: center; gap: .35em; padding: .95em 1.5em 1em; white-space: nowrap; }
.proj-visit__arr { display: inline-block; transition: transform .55s var(--ease-spring); }
.proj-visit:hover .proj-visit__arr { transform: translate(.1em, -.1em); }
.proj-visit__fill {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  background: var(--pbg); color: var(--pfg);
  clip-path: circle(0px at 50% 50%);
  pointer-events: none;
}

/* ===== Next project ===== */
.proj-next {
  position: relative; display: block; overflow: hidden; isolation: isolate;
  background: var(--ink); color: var(--sand);
  border-top: 1px solid var(--line);
}
.proj-next:focus-visible { outline: none; }
.proj-next:focus-visible::after {
  content: ""; position: absolute; inset: 8px; z-index: 3; pointer-events: none;
  border: 2px solid var(--nfg); border-radius: 6px;
}
.proj-next__content {
  position: relative;
  min-height: 70vh; min-height: 70svh;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  padding: clamp(22px, 2.8vw, 40px) var(--gutter) clamp(24px, 3.2vw, 48px);
}
.proj-next__fill {
  position: absolute; inset: 0; z-index: 1;
  background: var(--nbg); color: var(--nfg);
  clip-path: circle(0px at 50% 50%);
  pointer-events: none;
}
.proj-next__fill .proj-next__content { position: absolute; inset: 0; min-height: 0; }
.proj-next.is-static .proj-next__fill { clip-path: none; }
.proj-next__field { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .6s var(--ease-out); }
.proj-next.is-on .proj-next__field { opacity: 1; transition: opacity .9s var(--ease-out) .1s; }

.proj-next__rv {
  opacity: 0; transform: translateY(28px);
  transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.proj-next.is-seen .proj-next__rv { opacity: 1; transform: none; }
.proj-next__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.proj-next__top .mono { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .08em; }
.proj-next__idx { font-weight: 400; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.proj-next__rule { width: 28px; height: 1px; background: currentColor; }
.proj-next__arrow {
  display: inline-block; font-size: var(--t-xl); line-height: .7; font-weight: 500;
  transition: transform .9s var(--ease-out);
}
.proj-next.is-on .proj-next__arrow { transform: translateX(-.18em); }
.proj-next__kicker { width: fit-content; margin-bottom: clamp(12px, 1.4vw, 20px); }
.proj-next__name {
  font-size: min(var(--t-3xl), calc((100vw - 2 * var(--gutter)) / (var(--len, 8) * 0.6)));
  margin-left: -0.04em;
  hyphens: none; overflow-wrap: normal;
}
.proj-next__name span { display: inline-block; transition: transform 1s var(--ease-out); }
.proj-next.is-on .proj-next__name span { transform: translateX(.06em); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .proj-hero__meta { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
}

/* Portrait / narrow: the animal sits above, everything else stacks under it. */
@media (max-width: 759px), (max-aspect-ratio: 20/23) {
  .proj-hero__foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .proj-hero__name, .proj-next__name { font-size: min(22vw, 112px, calc((100vw - 2 * var(--gutter)) / (var(--len, 8) * 0.6))); }
  .proj-hero__meta { max-width: 560px; grid-template-columns: minmax(0, 1fr); }
  .proj-hero__item { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 7px 0 8px; }
  .proj-hero__item dd { font-size: 15px; line-height: 1.3; }
  .proj-hero__item dt { margin: 0; }
  .proj-hero__why { flex: none; max-width: 40ch; text-align: left; font-size: 12px; }
}

/* Short phones (SE, small Androids, Safari with its toolbars): the text gives up room so the
   animal keeps a readable size above it. */
@media (max-width: 759px) and (max-height: 740px) {
  .proj-hero__name { font-size: min(16vw, 72px, calc((100vw - 2 * var(--gutter)) / (var(--len, 8) * 0.6))); }
  .proj-hero__kicker { margin-bottom: 12px; }
  .proj-hero__foot { margin-top: 16px; gap: 10px; }
  .proj-hero__item { grid-template-columns: 64px minmax(0, 1fr); padding: 5px 0 6px; }
  .proj-hero__item dd { font-size: 14px; }
}
@media (max-width: 759px) and (max-height: 680px) {
  .proj-hero__why { display: none; }
}

@media (max-width: 820px) {
  .proj-sec { grid-template-columns: minmax(0, 1fr); }
  .proj-sec__label { position: static; margin-bottom: 26px; }
  .proj-sec__main { grid-column: 1; }
  .proj-sec--wide .proj-sec__main { margin-top: 0; }
  .proj-did__item { grid-template-columns: 2.6em minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .proj-stats { grid-template-columns: minmax(0, 1fr); --stat: clamp(52px, 16vw, 72px); }
  .proj-stats[data-n="4"] { --stat: clamp(52px, 16vw, 72px); }
  .proj-stat { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 20px 0 18px; }
  .proj-stat__label { margin: 0 0 .3em; text-align: right; max-width: 17ch; }
  .proj-visit { display: grid; width: 100%; }
  .proj-visit__label { justify-content: center; padding: 1em 1.2em 1.05em; }
  .proj-next__content { min-height: 74svh; }
}

/* Landscape phones / short windows: the whole hero block fits on the first screen. */
@media (max-height: 520px) and (min-width: 760px) {
  .proj-hero { min-height: 320px; }
  .proj-hero__name { font-size: min(18vh, calc((100vw - 2 * var(--gutter)) / (var(--len, 8) * 0.6))); }
  .proj-hero__kicker { margin-bottom: 10px; }
  .proj-hero__foot { margin-top: 14px; }
  .proj-hero__item { padding-top: 9px; }
  .proj-hero__item dd { font-size: 14px; }
  .proj-hero__why { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .proj-hero__kicker, .proj-hero__item dt, .proj-hero__item dd, .proj-hero__why { transform: none; }
  .proj-hero__stage { will-change: auto; }
  .proj-next__rv { transform: none; }
}
