/* v2 homepage. Layout comes from layout.css; values from tokens.css only.
   Each block matches a Figma layer in "Website → Moodboard" (284:30231). */

.content { row-gap: var(--gap-home-section); }

/* ── Shared media pieces ── */
.media { display: block; position: relative; overflow: hidden; background: var(--bg-surface); }
.media img { width: 100%; height: 100%; object-fit: cover; }

/* ── Sidebar cards ── */
.card-video { border-radius: var(--radius-small); aspect-ratio: 235 / 156; }
.card-swipe {
  display: grid; border-radius: var(--radius-small);
  width: min(100%, var(--size-swipe-card)); /* fills the sidebar up to 276px, then stays that size */
  text-align: left;
}
.card-swipe > * { grid-area: 1 / 1; }
.card-swipe > picture img { height: auto; }
.card-swipe .label {
  justify-self: stretch; align-self: start;
  margin: calc(var(--gap-stack) + var(--gap-hair)) var(--gap-group); /* label top-left, arrow top-right */
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-inline);
  color: var(--text-muted); transition: color var(--dur-hover) ease;
  position: relative; z-index: 1;
}
.card-swipe .label img { width: 9px; height: auto; opacity: .7; rotate: -45deg; transition: translate var(--dur-hover) ease; }
@media (hover: hover) and (pointer: fine) {
  .card-swipe:hover .label { color: var(--text-strong); }
  .card-swipe:hover .label img { translate: 1px -1px; }
}
.card-swipe:active { scale: var(--press-scale); }
.card-swipe { transition: scale var(--dur-press) var(--ease-enter); }

/* ── About (dark card) ── */
.about {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--gap-section);
  min-height: 271px;
  padding: calc(var(--gap-section) + var(--gap-inline)) var(--gap-section) var(--gap-section);
  border-radius: var(--radius-large);
  background: var(--bg-inverse);
}
.about-text { display: flex; flex-direction: column; gap: var(--gap-group); max-width: min(100% - 217px, 560px); position: relative; z-index: 1; } /* everything left of the badge (169 + 46 in from the edge), up to a comfortable line; Figma: 366 at 1024 */
.about-text .hello { font-size: var(--size-lead); color: var(--text-strong); }
.about-text p { color: var(--text-muted); text-wrap: pretty; }
.about-text p em { font-weight: var(--weight-regular); color: var(--text-body); }
.about-badge { position: absolute; top: 0; right: 46px; width: 169px; pointer-events: none; } /* hangs from the top edge, 46px in from the right (Figma) */
.about-divider { position: absolute; left: 0; top: 222px; width: 317px; pointer-events: none; }
.worked-for { display: flex; flex-direction: column; gap: var(--gap-inline); position: relative; z-index: 1; }
.worked-for-head { display: flex; align-items: center; justify-content: space-between; }
.logo-pause, .logos.logo-copy { display: none; }
.worked-for .t-label { color: var(--text-faint); }
.logos { display: flex; align-items: center; gap: var(--gap-stack) var(--gap-list); flex-wrap: wrap; }
.logos a { display: block; position: relative; padding-block: var(--gap-inline); margin-block: calc(-1 * var(--gap-inline)); } /* taller tap target, same layout */
.logos a:focus-visible::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: var(--px-2); block-size: var(--px-2); background: var(--text-muted); }
@media (hover: hover) and (pointer: fine) {
  .logos img { transition: filter var(--dur-hover) ease; }
  .logos a:hover img { filter: brightness(1.45); } /* the grey logo lifts toward white on the dark card */
}
/* Logos keep the size Figma draws each one at (372:51474); width/height live on the <img>. */

/* ── Project rows ── */
.content > #work {
  margin-block-start: calc(var(--gap-home-work-start) - var(--gap-home-section));
  row-gap: var(--gap-section);
}

.project-media { display: grid; place-items: center; border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--border-subtle); padding-block: var(--gap-section); container-type: inline-size; }
.project-media.is-wide { border-radius: var(--radius-large); }
.project-media.has-cover { padding: 0; border-radius: var(--radius-card); background: none; box-shadow: none; } /* one composed Figma cover per case study, its own background and corners */
.project-media.has-cover picture { inline-size: 100%; } /* the centred grid would otherwise shrink it to 0 until the image loads */
.project-media.has-cover img { width: 100%; height: auto; }
.project-media.has-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border: thin solid var(--border-default); border-radius: inherit;
}
.project-text { display: grid; gap: var(--gap-inline); color: var(--text-muted); }
.project-text header { display: grid; gap: var(--gap-hair); }
.project-text .project-meta { text-transform: none; letter-spacing: var(--track-body); }
@media (hover: hover) and (pointer: fine) {
  .project-link { transition: box-shadow var(--dur-hover) ease; }
  .project-link:hover { box-shadow: var(--shadow-photo); }
}
@media (prefers-reduced-motion: no-preference) {
  .project-link { transition: scale var(--dur-press) var(--ease-enter), box-shadow var(--dur-hover) ease; }
  .project-link:active { scale: var(--press-scale); }
}

