/* ==========================================================
   Anna Saborit — portfolio
   Estil de la targeta: blanc i negre, espai, composició centrada.
   Tipografia: Articulat CF (Adobe Fonts, kit kad6xkv)
   ========================================================== */

:root {
  --bg: #ffffff;
  --fg: #1d1d1b;

  --font: "articulat-cf", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --header-h: 72px;
  --max: 1600px;
  --grid-gap: 16px; /* distància entre fotos: fixa i igual a totes les graelles, normal i responsive */

  --fs-disc: clamp(2.7rem, 14.4vw, 9rem);
  --fs-display: clamp(2.5rem, 7vw, 6rem);
  --fs-lead: clamp(1.25rem, 2.4vw, 2rem);
  --fs-body: 1rem;
  --fs-small: 0.9344rem; /* 0,8125rem + 15% */

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Cursor: la A cursiva del logotip. El vèrtex de la A és el punt del clic (3, 3). */
* { cursor: url("../img/cursor.svg") 3 3, auto; }
input, textarea { cursor: text; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 400; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
::selection { background: var(--fg); color: var(--bg); }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--fg);
  color: var(--bg);
}
.skip:focus { top: 8px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Subratllat fi, com un traç de la targeta */
.site-nav a,
.filters button,
.contact-row a,
.arrow-link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s;
}
.site-nav a:hover,
.filters button:hover,
.filters button[aria-pressed="true"],
.contact-row a:hover,
.arrow-link,
.arrow-link:hover { text-decoration-color: currentColor; }

/* Secció activa del menú: negreta, sense subratllat */
.site-nav a[aria-current="page"] { font-weight: 700; }
/* Idioma actiu: negreta, sense subratllat */
.lang button[aria-pressed="true"] { font-weight: 700; }

/* ---------- Capçalera ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--header-h);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  background: var(--bg);
  font-size: var(--fs-small);
}

.brand {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
}
.brand img { width: clamp(132px, 14vw, 180px); height: auto; }

.site-nav {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
}
.nav-group { display: flex; align-items: center; gap: clamp(20px, 2.4vw, 36px); }
.nav-home { display: none; }

.lang { display: flex; gap: 10px; }
.lang button { padding: 4px 0; letter-spacing: 0.04em; }

.menu-toggle { display: none; position: relative; z-index: 2; padding: 8px; }

.menu-toggle-icon,
.menu-toggle-icon::before,
.menu-toggle-icon::after {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.menu-toggle-icon { position: relative; }
.menu-toggle-icon::before,
.menu-toggle-icon::after { content: ""; position: absolute; left: 0; }
.menu-toggle-icon::before { top: -7px; }
.menu-toggle-icon::after { top: 7px; }
.nav-open .menu-toggle-icon { background: transparent; }
.nav-open .menu-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-open .menu-toggle-icon::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 759px) {
  .menu-toggle { display: block; }
  .brand img { width: 132px; }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    flex-direction: column;
    justify-content: center;
    gap: 48px;
    padding: var(--header-h) var(--gutter) 32px;
    background: var(--bg);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .nav-open .site-nav {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s var(--ease);
  }
  .nav-open { overflow: hidden; }

  .nav-group { flex-direction: column; gap: 3.2px; }
  .site-nav .nav-group > li > a,
  .site-nav .nav-group > a {
    font-size: clamp(2.5rem, 12vw, 3.5rem);
    line-height: 0.92;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    text-underline-offset: 8px;
  }
  /* Pàgina activa al menú hamburguesa: cursiva, no negreta */
  .site-nav a[aria-current="page"] { font-weight: inherit; font-style: italic; }
  .lang { margin-top: 40px; gap: 24px; font-size: 1rem; }
}

/* ---------- Tipografia ---------- */

.tagline {
  font-style: italic;
  font-size: var(--fs-small);
  text-align: center;
}

