/* =================================================================
   GIULIA BASSO — Portfolio (multi-pagina)
   Home = intro + foto sparse · About = pagina dedicata.
   Monocromatico caldo, sans condensata (TeX Gyre Heros Cn) + serif corsivo.
   Palette e font centralizzati in :root.
   ================================================================= */

/* ---------- Sans condensata del template (TeX Gyre Heros Cn) ---------- */
@font-face {
  font-family: "Tex Gyre Heros Condensed Regular";
  src: url("assets/fonts/texgyreheroscn-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ============================ TOKENS ============================ */
:root {
  /* Palette — quasi bianco + testo rosso mattone/marrone */
  --bg:       #FFFFFE;
  --ink:      #6E3B2C;   /* rosso mattone quasi marrone: tutto il testo */
  --ink-soft: #A9968C;   /* attenuato: nav attivo, crediti footer */
  --ink-warm: #6E3B2C;
  --ink-head: #6E3B2C;
  --line:     #6E3B2C;
  --on-photo: #FFFFFE;

  --bg-glass: rgba(255, 255, 254, 0.85);
  --hairline: rgba(110, 59, 44, 0.20);
  --line-w:   2px;

  /* Tipografia: Roboto Mono ovunque, Inter per il corpo testo about */
  --font-mono:  "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-body:  "Inter", system-ui, -apple-system, sans-serif;
  --font-sans:  var(--font-mono);
  --font-cond:  var(--font-mono);   /* alias legacy */
  --font-serif: var(--font-mono);   /* niente più serif */
  --step-label: 0.72rem;

  /* Layout / ritmo */
  --gut:       clamp(1.25rem, 5vw, 4.5rem);
  --space-sec: clamp(5rem, 14vw, 11rem);
  --track:      0.06em;
  --track-wide: 0.08em;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  0.9s;
  --header-h: 60px;
}

/* ============================ RESET ============================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--ink); color: var(--bg); }

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

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink-head);
  outline-offset: 4px;
  border-radius: 1px;
}

/* ============================ VOCI TIPOGRAFICHE ============================ */
.label {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: var(--track);
  font-size: var(--step-label);
  line-height: 1.25;
}
.serif-accent {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}
.arrow { display: inline-block; color: currentColor; transition: transform var(--dur) var(--ease); }

/* ============================ HEADER (barra orizzontale) ============================ */
/* Trasparente e sempre visibile: i contenuti scorrono sotto (come reference) */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: transparent;
  pointer-events: none;              /* lascia cliccabili solo i link */
}
.site-header a, .site-header nav, .menu-toggle { pointer-events: auto; }

.site-header__inner {
  height: var(--header-h);
  display: flex; align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding: 0 var(--gut);
}
.site-header__logo {
  font-family: var(--font-mono);
  font-size: 16px; line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink-head);
  white-space: nowrap;
}

.site-nav {
  flex: 1;
  display: flex; justify-content: center; align-items: center;
  gap: clamp(1.1rem, 2.8vw, 2.8rem);
}
.site-nav__link {
  position: relative;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: lowercase;      /* stile reference */
  letter-spacing: 0.01em;
  color: var(--ink);
  padding: 0.4em 0;
  transition: color var(--dur) var(--ease);
}
.site-nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0.15em;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.site-nav__link:hover::after { transform: scaleX(1); }
.site-nav__link.is-active { color: var(--ink-soft); }   /* pagina corrente attenuata */

.site-header__social { display: inline-flex; align-items: center; gap: 0.75rem; }
.site-header__ig {
  display: inline-flex; align-items: center;
  color: var(--ink);
  transition: color var(--dur) var(--ease);
}
.site-header__ig svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.site-header__ig:hover { color: var(--ink-head); }

/* Hamburger — solo mobile (nascosto su desktop) */
.menu-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 6px;
  width: 44px; height: 44px; padding: 0;
  background: none; border: 0; cursor: pointer;
  z-index: 200;
}
.menu-toggle span {
  display: block; width: 22px; height: 1.5px;
  background: var(--ink); margin-left: auto;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}
