/* Material · home · v4
   hero: the line alone on the gradient, dropping to its outline as you leave
   services: each trade pinned while it builds itself in 3D, its name passing behind
   about on celeste, clients on paper, sliding left */

/* ── Hero ──────────────────────────────────────────────── */
.hero { position: relative; height: 170svh; }
.hero__pin { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--gradient-hero); }
/* photos cut in and out behind the line; the script places them */
.hero__photos { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: var(--out, 1); }
.hero__photos img { position: absolute; top: 0; left: 0; display: block; object-fit: cover; filter: brightness(0.8); visibility: hidden; }
.hero__inner { position: relative; display: grid; align-content: center; height: 100%; padding-top: var(--space-700); }
.hero__inner { opacity: var(--out, 1); transform: scale(var(--grow, 1)); }
.hero__title { display: grid; }
/* bottom padding keeps the descenders inside the clipped gradient */
.hero__title > * { grid-area: 1 / 1; display: block; padding-bottom: 0.16em; }
.hero__fill { color: #fff; }
/* where a photo sits behind, the fill is cut away and only the outline is left (rects from the script) */
.hero__title {
  --m0x: 0px; --m0y: 0px; --m0w: 0px; --m0h: 0px; --m1x: 0px; --m1y: 0px; --m1w: 0px; --m1h: 0px;
  --hole-0: linear-gradient(#000 0 0) var(--m0x) var(--m0y) / var(--m0w) var(--m0h) no-repeat;
  --hole-1: linear-gradient(#000 0 0) var(--m1x) var(--m1y) / var(--m1w) var(--m1h) no-repeat;
}
.hero__fill {
  -webkit-mask: linear-gradient(#000 0 0), var(--hole-0), var(--hole-1);
  mask: linear-gradient(#000 0 0), var(--hole-0), var(--hole-1);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.hero__edge { color: transparent; -webkit-text-stroke: 1.5px #fff; -webkit-mask: var(--hole-0), var(--hole-1); mask: var(--hole-0), var(--hole-1); }
.hero__line { color: transparent; -webkit-text-stroke: 1.5px var(--color-text); }
.hero__title [data-fit] { --wdth: 25; }
/* arrival: big and in outline, it settles to size and fills in, the outline gives way */
.js .hero__title { opacity: 0; transform: scale(1.4); }
.js .hero__fill { opacity: 0; }
.is-fit .hero__title { opacity: 1; transform: none; transition: opacity 400ms var(--ease), transform 1600ms var(--ease); }
.is-fit .hero__fill { opacity: 1; transition: opacity 900ms var(--ease) 700ms; }
.is-fit .hero__line { opacity: 0; transition: opacity 700ms var(--ease) 1100ms; }
/* leaving mirrors the arrival: the fill drops back to the outline, which grows and fades.
   is-settled hands the layers from the intro transitions to the scroll */
.hero.is-settled .hero__fill { opacity: calc(1 - var(--a, 0)); transition: none; }
.hero.is-settled .hero__line { opacity: var(--a, 0); transition: none; }
@media (prefers-reduced-motion: reduce) {
  .js .hero__title { transform: none; }
  .hero__line { display: none; }
}

/* ── Services: the pin lasts as long as the section is taller than the screen ── */
.obras { position: relative; }
.obra { position: relative; height: 380svh; }
/* every other trade on a ground a shade lighter, so they read as alternating bands */
.obra:nth-of-type(even) {
  --lift: color-mix(in srgb, var(--color-bg) 98%, var(--color-text));
  background: linear-gradient(var(--color-bg), var(--lift) var(--space-300) calc(100% - var(--space-300)), var(--color-bg)); /* a short ease in and out of its neighbours */
} /* armado3d.ts tints the piece's faces to match */
.obra__stage {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* or the track grows to the unfitted name */
  align-items: center;
  height: 100svh;
  overflow: hidden;
}
.obra__stage > * { grid-area: 1 / 1; }
.obra__name { will-change: transform; }
.obra__title { padding-bottom: 0.16em; }
.obra__view { align-self: stretch; margin-bottom: clamp(90px, 13svh, 130px); } /* leaves the foot block its own room */
/* over the canvas: what the trade is, then what it covers, centred low in the frame */
.obra__foot {
  position: relative; z-index: var(--z-content);
  align-self: end;
  padding-bottom: var(--space-500);
  text-align: center;
}
.obra__desc { color: var(--color-accent); font-weight: 700; font-size: var(--text-2xl); line-height: var(--leading-2xl); }
.obra__items { margin-top: var(--space-75); color: var(--color-text-3); white-space: pre-wrap; }
/* wider screens: each trade two thirds of the screen tall and in the flow, so the next shows below;
   the piece a little smaller, centred, the name across behind */
@media (min-width: 48rem) {
  .obra { height: 100svh; }
  .obra__desc { font-size: var(--text-4xl); line-height: var(--leading-4xl); }
  .obra__stage { position: relative; height: 100%; padding-block: var(--space-900) var(--space-700); }
  .obra__view { width: 76%; justify-self: center; margin-bottom: clamp(80px, 11svh, 110px); }
  .obra__name { align-self: start; padding-top: var(--space-400); }
}
/* one canvas over the page; each stage is drawn into its own viewport */
.armado__canvas { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.no-webgl .armado__canvas { display: none; }

/* ── About: a celeste sheet on the cutting mat, pinned while it is read ───── */
.statement { --m: 56px; --mat-1: rgb(242 239 230 / 0.07); --mat-2: rgb(242 239 230 / 0.18); position: relative; }
/* the mat: 45° guides corner to corner, an 80px grid and a 16px one, in paper on the ink */
/* shorter than the screen and not pinned, so the clients show underneath while it is read */
.statement__pin {
  position: relative; display: grid; place-items: center; height: 76svh; min-height: 520px; padding: var(--m);
  background:
    linear-gradient(45deg, transparent calc(50% - 0.5px), var(--mat-2) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), var(--mat-2) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(var(--mat-2) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, var(--mat-2) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(var(--mat-1) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, var(--mat-1) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--color-bg);
}
/* one paragraph, one size; the second sentence comes in a third along */
.statement__sheet {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  width: min(100%, calc(var(--container) - 2 * var(--gutter))); height: 100%; max-height: 760px;
  padding: var(--space-700) var(--space-600);
  isolation: isolate; /* keeps the paper (::before) above the celeste and under the words */
  background: var(--color-accent); color: var(--color-accent-ink);
  box-shadow: 0 24px 60px -30px rgb(0 0 0 / 0.8);
  font-size: var(--text-6xl); font-weight: 500; line-height: 1.05; letter-spacing: -0.04em;
}
/* paper: a soft mottle and short fibres running across, light against the celeste */
.statement__sheet::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.08' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23f)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='480'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='2' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='480' height='480' filter='url(%23m)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay; opacity: 0.5;
}
.statement__sheet p { max-width: 20em; margin: 0; }
.statement__sheet p + p { margin-top: 0.35em; font-weight: 400; color: #fff; }
.statement strong { font-weight: 700; }
.statement__name { font-weight: 800; }
/* each corner: two hairlines that stop short of the sheet */
.is-reading .w { opacity: 0.22; transition: opacity var(--dur-fade) var(--ease); }
.is-reading .w.on { opacity: 1; }

/* ── Clients: paper, a first third that says who, logos sliding under it ── */
.clients {
  --ink-line: rgb(19 18 9 / 0.14);
  --cross: rgb(19 18 9 / 0.45);
  --pitch-x: 160px; --pitch-y: 80px; /* cells on the About mat's 80px grid: two squares wide, one tall */
  position: relative; background: var(--color-text); color: var(--color-accent-ink);
}
.clients__pin { position: relative; overflow: hidden; }
.clients__view { display: flex; align-items: center; padding-block: var(--section-pad); }
/* a contact sheet: hairline cells, a cross at every corner */
.clients__track {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(3, calc(var(--pitch-y) - 1px)); grid-auto-columns: calc(var(--pitch-x) - 1px);
  gap: 1px; /* cell plus gap is the pitch, so every rule lands on an 80px line */
  margin: 0 0 0 round(up, 25% + var(--space-600), 80px); padding: 0; list-style: none;
  background: var(--ink-line);
  border: var(--hairline) solid var(--ink-line);
  will-change: transform;
}
.clients__cell { position: relative; display: grid; place-items: center; padding: var(--space-100) var(--space-200); background: var(--color-text); }
.clients__cell::after {
  content: ""; position: absolute; right: -5px; bottom: -5px; z-index: 1;
  width: 9px; height: 9px;
  background:
    linear-gradient(var(--cross), var(--cross)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(var(--cross), var(--cross)) 0 50% / 100% 1px no-repeat;
}
.clients__cell img { width: 100%; height: 100%; object-fit: contain; filter: brightness(0); opacity: 0.85; }
/* the first quarter stays put, on paper, above the logos going by */
.clients__intro {
  position: absolute; inset: 0 auto 0 0; z-index: 2;
  width: calc(round(25%, 80px) + 1px); max-width: none; margin: 0; /* its rule on an 80px line too */
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-300);
  background: var(--color-text);
  border-right: var(--hairline) solid var(--ink-line);
}
/* quiet: the label small, the phrase not much bigger, its end in celeste (the darker one that reads on paper) */
.clients__label { margin: 0; font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--leading-base); font-weight: 600; color: rgb(19 18 9 / 0.6); }
.clients__phrase { max-width: 12em; margin: 0; font-size: clamp(1.25rem, 1.9vw, 2rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: rgb(19 18 9 / 0.8); }
.clients__phrase em { font-style: normal; color: var(--color-accent-on-paper); }

/* ── Instagram: a row of the latest posts ─────────────── */
.ig { padding-block: calc(var(--section-pad) * 1.5); }
.ig__logo { margin: 0; line-height: 0; color: var(--color-text-3); }
.ig__logo svg { width: var(--space-600); height: var(--space-600); fill: none; stroke: currentColor; stroke-width: 1.5; }
.ig__head { display: flex; justify-content: flex-start; align-items: center; gap: var(--space-200); margin-bottom: var(--space-400); }
.ig__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-75); margin: 0; padding: 0; list-style: none; }
/* placeholder: blurred blots of colour, like a photo out of focus */
.ig__post {
  position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden;
  background:
    radial-gradient(60% 50% at 30% 35%, hsl(var(--h1) 60% 55%), transparent 70%),
    radial-gradient(55% 60% at 75% 70%, hsl(var(--h2) 55% 45%), transparent 70%),
    hsl(var(--h1) 20% 18%);
  filter: saturate(0.9);
  transition: opacity var(--dur-fade) var(--ease);
}
.ig__post::after { content: ""; position: absolute; inset: -20%; backdrop-filter: blur(24px); }
.ig__post img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; } /* sits above the blur */
.ig__post:hover { opacity: 0.8; }
.ig__post:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }

/* reduced motion: the logos simply wrap */
@media (prefers-reduced-motion: reduce) {
  .clients__pin { position: static; height: auto; display: grid; grid-template-columns: 1fr 3fr; }
  .clients__view, .clients__intro { position: static; width: auto; }
  .clients__intro { grid-row: 1; border-right: 0; }
  .clients__track { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, calc(var(--pitch-x) - 1px)); grid-template-rows: none; grid-auto-rows: calc(var(--pitch-y) - 1px); margin: var(--space-400); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 64rem) {
  .statement__sheet { font-size: var(--text-5xl); }
}
@media (max-width: 47.99rem) {
  .obra__foot { padding-bottom: var(--space-300); }
  .obra__view { margin-bottom: 140px; }
  .ig__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement { --m: 32px; }
  .statement__pin { height: auto; min-height: 0; }
  .statement__sheet { padding: var(--space-500) var(--space-300); font-size: var(--text-3xl); }
  .clients__pin { display: flex; flex-direction: column; }
  .clients__view { padding-top: 0; }
  .clients__track { margin-left: var(--gutter); }
  .clients__intro { order: -1; position: static; width: auto; padding-block: var(--space-600) var(--space-300); border-right: 0; background: none; }
}