.display {
  font-size: var(--fs-display);
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}
.cta .display { font-size: clamp(1.75rem, 4.5vw, 3.5rem); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.arrow-link { display: inline-flex; gap: 0.5em; }
.arrow-link::after { content: "→"; transition: transform 0.25s var(--ease); }
.arrow-link:hover::after { transform: translateX(4px); }

/* ---------- Inici: com el revers de la targeta ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: calc(100svh - var(--header-h) - 80px);
  padding-top: clamp(40px, 8vh, 96px);
  padding-bottom: clamp(56px, 10vh, 120px);
  text-align: center;
}

/* L'inici es queda fixa mentre els projectes hi pugen per sobre, tapant "Branding Editorial Packaging Digital" */
.hero-stack {
  --hero-h: calc(100svh - var(--header-h) - 80px);
  position: relative;
  height: calc(var(--hero-h) * 2);
}
.hero-stack .hero {
  position: sticky;
  top: var(--header-h);
  z-index: 1;
  height: var(--hero-h);
  min-height: 0;
}
.featured-panel {
  position: relative;
  z-index: 2;
  margin-top: calc(var(--hero-h) * -1);
  background: var(--bg);
  padding-top: clamp(56px, 8vw, 120px);
}
@media (prefers-reduced-motion: reduce) {
  .hero-stack { height: auto; }
  .hero-stack .hero { position: static; height: auto; min-height: var(--hero-h); }
  .featured-panel { margin-top: 0; }
}

.disciplines {
  font-size: var(--fs-disc);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.disciplines a { display: inline-block; }
.disciplines a:hover,
.disciplines a:focus-visible { font-style: italic; }

/* ---------- Capçaleres de pàgina ---------- */

.page-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3vw, 32px);
  padding-top: clamp(48px, 10vh, 128px);
  padding-bottom: clamp(48px, 8vh, 104px);
  text-align: center;
}
.page-head .lead { max-width: 30ch; }

.section { padding-bottom: clamp(80px, 12vw, 180px); }
.projects-page { --filters-gap: clamp(24px, 3vw, 40px); padding-top: var(--filters-gap); }

.section-head {
  margin-bottom: clamp(32px, 4vw, 56px);
  text-align: center;
}
.section-head h2 { font-size: var(--fs-small); font-style: italic; }
.hero .tagline { font-style: normal; font-size: clamp(0.81rem, 1.5552vw, 1.296rem); }

.section-foot { margin-top: clamp(48px, 6vw, 88px); text-align: center; }

/* ---------- Graella ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.grid-empty { grid-column: 1 / -1; text-align: center; }

.card { display: block; text-align: center; }

.media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Zoom exterior: creix tot el requadre (la imatge no es mou dins seu) */
.card .media { transition: transform 0.6s var(--ease); }
.card:hover .media,
.card:focus-visible .media { transform: scale(1.02); z-index: 1; }

.media video { display: block; width: 100%; height: auto; }
.card .media video { height: 100%; object-fit: cover; }
.media-free { aspect-ratio: auto; }
.media-free img { height: auto; }
.media-portrait { aspect-ratio: 2 / 3; }

/* Mentre no hi ha la imatge: requadre amb línia fina */
.media.is-empty { aspect-ratio: 4 / 5; box-shadow: inset 0 0 0 1px var(--fg); }
.media-free.is-empty { aspect-ratio: 3 / 2; }
.media-portrait.is-empty { aspect-ratio: 2 / 3; }
.media.is-empty img { opacity: 0; }
.media.is-empty::after {
  content: attr(data-pending);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: var(--fs-small);
  font-style: italic;
}

/* Portades de projecte: 5:4 */
.card .media,
.card .media.is-empty { aspect-ratio: 5 / 4; }

.card-meta { padding-top: 8.7px; line-height: 1.2; text-align: left; } /* 1,5 → 1,2: interlineat un 20% més ajustat */
.card-title { font-size: var(--fs-body); }