body.nav-open .menu-toggle span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
body.nav-open .menu-toggle span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }

/* ============================ INTRO (home) ============================ */
/* Colonna di contenuto centrata (~1114px come reference) */
.intro {
  width: min(100% - 2 * var(--gut), 1114px);
  margin-inline: auto;
  padding: calc(var(--header-h) + clamp(4rem, 8vh, 5.5rem)) 0 clamp(2.5rem, 6vw, 4.5rem);
}
.intro__line {
  font-family: var(--font-mono);
  font-size: 18px;                 /* come reference */
  line-height: 1.6;                /* 28.8px */
  letter-spacing: 0;
  color: var(--ink);
  max-width: none;                 /* l'a-capo è forzato dal <br> dopo "stories" */
}
.intro__origin { margin-top: 0.9rem; color: var(--ink-warm); letter-spacing: 0.01em; }

/* ============================ PORTFOLIO (foto sparse) ============================ */
.gallery { padding: clamp(1.5rem, 4vw, 3rem) var(--gut) var(--space-sec); }

/* MOBILE-first: colonna singola, foto grandi. Il desktop le sparpaglia. */
.gallery__grid { display: flex; flex-direction: column; gap: clamp(2.5rem, 9vw, 3.5rem); }
.shot { position: relative; overflow: hidden; }
.shot img {
  transform: scale(1.01);
  filter: saturate(0.9) contrast(0.98);
  transition: transform 1.2s var(--ease), filter 1.2s var(--ease);
}

/* ============================ ABOUT (pagina dedicata) ============================ */
.about { padding-top: var(--header-h); }
.about__inner { display: flex; flex-direction: column; }
.about__photo { overflow: hidden; }
.about__photo--big img { aspect-ratio: 3 / 2; }        /* mobile: orizzontale */
.about__text { padding: clamp(2.5rem, 8vw, 4rem) var(--gut) clamp(3.5rem, 10vw, 5rem); max-width: 60ch; }
.about__label {
  font-size: 18px; color: var(--ink-head);
  letter-spacing: var(--track);
  margin-bottom: 0.3rem;                 /* più vicino a "visual storyteller" */
}
.about__accent { font-size: 14px; line-height: 1.4; font-style: italic; margin-bottom: 1.4rem; }
.about__body {
  font-family: var(--font-body);   /* Inter — come reference */
  font-size: 15px; line-height: 27px;
  color: var(--ink);
  letter-spacing: 0; max-width: 603px;
  text-wrap: pretty;
}
.about__socials { display: flex; align-items: center; gap: 1.1rem; margin-top: 2rem; }
.about__ig {
  display: inline-flex; color: var(--ink);
  transition: color var(--dur) var(--ease);
}
.about__ig svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.about__ig:hover { color: var(--ink-head); }

