/* ==========================================================================
   We Are Grounds — portfolio
   Source of truth: Figma "Website" › Portfolio / Desktop / 1440
   Breakpoints from Figma: Desktop 1440 / Tablet 834 / Mobile 390
   ========================================================================== */

/* Brand fonts come from the Adobe Fonts kit (use.typekit.net/ldo2zdp.css).
   trust-3a ships 400/700 only, so the Figma "Medium" (500) renders as 400. */

:root {
  /* Color palette (Figma › Componenti locali › Color palette) */
  --c-bg: #000;
  --c-text: #fff;
  --c-text-warm: #fffcfa;
  --c-line: #1A1A1A;
  --c-tag-border: rgba(255, 252, 250, 0.15);
  --c-tile: #fff;

  /* Type families */
  --f-display: "trust-3a", Georgia, serif;
  --f-body: "gotham", system-ui, sans-serif;
  --f-ui: "Inter", system-ui, sans-serif;

  /* Layout */
  --pad: 20px;
  --gap: 4px;
  --radius: 4px;

  /* Type scale — desktop values from Figma, fluid down to mobile */
  --fs-display: 56px;   /* 56 / 61.6 on every breakpoint */
  --fs-project: 64px;   /* 64 / 77 desktop + tablet, 32 / 40 mobile */
  --fs-about: 21px;     /* 21 / 31.5 on every breakpoint */
  --fs-lead: 18.4px;    /* 18.4 / 27.6 on every breakpoint */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
main { display: block; container-type: inline-size; } /* 100cqw = page width (no scrollbar) */
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { opacity: .65; }
a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.t-display strong { font-weight: 700; }
.t-display {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--fs-display);
  line-height: 1.1;
  text-transform: uppercase;
}

/* ==========================================================================
   01 / Hero
   ========================================================================== */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 62.9 / 810 at 1440: logo top and bottom breathing room */
  padding: 4.368vw 0 1.667vw;
  overflow: hidden;
}
.hero__caption {
  position: absolute;
  top: 22.5px; left: 22.5px; right: 22.5px;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 9px;
  line-height: 12px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-align: center;
}
.hero__logo { width: 85.81vw; }            /* 1235.6 / 1440 */
.hero__logo img { width: 100%; height: auto; }
.hero__footer {
  width: 85.83vw;                           /* 1236 / 1440 */
  margin-top: 1.58vw;                       /* 22.75 below the logo */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8.77vw;                              /* 126.25 between tagline and emails */
  text-align: center;
}
.hero__tagline { font-size: 18px; line-height: 1.05; }
/* Portfolio hero has no tagline: keep the emails where Figma puts them
   (22.75 + 19 + 126.25 below the logo at 1440). */
@media (min-width: 1100px) {
  .hero:not(.hero--home) .hero__footer:not(:has(.hero__tagline)) { margin-top: calc(10.35vw + 19px); }
}
.hero__emails {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  font-size: 16px;
  line-height: 19px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

/* Homepage hero — Figma "Desktop BIG" 1920 x 1080, fills the screen.
   --u is 1/1920 of the design, capped by height so short screens never overlap. */
@media (min-width: 1100px) {
  .hero--home {
    --u: min(1vw, 1.7778svh);
    height: 100svh;
    padding: 0;
  }
  .hero--home .hero__caption {
    top: calc(1.5625 * var(--u));
    font-size: max(9px, calc(0.625 * var(--u)));
    line-height: 1.25;
  }
  .hero--home .hero__logo {               /* centre sits 98.7 above mid-height at 1080 */
    position: absolute;
    left: 50%;
    top: calc(50% - 5.14 * var(--u));
    width: calc(85.81 * var(--u));
    transform: translate(-50%, -50%);
  }
  .hero--home .hero__footer {             /* 1648 x 279, 2px from the bottom, 30px padding */
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: calc(85.83 * var(--u));
    height: calc(14.53 * var(--u));
    margin: 0;
    padding: calc(1.5625 * var(--u)) 0;
    transform: translateX(-50%);
    justify-content: space-between;
    gap: 0;
  }
  .hero--home .hero__tagline { font-size: max(16px, calc(1.25 * var(--u))); }
  .hero--home .hero__emails {
    align-items: flex-end;
    font-family: var(--f-display);
    font-size: max(10px, calc(0.625 * var(--u)));
    line-height: normal;
  }
}

/* The homepage is a single fixed screen at every size: no scrolling. */
.page-home-root,
.page-home-root body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.hero.hero--home { height: 100svh; min-height: 0; }
@media (max-width: 1099px) {
  .hero.hero--home { padding-top: min(160px, 14.4svh); padding-bottom: min(160px, 14.4svh); }
}
@media (max-width: 699px) {
  .hero.hero--home { padding-top: min(160px, 19svh); padding-bottom: min(160px, 19svh); }
}

/* ==========================================================================
   02 / About
   ========================================================================== */
.about {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 80px var(--pad);
}
.about__inner {
  width: min(100%, 1120px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 40px;
}
.about__inner .t-display { width: 100%; }
.about__text {
  width: min(100%, 720px);
  color: var(--c-text-warm);
  font-size: var(--fs-about);
  line-height: 1.5;
}

/* ==========================================================================
   03 / Services
   ========================================================================== */
.services {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 80px;
  padding: 40px var(--pad);
}
.services__intro { display: flex; flex-direction: column; gap: 16px; }
.services__lead {
  max-width: 760px;
  font-family: var(--f-ui);
  font-size: var(--fs-lead);
  line-height: 1.5;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
/* Grid lines are pseudo-elements so they can be "drawn" on reveal
   (GSAP animates --lx / --ly from 0 to 1). */
.service-card {
  --lx: 1; --ly: 1; --lc: var(--c-line);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px;
  background: var(--c-bg);
}
.service-card__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 22.4px;
  line-height: 1.2;
  text-transform: uppercase;
}
.service-card__text { font-size: 16px; line-height: 1.5; }
.service-card::before,
.service-card::after { content: ""; position: absolute; background: var(--lc); pointer-events: none; }
.service-card::after { left: 0; right: 0; bottom: 0; height: 1px; transform: scaleX(var(--lx)); transform-origin: left; }
.service-card::before { top: 0; bottom: 0; right: 0; width: 1px; transform: scaleY(var(--ly)); transform-origin: top; }
.service-card:nth-child(3n)::before { display: none; }
.service-card:nth-child(n+4)::after { display: none; }

/* ==========================================================================
   Project — cover + details
   ========================================================================== */
.project { display: flex; flex-direction: column; }
.project__cover {
  position: relative;
  aspect-ratio: 1440 / 630;
  overflow: hidden;
  border-radius: var(--radius);
}
.project__cover img {
  position: absolute;
  left: 0; top: -8%;
  width: 100%; height: 116%;   /* extra height = parallax travel */
  max-width: none;
  object-fit: cover;
  will-change: transform;
}
.tile img,
.tile video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  object-fit: cover;
}
/* per-tile crop: --pos on wide tiles, --pos-narrow on tablet/mobile tiles */
.tile img { object-position: var(--pos, 50% 50%); }
.project__details {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: var(--pad);
}
.project__head { display: flex; align-items: flex-start; gap: 16px; }
.project__name {
  flex: 1;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--fs-project);
  line-height: 1.2;
  text-transform: uppercase;
}
.project__year { font-family: var(--f-ui); font-size: 14px; line-height: 20px; white-space: nowrap; }