/* ── Design process ── */
.process { border-radius: var(--radius-card); background: var(--bg-sunken); box-shadow: 0 0 0 .5px var(--border-default); overflow: hidden; }
.process-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--gap-hair) var(--gap-group); padding: var(--pad-card); }
.process-head .kicker { flex-basis: 100%; max-width: none; } /* own line; the paragraph measure cap would let the title slide up beside it */
.process-head h2 { flex: 1 1 auto; }
.process-head .kicker { font-family: var(--font-hand); font-size: var(--size-11); line-height: 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.process-head .note { margin-inline-start: auto; color: var(--text-faint); } /* drops to its own line when the title needs the room */
.process-board {
  display: flex; justify-content: center;
  padding: 44px var(--gap-group) var(--gap-section);
  border-radius: var(--radius-card);
  background: var(--bg-page);
  box-shadow: 0 0 1px var(--border-strong);
}
/* The row fills the board and scales with it: --s is 1 at the Figma width (1024 screen) and grows to 1.3 on wide screens.
   Steps share equal columns so labels never collide; each arrow is centred on the line between two columns,
   above the logos, and the smiley closes the row in line with them. */
.process-board { container-type: inline-size; }
.process-row {
  --s: clamp(1, 100cqi / 615px, 1.3);
  --logo: calc(42px * var(--s));
  --arrow: calc(45px * var(--s));
  --arrow-rise: calc(-15px * var(--s));
  --smiley: calc(30px * var(--s));
  display: flex; align-items: flex-start; width: 100%;
}
.steps { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; }
.step { display: flex; flex-direction: column; align-items: center; gap: var(--gap-inline); padding-inline: var(--gap-tight); position: relative; z-index: 1; min-width: 0; }
.step img { height: var(--logo); width: auto; }
.step span { font-family: var(--font-hand); color: var(--text-muted); text-align: center; text-wrap: balance; }
.step + .step::before {
  content: ""; position: absolute; left: 0; top: var(--arrow-rise); translate: -50% 0;
  width: var(--arrow); aspect-ratio: 45.2 / 8.36;
  background: url("media/home/process-arrow.svg") center / contain no-repeat;
  pointer-events: none;
}
.process-end { flex: none; display: flex; align-items: flex-start; height: var(--logo); gap: var(--gap-tight); }
.process-arrow-smiley { width: var(--arrow); height: auto; margin-inline-start: calc(var(--arrow) / -2); margin-top: var(--arrow-rise); }
.process-smiley { width: var(--smiley); height: auto; align-self: center; }

/* ── "Just a designer" note ── */
#other > .note { position: relative; }
.note-paper {
  position: relative; overflow: hidden;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--bg-surface);
  isolation: isolate;
}
.note-paper > picture { position: absolute; inset: 0; }
.note-paper > picture img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: luminosity; opacity: var(--texture-opacity); } /* exactly Figma's layer settings */
.note-paper > picture img.loading-blur.is-loaded { opacity: var(--texture-opacity); }
.note-body { position: relative; display: flex; flex-direction: column; gap: var(--gap-stack); padding: 28px var(--gap-section) var(--gap-section); color: var(--text-body); }
.note-body .copy { display: flex; flex-direction: column; gap: var(--gap-group); }
.note-body .copy p { max-width: none; } /* the note is the measure: text runs to its padding, as in Figma */
.note-pin { position: absolute; left: 50%; top: -25px; width: 50px; translate: -50% 0; z-index: 1; pointer-events: none; }