/* Evidenziazione "highlighter" marroncino chiaro semi-trasparente */
.hl {
  background: rgba(178, 128, 96, 0.30);
  color: inherit;
  padding: 0.04em 0.18em;
  border-radius: 2px;
  white-space: nowrap;           /* resta tutto su una riga */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ============================ FOOTER (riga sottile) ============================ */
.site-footer {
  padding: clamp(2rem, 5vw, 3.5rem) var(--gut);   /* niente linea divisoria */
}
.site-footer__bar { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; }
.site-footer__credit { color: var(--ink-soft); }
.site-footer__right { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(1.2rem, 3vw, 2rem); }

.footer-link {
  position: relative; display: inline-flex; align-items: center; gap: 0.4em;
  min-height: 36px; color: var(--ink);
  letter-spacing: 0.1em; font-size: 0.8rem;
}
.footer-link::after {
  content: ""; position: absolute; left: 0; bottom: 0.35em;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.footer-link:hover::after { transform: scaleX(1); }
.footer-link:hover .arrow { transform: translateX(5px); }
.footer-icon {
  display: none; width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Instagram nel footer: sempre icona, mai testo (anche su desktop) */
.footer-link--icon .footer-icon { display: inline-block; }
.footer-link--icon .footer-link__text { display: none; }
.footer-link--icon::after { display: none; }
.back-to-top { display: inline-flex; align-items: center; gap: 0.55em; min-height: 36px; color: var(--ink); }
.back-to-top:hover .arrow--up { transform: translateY(-5px); }

/* ============================ REVEAL ON SCROLL ============================ */
[data-reveal] {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.95s var(--ease), transform 0.95s var(--ease);
  will-change: opacity, transform;
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ============================ FOTO-VIDEO + LIGHTBOX ============================ */
/* Una .shot con classe .shot--video e attributo data-video diventa cliccabile
   e apre il video a tutto schermo. Badge "play" al centro. */
.shot--video { cursor: pointer; }
.shot--video::before {           /* cerchio */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 254, 254, 0.55);
  transform: translate(-50%, -50%);
  transition: transform 0.4s var(--ease), background 0.4s var(--ease);
  z-index: 2;
}
.shot--video::after {            /* triangolo play */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border-style: solid; border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--ink);
  transform: translate(-40%, -50%);
  z-index: 3;
}
.shot--video:hover::before { transform: translate(-50%, -50%) scale(1.1); background: rgba(255, 254, 254, 0.8); }

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 5vw, 4rem);
  background: rgba(24, 18, 14, 0.93);
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 0.4s var(--ease); }
.lightbox__stage { width: min(100%, 1120px); aspect-ratio: 16 / 9; background: #000; }
.lightbox__stage video,
.lightbox__stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.lightbox__close {
  position: absolute; top: clamp(0.75rem, 3vw, 1.75rem); right: clamp(0.75rem, 3vw, 1.75rem);
  width: 44px; height: 44px; min-width: 44px;
  color: #fffefe; font-size: 1.7rem; line-height: 1;
  background: none; border: 0; cursor: pointer;
}

/* ============================ DESKTOP ≥ 769px ============================ */
@media (min-width: 769px) {
  :root { --header-h: 84px; }   /* come reference */

  .site-header__logo { font-size: 17px; }

  /* PORTFOLIO: foto grandi a filo dei bordi (colonna sx a filo sinistro,
     colonna dx a filo destro), colonna destra più in basso.
     Il pattern si RIPETE (dispari/pari + periodo 4): aggiungere o togliere
     <figure> continua da solo, senza toccare il CSS. */
  /* Foto: due colonne asimmetriche come reference. Colonna SINISTRA a filo
     del bordo (x=0), colonna DESTRA staccata dal bordo destro e più in basso.
     Larghezze reali 40/39/55/34. Pattern ripetuto → aggiungere/togliere è auto. */
  .gallery { padding-block: clamp(1rem, 2.5vw, 2rem) var(--space-sec); padding-inline: 0; }
  .gallery__grid {
    display: flex; flex-flow: row wrap; align-items: flex-start;
    column-gap: 0;
    row-gap: clamp(5rem, 13vw, 15rem);
  }
  .shot { width: 40%; }
  .shot:nth-child(odd)  { margin-right: auto; }   /* colonna sinistra */
  .shot:nth-child(even) { margin-left: auto; margin-top: clamp(7rem, 15vw, 17rem); } /* dx, più in basso */
  /* Larghezze reali + variazione orizzontale: NON tutte a filo.
     sx a filo → sx rientrata → ... ; dx rientrata → dx quasi a filo → ... */
  .shot:nth-child(4n+1) { width: 40%; margin-left: 0; }                         /* sx a filo del bordo */
  .shot:nth-child(4n+2) { width: 39%; margin-right: clamp(2rem, 6vw, 7rem); }    /* dx rientrata */
  .shot:nth-child(4n+3) { width: 55%; margin-left: clamp(2rem, 5vw, 5rem); }     /* sx rientrata */
  .shot:nth-child(4n)   { width: 34%; margin-right: clamp(0.4rem, 2vw, 1.8rem); } /* dx quasi a filo */

  /* ABOUT: foto grande a sinistra (piena altezza), testo a destra centrato */
  .about__inner {
    display: grid;
    grid-template-columns: 52% 1fr;               /* foto ~52% sx, testo dx */
    align-items: stretch;
    height: calc(100svh - var(--header-h));       /* altezza fissa = una schermata */
  }
  .about__photo--big { grid-column: 1; height: 100%; min-height: 0; }
  .about__photo--big img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
  .about__text {
    grid-column: 2; align-self: end;              /* testo in basso, com'era prima */
    padding: 0 var(--gut) clamp(1rem, 3vh, 2rem) clamp(2.5rem, 4vw, 3.5rem);
    max-width: 603px;
  }

  /* FOOTER: una riga — crediti a sinistra, link/icone a destra */
  .site-footer__bar { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Hover ricchi solo con puntatore fine */
@media (hover: hover) and (pointer: fine) {
  .shot:hover img { transform: scale(1.04); filter: saturate(1) contrast(1.02); }
}

/* ============================================================================
   MOBILE ≤ 768px — pensato per il portrait: hamburger + menu full-screen,
   intro compatta, foto a colonna singola full-width, about impilato.
   ============================================================================ */
@media (max-width: 768px) {
  :root { --header-h: 56px; }

  /* HEADER: logo a sinistra, hamburger a destra */
  .site-header__inner { justify-content: space-between; gap: 0.8rem; }
  .site-header__logo { font-size: 15px; }
  .site-header__social { display: none; }
  .menu-toggle { display: inline-flex; }

  /* NAV = overlay a tutto schermo, link grandi e centrati */
  .site-nav {
    position: fixed; inset: 0; z-index: 150;
    flex: none; flex-direction: column; justify-content: center; align-items: center;
    gap: clamp(1.6rem, 6vw, 2.6rem);
    background: var(--bg);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), visibility 0s linear 0.4s;
  }
  .site-nav.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  }
  .site-nav__link { font-size: clamp(1.7rem, 9vw, 2.6rem); padding: 0.25em 0; }
  .site-nav__link::after { display: none; }

  /* INTRO */
  .intro { padding: calc(var(--header-h) + clamp(2.5rem, 12vw, 4.5rem)) 0 clamp(2rem, 8vw, 3.5rem); }
  .intro__line { font-size: 16px; line-height: 1.6; }

  /* PORTFOLIO: colonna singola, foto full-width, vuoti generosi.
     (Il pattern desktop è in @media ≥769, qui non si applica: base = colonna.) */
  .gallery { padding: clamp(1.5rem, 6vw, 2.5rem) 0 clamp(4rem, 14vw, 5.5rem); }
  .gallery__grid { gap: clamp(3rem, 12vw, 4.5rem); }
  .shot { width: 100%; }

  /* ABOUT: foto sopra, testo sotto */
  .about { padding-top: var(--header-h); }
  .about__inner { display: flex; flex-direction: column; min-height: 0; }
  .about__photo--big { height: auto; }
  .about__photo--big img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
  .about__text {
    grid-column: auto; align-self: auto; max-width: none;
    padding: clamp(2rem, 8vw, 3rem) var(--gut) clamp(3rem, 12vw, 4rem);
  }
  .about__label { font-size: 17px; }

  /* FOOTER: una riga — crediti a sx, icone a dx */
  .site-footer { padding: clamp(2rem, 8vw, 3rem) var(--gut); }
  .site-footer__bar { flex-direction: row; justify-content: space-between; align-items: center; gap: 1rem; }
  .site-footer__right { gap: 0.25rem; align-items: center; }
  .footer-link { min-height: 44px; min-width: 40px; justify-content: center; }
  .footer-link__text { display: none; }
  .footer-icon { display: inline-block; }
  .footer-link::after { display: none; }
  .back-to-top { display: none; }
}

@media (max-width: 480px) {
  .site-header__logo { font-size: 14px; }
  .site-nav__link { font-size: clamp(1.6rem, 10vw, 2.2rem); }
  .intro__line { font-size: 15px; }
  .about__body { font-size: 15px; line-height: 23px; }
}

/* ============================ REDUCED MOTION ============================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.18s !important;
    transition-delay: 0s !important;
  }
  [data-reveal] { transform: none; }
}