/* Tag (Figma component "Tag") */
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  padding: 6px 16px;
  border: 1px solid var(--c-tag-border);
  border-radius: var(--radius);
  font-family: var(--f-ui);
  font-size: 12.8px;
  line-height: 20px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ==========================================================================
   Project — gallery grid
   3 columns on desktop/tablet, 2 on mobile. Row height derives from the
   column width so the tiles keep the Figma proportions at any viewport.
   Two layouts from Figma: --a (Serenis) and --b (NeN, Marrone, Mentor, Treeage)
   ========================================================================== */
.gallery {
  --cols: 3;
  --ratio: calc(284 / 464);
  padding: var(--pad);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: calc((100cqw - 2 * var(--pad) - (var(--cols) - 1) * var(--gap)) / var(--cols) * var(--ratio));
  gap: var(--gap);
}
.tile { position: relative; overflow: hidden; border-radius: var(--radius); background: #111; }
.tile--tall { grid-row: span 2; }
.tile--contain { background: var(--tile-bg, #111); }
.tile--contain img { object-fit: contain; }

.gallery--a > :nth-child(1) { grid-area: 1 / 1; }
.gallery--a > :nth-child(2) { grid-area: 1 / 2; }
.gallery--a > :nth-child(3) { grid-area: 1 / 3 / span 2; }
.gallery--a > :nth-child(4) { grid-area: 2 / 1 / span 2; }
.gallery--a > :nth-child(5) { grid-area: 2 / 2; }
.gallery--a > :nth-child(6) { grid-area: 3 / 2; }
.gallery--a > :nth-child(7) { grid-area: 3 / 3; }

.gallery--b > :nth-child(1) { grid-area: 1 / 1 / span 2; }
.gallery--b > :nth-child(2) { grid-area: 1 / 2; }
.gallery--b > :nth-child(3) { grid-area: 1 / 3; }
.gallery--b > :nth-child(4) { grid-area: 2 / 2; }
.gallery--b > :nth-child(5) { grid-area: 2 / 3 / span 2; }
.gallery--b > :nth-child(6) { grid-area: 3 / 1; }
.gallery--b > :nth-child(7) { grid-area: 3 / 2; }

/* ==========================================================================
   14 / Contact
   ========================================================================== */
.contact {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.contact__invite {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  padding: var(--pad);
}
/* Figma: Trust 3A Medium 64 / 77, uppercase (same as project names) */
.contact__title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--fs-project);
  line-height: 1;
  text-transform: uppercase;
}
.contact__text { max-width: 30em; font-family: var(--f-ui); font-size: var(--fs-lead); line-height: 1.2; }
.contact__emails { display: flex; flex-direction: column; gap: 16px; font-size: 16px; line-height: 19px; letter-spacing: -0.01em; }
.contact__clients {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 36px;
}
.logo-wall {
  width: min(100%, 648px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
}
.logo-wall__item {
  height: 150px;
  display: grid;
  place-items: center;
  background: var(--c-tile);
  border-radius: var(--radius);
}
/* each logo carries --w: equal visual area, capped to the Figma 106.67 x 80 box */
.logo-wall__item img { width: var(--w, 80px); height: auto; }

/* ==========================================================================
   Tablet — 834 (Figma: Portfolio / Tablet / 834)
   ========================================================================== */
@media (max-width: 1099px) {
  .gallery { --ratio: calc(354.67 / 262); }
  .project__cover { aspect-ratio: 834 / 778.4; }
  .project__details { min-height: 333.6px; }
  .about__inner { gap: 32px; }
  /* Hero (Figma Tablet 834): 160 top/bottom, logo across the padded width,
     tagline under it, emails stacked at the bottom */
  .hero { min-height: 100svh; padding: 160px 42px; }
  .hero__caption { display: none; }
  .hero__logo { width: 100%; padding: 1.65% 2.38% 2.8% 2.17%; }
  .hero__footer { width: 100%; flex: 1; margin-top: 32px; gap: 0; }
  .hero__emails {
    margin-top: auto;
    padding: 13px 0;
    flex-direction: column;
    align-items: center;
    gap: 11.5px;
    font-size: 20px;
    line-height: 24px;
  }

  /* About: 32 side padding, 44/61.6 heading, block sits 106px above centre */
  .about { padding: 80px 32px 292px; }
  .about__inner { width: 100%; }
  .about__inner .t-display { font-size: 44px; line-height: 61.6px; }
  .services__lead { max-width: none; }
  .br-lg { display: none; }
  .tile img { object-position: var(--pos-narrow, var(--pos, 50% 50%)); }
  .contact__clients { padding: 20px 20.85px; }
}

/* ==========================================================================
   Mobile — 390 (Figma: Portfolio / Mobile / 390)
   ========================================================================== */
@media (max-width: 699px) {
  .hero { padding: 160px 16px; }
  .hero__emails { font-size: 16px; line-height: 19px; gap: 19px; }

  .about { padding: 80px 32px; }
  .about__inner .t-display { font-size: 24px; line-height: 1.3; }
  .about__text { width: 100%; }

  .services { gap: 64px; }
  .service-grid { grid-template-columns: 1fr; }
  .service-card { padding: 20px 0; gap: 8px; }
  .service-card::before { display: none; }
  .service-card:nth-child(n+4)::after { display: block; }
  .service-card:last-child::after { display: none; }

  /* Mobile: details first, then a square cover */
  .project__details { order: -1; min-height: 0; justify-content: flex-start; gap: 20px; padding: 80px 20px 20px; }
  .project__name { font-size: 32px; line-height: 40px; }
  .contact__title { font-size: 32px; line-height: 1; }
  .tags { gap: 8px; }
  .project__cover { aspect-ratio: 1 / 1; }
  .tag { padding: 0 8px; font-size: 12.8px; line-height: 20px; }

  .gallery {
    --cols: 2;
    --gap: 5px;
    --pad: 0px;
    --ratio: calc(204.75 / 192.5);
    padding: 5px 0;
  }
  .tile--mobile-hide { display: none; }
  /* artwork with text that a narrow crop would cut: show it whole */
  .tile--contain-mobile { background: var(--tile-bg, #111); }
  .tile--contain-mobile img { object-fit: contain; }

  .gallery--a > :nth-child(1) { grid-area: 1 / 1; }
  .gallery--a > :nth-child(3) { grid-area: 1 / 2 / span 2; }
  .gallery--a > :nth-child(4) { grid-area: 2 / 1 / span 2; }
  .gallery--a > :nth-child(5) { grid-area: 3 / 2; }
  .gallery--a > :nth-child(6) { grid-area: 4 / 1; }
  .gallery--a > :nth-child(7) { grid-area: 4 / 2; }

  .gallery--b > :nth-child(1) { grid-area: 1 / 1 / span 2; }
  .gallery--b > :nth-child(2) { grid-area: 1 / 2; }
  .gallery--b > :nth-child(3) { grid-area: 2 / 2; }
  .gallery--b > :nth-child(4) { grid-area: 3 / 1; }
  .gallery--b > :nth-child(5) { grid-area: 3 / 2 / span 2; }
  .gallery--b > :nth-child(6) { grid-area: 4 / 1; }

  .contact { grid-template-columns: 1fr; min-height: 0; }
  .contact__invite { min-height: 400px; padding: 80px 20px 20px; }
  .contact__clients { padding: 20px; }
  .logo-wall__item { height: auto; aspect-ratio: 1; }
  .logo-wall__item img { width: calc(var(--w, 80px) * 0.7); }
}

/* ==========================================================================
   Reveal animations — initial hidden state (only while JS + GSAP run)
   ========================================================================== */
.js [data-anim] { visibility: hidden; }
.split-line { overflow: hidden; padding-bottom: .04em; margin-bottom: -.04em; }

@media (prefers-reduced-motion: reduce) {
  .js [data-anim] { visibility: visible; }
}