/* ---------- Filtres ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin-bottom: var(--filters-gap);
  font-size: var(--fs-small);
  text-transform: uppercase;
}
.filters button { padding: 4px 0; text-transform: inherit; }
.filters button:hover,
.filters button:focus-visible { font-style: italic; }
/* Apartat actiu: negreta i cursiva, sense subratllat */
.filters button,
.filters button:hover { text-decoration: none; }
.filters button[aria-pressed="true"] { font-weight: 700; font-style: italic; }
@media (max-width: 759px) {
  .filters { gap: 4px 18px; font-size: 0.75rem; }
}

/* ---------- Projecte ---------- */

.project-head {
  display: grid;
  justify-items: center;
  gap: clamp(24px, 4vw, 48px);
  padding-top: clamp(48px, 10vh, 128px);
  padding-bottom: clamp(56px, 8vw, 120px);
  text-align: center;
}
.project-title { text-align: center; }

.project-title-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 48px;
  font-size: var(--fs-small);
}

.project-text {
  max-width: 34ch;
  font-size: clamp(0.875rem, 1.68vw, 1.4rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.project-text p + p { margin-top: 1em; }

/* Ordinador: títol a l'esquerra, text a la dreta (a mòbil es queda centrat) */
@media (min-width: 900px) {
  .project-head {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    justify-items: start;
    text-align: left;
  }
  .project-title,
  .project-text { text-align: left; }
  .project-title-col { align-items: flex-start; }
  .project-meta { justify-content: flex-start; }
}

.project-images {
  --img-gap: var(--grid-gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--img-gap);
}

.project-images > li { cursor: zoom-in; }

/* ---------- Lightbox: previsualització a pantalla completa ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease);
}
.lightbox[aria-hidden="false"] { opacity: 1; visibility: visible; }
body.lightbox-open { overflow: hidden; }

.lightbox-stage {
  width: min(92vw, 1400px);
  height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-stage img,
.lightbox-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close {
  top: clamp(12px, 3vw, 32px);
  right: clamp(12px, 3vw, 32px);
  font-size: clamp(28px, 4vw, 40px);
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(36px, 6vw, 64px);
  padding: 0 clamp(8px, 2vw, 24px);
}
.lightbox-prev { left: clamp(4px, 2vw, 24px); }
.lightbox-next { right: clamp(4px, 2vw, 24px); }
.lightbox-close:hover,
.lightbox-nav:hover { opacity: 0.7; }

/* Martí 1913 Foundation: imatges quadrades */
.project-images[data-project="mosaics-marti"] .media { aspect-ratio: 1 / 1; }
.project-images > li { width: 100%; }
@media (min-width: 640px) {
  .project-images > li { width: calc((100% - var(--img-gap)) / 2); }
}
@media (min-width: 1100px) {
  .project-images > li { width: calc((100% - 2 * var(--img-gap)) / 3); }
}

.project-images--3 { display: grid; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) {
  .project-images--3 { grid-template-columns: repeat(3, 1fr); }
}
.project-images--3 > li { width: auto; }
.project-images--3 .media { aspect-ratio: 4 / 5; }
.project-images--3 .media video { height: 100%; object-fit: cover; }

/* columnes: 2 — es queda en 2 columnes també a pantalles amples, per veure les imatges més grans */
@media (min-width: 1100px) {
  .project-images--2 > li { width: calc((100% - var(--img-gap)) / 2); }
}
.project-images--2 .media { aspect-ratio: 4 / 5; }
.project-images--2 .media video { height: 100%; object-fit: cover; }

.next-project {
  display: block;
  margin-top: clamp(96px, 12vw, 180px);
  padding-bottom: clamp(64px, 10vw, 140px);
  text-align: center;
}
.next-project .eyebrow { font-size: var(--fs-small); font-style: italic; }
.next-title {
  display: block;
  margin-top: 16px;
  font-size: clamp(2rem, 5.6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.next-project:hover .next-title { font-style: italic; }

/* ---------- Sobre mi ---------- */

.about {
  display: grid;
  gap: clamp(48px, 6vw, 96px);
  justify-items: center;
  padding-top: clamp(48px, 10vh, 128px);
  padding-bottom: clamp(80px, 12vw, 160px);
  text-align: center;
}
.about-portrait { width: min(100%, 420px); order: 2; }

/* Mòbil: el text es "desmunta" per intercalar-hi la foto — primer el lead, després la foto, després la resta */
.about-text { display: contents; }
.about-text .lead { max-width: 26ch; order: 1; justify-self: stretch; text-align: left; }
.about-bio { margin-top: 0; max-width: 48ch; order: 3; justify-self: stretch; text-align: left; }
.about-bio p + p { margin-top: 1em; }

.services { margin-top: 0; order: 4; justify-self: stretch; text-align: left; }
.services h3 { font-size: var(--fs-small); font-style: italic; margin-bottom: 20px; }
.services li {
  font-size: var(--fs-lead);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Ordinador: la foto ocupa tota la meitat dreta, el text a l'esquerra (primer bloc de la pàgina) */
@media (min-width: 900px) {
  .about {
    --about-h: calc(100svh - var(--header-h));
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0;
    max-width: none;
    min-height: var(--about-h);
    padding: 0;
  }
  .about-portrait { width: 100%; order: 2; }
  .about-portrait .media {
    width: 100%;
    height: var(--about-h);
    aspect-ratio: auto;
  }
  .about-text {
    display: flex;
    flex-direction: column;
    order: 1;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    min-height: var(--about-h);
    padding: 24px clamp(32px, 5vw, 96px);
  }
  .about-text .lead { font-size: clamp(1.25rem, 2vw, 1.75rem); max-width: 28ch; }
  .about-bio { margin-top: clamp(20px, 3.5vh, 40px); }
  .services { margin-top: clamp(24px, 5vh, 56px); }
  .services h3 { margin-bottom: 12px; }
  .services li { font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.4; }
}

/* ---------- Crida a l'acció ---------- */

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(29px, 3.63vw, 48.4px);
  padding-top: clamp(32px, 5vw, 70px);
  padding-bottom: clamp(80px, 12vw, 160px);
}
.cta-button {
  display: inline-flex;
  align-items: center;
  padding: 12.8px 28.8px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-size: var(--fs-lead);
  line-height: 1.2;
  transition: background 0.2s, color 0.2s;
}
.cta-button:hover { background: var(--fg); color: var(--bg); }

/* Formulari de contacte repetit a la home, sota de tot */
.contact-form {
  display: flex;
  justify-content: center;
  padding-top: clamp(32px, 5vw, 70px);
  padding-bottom: clamp(80px, 12vw, 160px);
}


/* ---------- Contacte ---------- */

.contact {
  padding-top: clamp(56px, 8vw, 120px);
  padding-bottom: clamp(80px, 12vw, 160px);
}
.contact-intro { text-align: left; margin-bottom: clamp(32px, 5vw, 56px); }

/* Ordinador: el text a l'esquerra, el formulari a la dreta */
@media (min-width: 900px) {
  .contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(48px, 6vw, 96px);
    align-items: start;
  }
  .contact-intro { margin-bottom: 0; }
}

.form { width: min(100%, 560px); text-align: left; }
.field { display: block; margin-top: 28px; text-align: left; }
.field span { display: block; font-size: var(--fs-small); margin-bottom: 4px; }
.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--fg);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* evita el zoom a iOS */
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 160px; resize: vertical; }
.field input:focus,
.field textarea:focus { outline: none; box-shadow: 0 1px 0 0 var(--fg); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.button {
  margin-top: 40px;
  padding: 11.2px 32px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--fs-small);
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
}
.button:hover { background: var(--fg); color: var(--bg); }
.button:disabled { opacity: 0.5; }

.form-status { margin-top: 20px; min-height: 1.5em; font-size: var(--fs-small); font-style: italic; }

/* ---------- Peu: la fila de contacte de la targeta ---------- */

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px var(--gutter) 48px;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px clamp(24px, 3vw, 40px);
  font-size: var(--fs-small);
}

/* ---------- Aparició ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card .media { transition: none; }
}
