/* ==========================================================================
   Andrea Franceschetto — Portfolio
   Tutti i valori di design sono nel blocco :root qui sotto.
   Le misure in vw sono ricavate dagli screenshot del sito Framer: se qualcosa
   ti sembra più grande/piccolo dell'originale, si regola da qui.
   ========================================================================== */

@font-face {
  font-family: "Apfel Grotezk";
  src: url("../fonts/ApfelGrotezk-Regular.woff2") format("woff2"),
       url("../fonts/ApfelGrotezk-Regular.woff") format("woff"),
       url("../fonts/ApfelGrotezk-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #0028d7;
  --white: #fff;
  --font: "Apfel Grotezk", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --gut: 24px;                             /* margine laterale (misurato su Framer) */
  --u: 4.123vw;                            /* passo della griglia di "+" */
  --radius: clamp(3px, .35vw, 6px);

  --fs-name: 2.25vw;                       /* wordmark in header (32.76px a 1456) */
  --fs-nav: 16px;
  --fs-row: 12px;                          /* righe (Read More) © */
  --fs-cap: clamp(10px, .75vw, 13px);      /* didascalie progetto */
  --fs-about: clamp(14px, 1.25vw, 22px);
  --fs-intro: clamp(20px, 2.2vw, 40px);
  --fs-ftr-link: clamp(16px, 1.4vw, 26px);
  --fs-contact-h: clamp(30px, 3.7vw, 70px);
  --fs-contact-l: clamp(18px, 2.2vw, 42px);
  --fs-hero-title: clamp(48px, 8.7vw, 160px);
  --fs-project-title: clamp(34px, 6vw, 110px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--blue);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
::selection { background: var(--blue); color: #fff; }

/* ---------- Griglia di "+" interattiva (generata da site.js) ----------
   Passo 60px, croce 8px, opacità base .15; si illumina vicino al mouse. */
.plusgrid { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.plusgrid svg { position: absolute; width: 8px; height: 8px; transform: translate(-50%, -50%); opacity: .15; transition: opacity .2s ease-out; fill: #fff; }
[data-theme="blue"] { background-color: var(--blue); color: #fff; }
[data-theme="dark"] { background-color: #000; color: #fff; }

/* ---------- Cursore personalizzato (solo mouse) ---------- */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor { position: fixed; left: 0; top: 0; z-index: 100; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none; mix-blend-mode: difference; opacity: 0; image-rendering: pixelated; will-change: transform; }
.cursor.on { opacity: 1; }
.cursor svg { display: block; width: 100%; height: 100%; fill: #fff; }

/* ---------- Tenda: la hero resta ferma e il contenuto bianco le scorre sopra ---------- */
.hero, .phero { position: sticky; top: 0; z-index: 1; }
.curtain { position: relative; z-index: 2; background: #fff; }

/* ---------- Header (dentro la hero) ---------- */
.hdr {
  position: absolute; z-index: 10; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--gut);
  color: #fff;
}
.contact .hdr { z-index: 10; }
.hdr-name { font-size: var(--fs-name); line-height: 1.2; }
.hdr-nav { display: flex; gap: 80px; padding-top: 7px; margin-right: 20px; font-size: var(--fs-nav); line-height: 20px; letter-spacing: -.5px; }
/* come le varianti Framer "Portfolio Active" / "Contact Active": voce attiva sottolineata, l'altra attenuata */
.hdr-nav:has(a[aria-current]) a:not([aria-current]) { opacity: .5; }
.hdr-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.hdr-nav sup { font-size: 12px; line-height: 16px; letter-spacing: -.5px; opacity: .5; margin-left: 12px; vertical-align: top; position: relative; top: -4px; }

/* ---------- Hero ---------- */
.hero { overflow: hidden; height: 90svh; min-height: 420px; } /* Framer: Hero alta 90vh */
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 100%;
}
.hero-foot { position: absolute; left: var(--gut); bottom: var(--gut); font-size: 16px; letter-spacing: -.5px; z-index: 2; }
.hero--page .hero-title {
  position: absolute; left: var(--gut); bottom: 2.6vw; z-index: 2;
  font-weight: 400; font-size: var(--fs-hero-title); line-height: .8; letter-spacing: -.025em;
  color: #fff;
}

/* ---------- Righe sezione ---------- */
.row {
  position: relative;
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 16px var(--gut) 0;            /* sempre la stessa distanza dall'elemento sopra */
  padding-top: 12px;                     /* e dal testo sotto la linea */
  border-top: 1px solid var(--blue);
  font-size: var(--fs-row); line-height: 16px; letter-spacing: -.5px; color: var(--blue);
}
.row-c { position: absolute; left: 61%; }
.dia { display: inline-block; width: .5em; height: .5em; background: currentColor; transform: rotate(45deg); margin-right: .75em; position: relative; top: -.05em; }

/* ---------- Home: about ---------- */
.about {
  display: grid; grid-template-columns: 22.5vw 1fr 29vw; align-items: start;
  margin: 0 var(--gut); padding: 88px 0 100px;
  position: relative;
}
.portrait { border-radius: var(--radius); overflow: hidden; }
.portrait img, .portrait .ph { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3/4; }
.about-arrow { font-size: var(--fs-row); margin-left: calc(56.7vw - 22.5vw - var(--gut) * 2); line-height: 1; padding-top: .1em; }
.about-text { grid-column: 3; font-size: var(--fs-about); line-height: 1.16; text-align: justify; hyphens: auto; }

/* ---------- Titoli giganti con "fit" ---------- */
[data-fit] { display: block; width: 100%; white-space: nowrap; overflow: visible; line-height: .8; letter-spacing: -.03em; font-size: 15vw; }
.fit-in { display: inline-block; }
.giant { margin: 8.5vw 0 5.4vw; padding: 0 var(--gut); }
.giant .fit-in { margin-left: -.04em; }

/* ---------- Progetti ---------- */
.projects { padding: 0 var(--gut); }
.plist { display: flex; flex-direction: column; gap: 9vw; }
.pcard { display: block; background: #fff; }
/* le prime tre card si impilano con 40px di scarto (come su Framer) */
.plist .pcard { position: relative; z-index: 4; }
.plist .pcard:nth-child(1) { position: sticky; top: 50px; z-index: 1; }
.plist .pcard:nth-child(2) { position: sticky; top: 90px; z-index: 2; }
.plist .pcard:nth-child(3) { position: sticky; top: 130px; z-index: 3; }
.pimg { overflow: hidden; border-radius: var(--radius); }
.pimg img, .pimg .ph { width: 100%; height: 100%; object-fit: cover; }
.pcard--wide .pimg { aspect-ratio: 2.82 / 1; }
.pcard--card .pimg { aspect-ratio: 1.4 / 1; }
.pimg .ph { aspect-ratio: auto !important; }
.pcap {
  display: grid; grid-template-columns: var(--cap-x, 75%) 1fr auto;
  margin-top: .9vw; font-size: var(--fs-cap); line-height: 1.25; text-transform: uppercase;
}
.pcard--card .pcap { --cap-x: 50%; }
.pc-t b { display: block; font-weight: 400; }
.pc-t em { display: block; font-style: normal; text-transform: none; opacity: .6; }
.pc-y { text-align: right; }

/* La hero della home si scurisce mentre il contenuto bianco le scorre sopra
   (misurato frame per frame da una registrazione dell'anteprima Framer). */
.hero-dim { position: absolute; inset: 0; z-index: 20; background: #000; opacity: 0; pointer-events: none; transition: opacity .12s linear; }

/* bottone: blu → trasparente, testo bianco → blu (molla bounce .2, 0.4s) */
.cta {
  display: block; margin: 4.8vw 0 6.8vw;
  background-color: var(--blue); color: #fff; border: 2px solid var(--blue); border-radius: var(--radius);
  padding: calc(1.7vw - 2px) calc(2.2vw - 2px) calc(1.9vw - 2px);
  transition: background-color .4s cubic-bezier(.3, .9, .4, 1.1), color .4s cubic-bezier(.3, .9, .4, 1.1);
}
.cta:hover { background-color: rgba(0, 40, 215, 0); color: var(--blue); }
.cta .cta-in { line-height: .85; letter-spacing: -.02em; }

/* ---------- Portfolio (griglia) ---------- */
.projects--grid { padding-top: 5.4vw; padding-bottom: 9vw; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; column-gap: .66vw; row-gap: 4.3vw; }

/* ---------- Pagina progetto ---------- */
.phero { height: 100svh; padding: var(--gut); overflow: clip; }
.phero .hero-img { inset: auto; left: 50%; top: 50%; width: 110%; height: 110%; transform: translate(-50%, -50%); filter: blur(5px); opacity: .7; object-position: 50% 50%; }
.phero-title {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 2;
  text-align: center; font-weight: 400; font-size: 100px; line-height: 100px; letter-spacing: -3px;
  padding: 0 var(--gut); color: #fff;
}
.pintro { padding: 7vw var(--gut) 0; }
.pintro p { font-size: var(--fs-intro); line-height: 1.16; letter-spacing: -.005em; }
.pblocks { display: flex; flex-direction: column; gap: 50px; padding: 9vw var(--gut) 0; }
.gal { display: grid; gap: 10px; }
.gal--1 { grid-template-columns: 1fr; }
.gal--2 { grid-template-columns: repeat(2, 1fr); }
.gal--3 { grid-template-columns: repeat(3, 1fr); }
.gal figure { border-radius: 5px; overflow: hidden; }
.gal img { width: 100%; height: auto; }
.ptext { font-size: var(--fs-about); line-height: 1.2; max-width: 52ch; padding: 2vw 0; }
.explore { margin: 5.5vw var(--gut) 6vw; padding: 1.4vw 1.6vw 1.6vw; }
.explore .explore-in { line-height: .85; letter-spacing: -.02em; }

/* ---------- Contatti ---------- */
.page-contact { background: var(--blue); }
.contact {
  display: grid; grid-template-columns: 39.5vw 1fr; column-gap: 5vw; align-items: center;
  padding: 9.2vw var(--gut) 11vw; position: relative;
}
.contact > *:not(.plusgrid):not(.hdr) { position: relative; z-index: 2; }
.contact .portrait img, .contact .portrait .ph { aspect-ratio: 4/5; }
.ph--blue { background: rgba(255, 255, 255, .08) !important; color: #fff !important; }
.contact-r h1 { font-weight: 400; font-size: var(--fs-contact-h); line-height: .95; letter-spacing: -.025em; margin-bottom: 7.5vw; }
.contact-r li { font-size: var(--fs-contact-l); line-height: 1.6; letter-spacing: -.015em; }
.contact-r a:hover { opacity: .75; }
.ar { display: inline-block; margin-right: .22em; }

/* ---------- Footer ---------- */
.ftr { position: relative; z-index: 2; background-color: var(--blue); color: #fff; padding: 3vw var(--gut) var(--gut); }
.ftr > *:not(.plusgrid) { position: relative; z-index: 2; }
.ftr-word { color: #fff; margin-bottom: 3.2vw; }
.ftr-mid { display: grid; grid-template-columns: 69% 1fr; align-items: start; }
.route { width: 100%; height: auto; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; overflow: visible; margin-top: 1.2vw; }
.route path, .route rect, .route circle { vector-effect: non-scaling-stroke; }
img.route { stroke: none; }
.ftr-links { text-align: right; font-size: var(--fs-ftr-link); line-height: 1.25; display: flex; flex-direction: column; }
.ftr-links a:hover { opacity: .75; }
.ftr-copy { margin-top: 2.2vw; font-size: var(--fs-row); }

/* ---------- Segnaposto immagini ---------- */
.ph {
  display: grid; place-items: center; width: 100%;
  background: repeating-linear-gradient(135deg, #f1f1f7 0 12px, #e9e9f1 12px 24px);
  color: var(--blue); font-size: var(--fs-row); text-transform: uppercase; letter-spacing: .04em;
}
.ph span { opacity: .55; }
.phero .ph, .hero .ph { display: none; }

/* ---------- Animazioni d'entrata (valori letti dal sito Framer) ----------
   --spring = molla {damping 60, stiffness 300, mass 1}, 1.28s (campionata). */
:root {
  --spring: linear(0, 0.1016, 0.2503, 0.382, 0.4916, 0.582, 0.6563, 0.7174, 0.7676, 0.8089, 0.8429, 0.8708, 0.8938, 0.9127, 0.9282, 0.941, 0.9515, 0.9601, 0.9672, 0.973, 0.9778, 0.9818, 0.985, 0.9877, 0.9899, 0.9917, 0.9931, 0.9944, 0.9954, 0.9962, 0.9969, 0.9974, 0.9979, 0.9983, 0.9986, 0.9988, 1);
  --ease-a: cubic-bezier(.44, 0, .56, 1);
  --ease-b: cubic-bezier(.44, 0, .34, .98);
}
@keyframes ap-y-100 { from { opacity: .001; transform: translateY(-100px); } }
@keyframes ap-y-10n { from { opacity: .001; transform: translateY(-10px); } }
@keyframes ap-y-10 { from { opacity: .001; transform: translateY(10px); } }
@keyframes ap-y-20 { from { opacity: .001; transform: translateY(20px); } }
@keyframes ap-y-20o { from { transform: translateY(20px); } }
@keyframes ap-y-70 { from { opacity: .001; transform: translateY(70px); } }
@keyframes ap-fade { from { opacity: .001; } }
@keyframes ap-zoom { from { opacity: .001; transform: scale(1.2); } }
@keyframes ap-zoom-c { from { opacity: .001; transform: translate(-50%, -50%) scale(1.32); } to { opacity: .7; transform: translate(-50%, -50%) scale(1.1); } }
@keyframes ap-y-70c { from { opacity: .001; transform: translateY(calc(-50% + 70px)); } to { opacity: 1; transform: translateY(-50%); } }

[data-ap="hdr"] { animation: ap-y-100 1.28s var(--spring) .3s both; }
[data-ap="navlast"] { animation: ap-y-10n .5s var(--ease-b) .7s both; }
[data-ap="bg"] { animation: ap-zoom 1s var(--ease-a) 0s both; }
[data-ap="foot"] { animation: ap-fade 1.28s var(--spring) .5s both; }
[data-ap="ptitle"] { animation: ap-y-20 1.28s var(--spring) .2s both; }
[data-ap="rowr"] { animation: ap-y-10 1.28s var(--spring) .5s both; }
[data-ap="work"] { animation: ap-y-20o .7s var(--ease-a) 0s both; }
[data-ap="pbg"] { animation: ap-zoom-c 1s var(--ease-a) 0s both; }
[data-ap="ptitle2"] { animation: ap-y-70c 1.28s var(--spring) .1s both; }
[data-ap="cimg"] { animation: ap-y-70 1.28s var(--spring) .1s both; }
[data-ap="ctitle"] { animation: ap-y-20 1.28s var(--spring) .1s both; }

@media (prefers-reduced-motion: reduce) {
  [data-ap] { animation: none !important; }
  .plusgrid svg { transition: none; }
  .cta { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 809.98px) {
  :root { --u: 8.2vw; --fs-name: 15px; --fs-nav: 13px; --fs-row: 12px; --fs-cap: 10px; --fs-about: 15px; --fs-intro: 19px; --fs-ftr-link: 17px; --fs-contact-h: 34px; --fs-contact-l: 20px; --fs-hero-title: 17vw; --fs-project-title: 11vw; --gut: 14px; }
  .hdr { flex-direction: column; gap: 12px; }
  .hdr-name { white-space: nowrap; }
  .hdr-nav { gap: 22px; margin-right: 0; padding-top: 0; }
  .hero-foot { display: none; }
  .phero-title { font-size: 11vw; line-height: 1; letter-spacing: -.03em; }
  .phero { height: 100svh; }
  .row-c { left: 56%; }
  .about { grid-template-columns: 1fr; padding: 40px 0; row-gap: 28px; }
  .portrait { width: 46vw; }
  .about-arrow { display: none; }
  .about-text { grid-column: 1; }
  .giant { margin: 44px 0 26px; }
  .plist { gap: 44px; }
  .pcard--wide .pimg { aspect-ratio: 1.5 / 1; }
  .pcap { --cap-x: 50% !important; margin-top: 8px; }
  .cta { margin: 28px 0 40px; padding: 14px 14px 16px; }
  .pgrid { grid-template-columns: 1fr; row-gap: 36px; }
  .projects--grid { padding-top: 28px; padding-bottom: 60px; }
  .pintro { padding-top: 36px; }
  .pblocks { padding-top: 48px; }
  .gal--2, .gal--3 { grid-template-columns: 1fr; }
  .explore { margin: 36px var(--gut) 44px; padding: 12px; }
  .contact { grid-template-columns: 1fr; row-gap: 34px; padding: 80px var(--gut) 60px; }
  .contact-r h1 { margin-bottom: 26px; }
  .ftr { padding-top: 28px; }
  .ftr-word { margin-bottom: 22px; }
  .ftr-mid { grid-template-columns: 1fr; row-gap: 18px; }
  .ftr-links { order: -1; }
  .ftr-copy { margin-top: 18px; }
}

/* scroll fluido (site.js) */
html.smooth { scroll-behavior: auto !important; }