/* ── Off-the-clock photos (polaroids) ── */
.photos {
  /* Figma draws the gallery for a 647px column. --u scales every polaroid, and the overlap between them,
     with the real column width, so the gallery always spans the column like the note above it. */
  --u: calc(100cqi / 647);
  display: flex; justify-content: center; align-items: flex-end;
  /* Keep the section gap visible after the tilted corners rise above the row. */
  padding-top: calc(var(--gap-home-section) - var(--gap-list) + 8 * var(--u));
  margin-bottom: calc(-20 * var(--u));
}
#other { container-type: inline-size; } /* the last ~20px of each polaroid runs off the page bottom (Figma) */
.content:has(> #other .photos) { padding-bottom: 0; }
.polaroid {
  flex: none; margin-inline-end: calc(-10 * var(--u));
  display: flex; flex-direction: column; align-items: center; gap: calc(4 * var(--u));
  padding: calc(5 * var(--u)) calc(5 * var(--u)) calc(4 * var(--u));
  background: var(--bg-raised);
  box-shadow: var(--shadow-photo);
  rotate: var(--tilt);
}
.polaroid:last-child { margin-inline-end: 0; }
.polaroid figcaption { order: -1; font-family: var(--font-hand); font-size: clamp(var(--size-11), calc(11px * 100cqi / 647px), var(--size-13)); line-height: 1.45; color: var(--text-faint); text-align: center; max-width: 90%; }
.polaroid picture, .polaroid img { display: block; }
.polaroid img { width: calc(var(--w) * var(--u)); height: auto; }

/* ── Smaller screens ── */
@media (max-width: 899px) {
  .about-badge { right: -24px; }
  .about-text { max-width: 60%; }
  .step + .step::before, .process-end { display: none; }
  .photos { overflow-x: clip; }
}
@media (max-width: 719px) {
  .card-swipe { width: 100%; block-size: calc(var(--size-swipe-card) * 178 / 235); background: var(--bg-sunken); }
  .card-swipe > picture {
    inline-size: min(100%, calc(var(--size-swipe-card) + var(--gap-section)));
    min-block-size: 0; justify-self: center;
    mask-image: linear-gradient(to right, transparent, var(--text-strong) var(--gap-inline), var(--text-strong) calc(100% - var(--gap-inline)), transparent);
  }
  .card-swipe > picture img { height: 100%; object-position: center bottom; }
  .about { min-height: 0; padding-block-start: 0; }
  .about-badge { position: relative; right: auto; top: auto; align-self: center; order: -1; }
  .about-text { max-width: none; }
  .process-board { padding-top: var(--gap-section); }
  .process-row { width: 100%; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-section) var(--gap-stack); }
  .photos { flex-wrap: wrap; justify-content: center; row-gap: var(--gap-group); }
  .polaroid { margin-inline-end: 0; padding: 5px 5px 4px; gap: var(--gap-tight); }
  .polaroid img { width: min(40vw, calc(var(--w) * 1px)); height: auto; }
  .photos { margin-bottom: -20px; }
}

/* A static, scrollable row is the fallback and the reduced motion presentation. */
@media (max-width: 719px) {
  .logo-viewport { overflow-x: auto; scrollbar-width: none; }
  .logo-track { display: flex; inline-size: max-content; }
  .logos { flex: none; flex-wrap: nowrap; }
  .logos li { flex: none; }
}
@media (max-width: 719px) and (prefers-reduced-motion: no-preference) {
  .worked-for.is-looping .logo-viewport {
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, var(--text-strong) var(--gap-group), var(--text-strong) calc(100% - var(--gap-group)), transparent);
  }
  .worked-for.is-looping .logos { display: flex; padding-inline-end: var(--gap-list); }
  .worked-for.is-looping .logo-track { animation: logo-loop var(--dur-logo-loop) linear infinite paused; }
  .worked-for.is-looping.is-visible:not(:has(.logo-pause[aria-pressed="true"])) .logo-track { animation-play-state: running; }
  .logo-pause {
    display: grid; place-items: center; position: relative;
    inline-size: var(--gap-chapter); block-size: var(--gap-chapter);
    border-radius: var(--radius-small); color: var(--text-muted);
    touch-action: manipulation;
  }
  .logo-pause::after { content: ""; position: absolute; inset: calc((var(--gap-chapter) - var(--size-touch-target)) / 2); }
  .logo-pause svg { inline-size: var(--gap-group); }
  .logo-play-icon, .logo-pause[aria-pressed="true"] .logo-pause-icon { display: none; }
  .logo-pause[aria-pressed="true"] .logo-play-icon { display: block; }
  /* Four identical groups share the track. Moving by one group brings the first repeat into place. */
  @keyframes logo-loop { to { transform: translateX(-25%); } }
}

/* ── Arrival: blocks rise in from a soft blur as they reach the screen (v1 rule) ── */
.reveal { opacity: 0; filter: blur(var(--reveal-blur)); translate: 0 var(--reveal-rise); transition: opacity var(--dur-reveal) var(--ease-enter), filter var(--dur-reveal) var(--ease-enter), translate var(--dur-reveal) var(--ease-enter); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; filter: none; translate: none; }
/* Images: a quiet surface first, then the image resolves over it (v1 rule). */
/* Loading state: until its image arrives, every picture frame shows a sunken block in the image's exact
   shape that breathes slowly, so the page never has holes. The image then resolves on top of it. */
:is(.media, .case-media, .swipe-media, .polaroid picture, .step picture, .case-avatar):has(img.loading-blur:not(.is-loaded)) {
  background-color: var(--bg-sunken);
  animation: image-wait var(--dur-wait) ease-in-out infinite alternate;
}
@keyframes image-wait { to { background-color: var(--bg-surface); } }
img.loading-blur { opacity: 0; filter: blur(8px); transition: opacity var(--dur-image) var(--ease-enter), filter var(--dur-image) var(--ease-enter); }
img.loading-blur.is-loaded { opacity: 1; filter: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, img.loading-blur { opacity: 1; filter: none; translate: none; transition: none; }
}
