/* A NEW DAY — style.css */

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

/* --- VARIÁVEIS --- */
:root {
  --bg:         #f3f8ff;
  --blue:       #0102a1;
  --black:      #000;
  --white:      #fff;
  --sand:       #ab886d;
  --green:      #16c47f;
  --gold:       #face68;
  --footer-bg:  #fffdf1;
  --body-font:  'DM Sans', sans-serif;
  --title-font: 'Instrument Sans', sans-serif;
  --transition: 0.3s ease;
  --max-content: 1200px;
}

/* --- BASE --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

html, body {
  background-color: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--body-font);
  color: var(--black);
}

img { max-width: 100%; display: block; }
a   { text-decoration: none; color: inherit; }
ul  { list-style: none; }

/* =============================================
   TIPOGRAFIA
   ============================================= */
h1 {
  font-family: var(--body-font);
  font-size: clamp(0.95rem, 1.425vw, 1.52rem);
  font-weight: 800;
  line-height: 1.45;
  color: var(--black);
}

h2 {
  font-family: var(--body-font);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--black);
}

h3 {
  font-family: var(--body-font);
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  font-weight: 500;
  line-height: 1.35;
  color: var(--black);
}

h4 {
  font-family: var(--body-font);
  font-size: clamp(0.8rem, 1.1vw, 0.95rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--black);
}

p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

/* =============================================
   HEADER
   ============================================= */
#site-header {
  position: sticky;
  top: 0;
  z-index: 10001;
  background-color: var(--bg);
  padding: 16px 40px;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: var(--max-content);
  margin: 0 auto;
}

.site-logo {
  display: block;
  width: clamp(80px, 6vw, 120px);
  flex-shrink: 0;
}

.site-logo img {
  width: 100%;
  height: auto;
}

/* Nav desktop */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding-top: 4px;
}

.nav-desktop li a {
  display: inline-block;
  position: relative;
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.15vw, 1.15rem);
  font-weight: 500;
  color: var(--black);
  transition: color var(--transition);
}

.nav-desktop li a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  width: 0;
  background-color: var(--blue);
  transition: width var(--transition);
}

.nav-desktop li a:hover        { color: var(--blue); }
.nav-desktop li a:hover::after { width: 100%; }

.nav-desktop li.current a {
  color: var(--blue);
  pointer-events: none;
}

.nav-desktop li.current a::before {
  content: "/ ";
  color: var(--blue);
  margin-right: 4px;
}

.lang-switch {
  font-family: var(--body-font);
  font-size: clamp(0.85rem, 1vw, 1rem);
  color: var(--black);
  cursor: pointer;
  background: none;
  border: none;
  transition: color var(--transition);
}

.lang-switch:hover { color: var(--blue); }

.logo-lang {
  display: flex;
  align-items: flex-start;
}

.nav-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.lang-switch-link {
  font-family: var(--body-font);
  font-size: 0.75rem;
  font-weight: 400;
  color: #bbb;
  text-decoration: none;
  margin-bottom: 6px;
  transition: color var(--transition);
}

.lang-switch-link:hover { color: var(--blue); }

/* Nav toggle (mobile) */
.nav-toggle {
  display: none;
  width: clamp(28px, 6vw, 36px);
  height: clamp(28px, 6vw, 36px);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10001;
}

.dot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 3px;
  width: 100%;
  height: 100%;
}

.dot-grid span {
  width: 4px;
  height: 4px;
  background: var(--black);
  border-radius: 50%;
  display: block;
  margin: auto;
  transition: opacity var(--transition);
}

.nav-toggle.active .dot-grid span { opacity: 0; }

.nav-toggle.active::before,
.nav-toggle.active::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 2.5px;
  background: var(--black);
  border-radius: 2px;
  left: 50%;
  top: 50%;
}

.nav-toggle.active::before { transform: translate(-50%, -50%) rotate(45deg); }
.nav-toggle.active::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* Nav mobile overlay */
.nav-mobile {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav-mobile.open {
  opacity: 1;
  visibility: visible;
}

.nav-mobile ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.nav-mobile li a {
  font-family: var(--body-font);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 400;
  color: var(--black);
  transition: color var(--transition);
}

.nav-mobile li a:hover { color: var(--blue); }

/* Link de idioma (último item) — discreto, minúsculas e entre parênteses:
   ( english ) / ( pt ) */
.nav-mobile li:last-child a {
  text-transform: lowercase;
  font-size: 1rem;
  color: #999;
  letter-spacing: 0.02em;
}

.nav-mobile li:last-child a::before { content: "( "; }
.nav-mobile li:last-child a::after  { content: " )"; }

/* =============================================
   MAIN CONTENT
   ============================================= */
#main-content {
  background-color: var(--bg);
}

/* Hero */
.home-hero {
  padding: 60px 40px 16px;
}

.home-hero-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

.hero-divider {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--black);
  margin-bottom: 2.5rem;
}

.hero-headline {
  max-width: 680px;
  margin-left: auto;
}

/* Tagline H1 */
.home-tagline {
  padding: 0 40px 64px;
}

.home-tagline-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

/* Portfolio grid */
.portfolio-grid {
  padding: 16px 40px 64px;
}

.portfolio-grid-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.portfolio-empty {
  /* Coluna vazia intencional — espaço de respiração à esquerda */
}

.portfolio-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: none;
}

.portfolio-item a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.portfolio-item a::after { display: none !important; }

.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.portfolio-item:hover img { transform: scale(1.03); }

.portfolio-placeholder {
  width: 100%;
  height: 100%;
  background: #dde4ef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--body-font);
  font-size: 0.75rem;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 16px;
  line-height: 1.5;
}

/* =============================================
   CUSTOM CURSOR
   ============================================= */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease,
              background-color 0.2s ease, opacity 0.2s ease;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

#custom-cursor .cursor-text {
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}

#custom-cursor.view-mode {
  width: 80px;
  height: 80px;
  background-color: var(--green);
  opacity: 1;
}

#custom-cursor.view-mode .cursor-text { opacity: 1; }
#custom-cursor.hide { opacity: 0; }

/* =============================================
   SCROLL UP BUTTON
   ============================================= */
#scrollUpBtn {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 9999;
  background-color: var(--sand);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), transform 0.2s ease;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  padding: 0;
}

#scrollUpBtn:hover {
  background-color: #967258;
  transform: scale(1.05);
}

/* =============================================
   FOOTER
   ============================================= */
footer {
  background: var(--footer-bg);
  padding: 64px 48px 0;
  margin-top: 80px;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  max-width: var(--max-content);
  margin: 0 auto;
  padding-bottom: 5px;
}

.footer-section-title {
  font-family: var(--body-font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.footer-nav a {
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 400;
  color: var(--gold);
  text-decoration: none;
  line-height: 1.5;
  transition: text-decoration var(--transition);
}

.footer-nav a:hover {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
}

.footer-top a[href^="mailto:"] {
  color: var(--gold);
  text-decoration: underline;
}

.footer-top a[href^="mailto:"]:hover {
  text-decoration: none;
}

.footer-social-text {
  display: flex;
  align-items: flex-start;
  padding-top: 44px;
}

.footer-social-text p {
  font-family: var(--body-font);
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--gold);
  line-height: 1.6;
}

.footer-logo-wrap {
  display: flex;
  justify-content: center;
  padding: 0 0 24px;
}

.footer-logo-wrap img {
  width: clamp(80px, 7vw, 120px);
  height: auto;
}

.footer-cookies {
  max-width: var(--max-content);
  margin: 0 auto;
  padding-bottom: 28px;
}

.footer-cookies p {
  font-family: var(--body-font);
  font-size: 0.8rem;
  font-weight: 300;
  font-style: italic;
  color: var(--gold);
  line-height: 1.6;
}

.footer-bottom {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 20px 0 32px;
  text-align: center;
}

.footer-bottom p {
  font-family: var(--body-font);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--gold);
  line-height: 1.7;
}

.footer-bottom strong { font-weight: 700; }

/* =============================================
   RESPONSIVE — TABLET (md: 768–1024px)
   A tipografia escala sozinha pelos clamp() da base.
   ============================================= */
@media (min-width: 768px) and (max-width: 1024px) {
  .portfolio-grid-inner { grid-template-columns: repeat(2, 1fr); }
}

/* iPad Pro / tablets grandes em landscape — cursor maior */
@media only screen and (min-width: 1024px) and (max-width: 1366px) {
  #custom-cursor.view-mode { width: 120px; height: 120px; }
  #custom-cursor .cursor-text { font-size: 22px; }
}

/* Mobile (≤1023px) */
@media (max-width: 1023px) {
  .nav-desktop { display: none; }
  .nav-toggle  { display: flex; }

  /* esconde o language switch do header (existe no menu mobile) —
     evita que fique pendurado no meio do header */
  .nav-right { display: none; }

  #site-header { padding: 20px 24px; }
  .site-logo { width: clamp(100px, 13vw, 120px); }
  .home-hero   { padding: 40px 24px 24px; }
  .home-tagline { padding: 0 24px 48px; }
  .portfolio-grid { padding: 20px 24px 24px; }
  .portfolio-grid-inner { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* valor universal de respiração antes do footer em tablet/mobile */
  footer { padding: 48px 24px 0; margin-top: 95px; }
  .footer-top { grid-template-columns: 1fr; gap: 36px; padding-bottom: 40px; }
  .footer-social-text { padding-top: 0; }
}

/* iPhone (≤480px) */
@media (max-width: 480px) {
  h2 { font-size: clamp(1.2rem, 4.5vw, 1.45rem) !important; }
  .essay-content h2 { font-size: 1.5rem !important; }
  p  { font-size: 1.0625rem !important; line-height: 1.6 !important; }

  /* rótulos pequenos em maiúsculas — o p !important acima inflava-os */
  .works-label,
  .edition-label,
  .field-notes-label,
  .field-notes-badge { font-size: 0.75rem !important; }

  /* exceções ao p de 16px: manifesto maior, cookies menor */
  .home-manifesto p { font-size: 1.3rem !important; }
  .footer-cookies p { font-size: 0.8rem !important; }
  .footer-bottom p { font-size: 0.85rem !important; }

  .site-logo { width: clamp(80px, 22vw, 100px) !important; }
  .portfolio-grid-inner { gap: 8px; }

  #scrollUpBtn {
    width: 70px !important;
    height: 70px !important;
    font-size: 11px !important;
    bottom: 20px !important;
    right: 20px !important;
  }

  #custom-cursor { display: none !important; }
}

/* Texto após grid de imagens */
.home-after-grid {
  padding: 80px 40px 80px;
}

.home-after-grid-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

.home-after-grid-inner h1 {
  max-width: 75%;
  margin-left: 25%;
}

@media (max-width: 1023px) {
  .home-after-grid { padding: 24px 24px 60px; }
}
/* =============================================
   PROJECTOS SELECCIONADOS
   ============================================= */

/* --- LINHA DE CIMA — 3 imagens --- */
.folio-top {
  padding: 48px 40px 100px;
}

.folio-top-grid {
  max-width: var(--max-content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 24px;
  row-gap: 68px;
}

/* --- FOLIO LINKS — Links para projetos --- */
.folio-links {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 120px 40px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.folio-links a {
  font-family: var(--title-font);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
  transition: color var(--transition);
}

.folio-links a:hover {
  color: var(--blue);
}

/* --- ITEM --- */
.folio-item {
  display: flex;
  flex-direction: column;
}

.folio-link {
  display: block;
  overflow: hidden;
  cursor: none;
}

.folio-link::after { display: none !important; }

.folio-img-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}

.folio-item--small .folio-img-wrap {
  aspect-ratio: 3/4;
}

.folio-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
  background: #dde4ef;
}

.folio-link:hover .folio-img-wrap img {
  transform: scale(1.03);
}

/* --- CATEGORIA --- */
.folio-category {
  font-family: var(--body-font);
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--black);
  line-height: 1.4;
  margin-top: 12px;
}

/* --- ESSAY --- */
.essay-section {
  padding: 80px 40px;
}

.essay-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

.essay-back {
  display: inline-block;
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  color: var(--black);
  text-decoration: none;
  margin-bottom: 40px;
  transition: color var(--transition);
}

.essay-back:hover {
  color: var(--blue);
}

.essay-content h1 {
  margin-bottom: 32px;
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 3vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  border-top: none;
  padding-top: 0;
}

/* quando há subtítulo (h2) logo a seguir, junta o título ao subtítulo */
.essay-content h1:has(+ h2) {
  margin-bottom: 16px;
}

.essay-content h2 {
  font-family: var(--body-font);
  font-size: clamp(1.85rem, 1.9vw, 1.9rem);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 40px;
  color: var(--black);
}

.essay-content {
  max-width: 820px;
  margin: 0 auto;
}

.essay-content p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.8;
  color: var(--black);
  margin-bottom: 36px;
  max-width: 100%;
}

.field-note-link-title {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

.field-note-link-title:hover h1 {
  color: var(--blue);
}

.next-essays {
  padding: 80px 40px 0;
}

.next-essays-row {
  max-width: var(--max-content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  position: relative;
  width: 100%;
}

.next-essay-item {
  position: relative;
  padding: 0;
}

.next-essay-item a {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
  text-align: left;
  max-width: 100%;
  position: relative;
  padding-top: 40px;
}

.next-essay-item a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background-color: var(--black);
  transition: background-color var(--transition);
}

.next-essay-item a:hover {
  color: var(--blue);
}

.next-essay-item a:hover h3 {
  color: var(--blue);
}

.next-essay-item a:hover::before {
  background-color: var(--blue);
}

.next-essay-item {
  position: relative;
}

.next-essay-item h3 {
  font-family: var(--body-font);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 400;
  color: var(--black);
  line-height: 1.25;
  position: relative;
  display: block;
  width: auto;
  max-width: 100%;
}

/* --- FIELD NOTES --- */
.field-notes-section {
  padding: 80px 40px;
}

.field-notes-inner {
  max-width: 720px;
  margin: 0 auto;
}

.field-note-item {
  padding: 25px 0;
}

.field-notes-label {
  font-family: var(--body-font);
  font-size: clamp(0.75rem, 0.9vw, 0.9rem);
  color: #999;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.field-note-item h1 {
  margin-bottom: 24px;
  max-width: 100%;
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 3vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
}

.field-notes-description {
  max-width: 70%;
  margin-bottom: 24px;
}

.field-notes-description p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

.field-notes-link {
  display: inline-block;
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  color: var(--black);
  text-decoration: none;
  transition: color var(--transition);
}

.field-notes-link:hover {
  color: var(--blue);
}

.field-notes-divider {
  height: 0.5px;
  background-color: var(--black);
  margin: 25px 0 10px 0;
}

.field-note-item-inactive {
  opacity: 0.6;
  pointer-events: none;
}

.field-notes-badge {
  font-family: var(--body-font);
  font-size: clamp(0.75rem, 0.9vw, 0.9rem);
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 400;
}

/* --- CONTACT --- */
.contact-section {
  padding: 80px 40px;
}

.contact-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  text-align: right;
}

.contact-inner h1 {
  margin-bottom: 16px;
  font-weight: 400;
}

.contact-info {
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.2;
}

.contact-info p {
  margin-bottom: 16px;
}

.contact-info a {
  color: var(--blue);
  text-decoration: underline;
  transition: opacity var(--transition);
}

.contact-info a:hover {
  opacity: 0.7;
}

/* --- RESPONSIVE --- */
@media (max-width: 1023px) {
  .folio-top    { padding: 32px 24px 100px; }
  .folio-links  { padding: 12px 24px 60px; }

  .folio-top-grid {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 28px;
    row-gap: 56px;
  }
}

@media (max-width: 480px) {
  .folio-top-grid { grid-template-columns: 1fr; }
}

/* Categoria link — sem sublinhado por defeito, sublinha no hover */
.folio-category-link {
  font-family: var(--title-font);
  color: var(--black);
  text-decoration: none;
  display: inline-block;
  transition: text-decoration var(--transition);
}

.folio-category-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--black);
  text-underline-offset: 3px;
  color: var(--black);
}

/* H2 no folio — tamanho controlado */
.folio-item h2,
.folio-item h2 a {
  font-family: var(--body-font);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 12px;
  letter-spacing: 0;
}

/* =============================================
   HOMEPAGE — MANIFESTO
   ============================================= */
.home-manifesto {
  padding: 0px 0px 36px;
}

.home-manifesto-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

/* Linha que começa à esquerda do texto e vai até ao fim */
.line-from-left {
  position: relative;
  height: 0.5px;
  background: var(--black);
  margin-bottom: 12px;
  margin-left: calc(35% + 8px);
  width: calc(65% - 8px);
}

.line-from-left::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: 100vw;
  height: 0.5px;
  background: var(--black);
}

.manifesto-content {
  text-align: left;
  width: 100%;
}

.home-manifesto .line-from-left {
  margin-left: calc(25% + 4px);
  width: calc(75% - 4px);
}

.home-manifesto p {
  font-family: var(--body-font);
  font-size: clamp(1.3rem, 2.2vw, 1.52rem);
  font-weight: 500;
  line-height: 1.4;

  padding-left: calc(25% + 4px);
}

.home-manifesto p + p {
  margin-top: 1.2em;
}

.home-manifesto p:last-child {
  margin-bottom: 64px;
}

/* =============================================
   RESPONSIVE HOMEPAGE
   ============================================= */
@media (max-width: 1023px) {
  .home-manifesto  { padding: 16px 24px 100px; }
  .home-manifesto p:last-child { margin-bottom: 0; }

  /* Em tablet/mobile: sem coluna vazia, texto alinhado à esquerda */
  .portfolio-empty { display: none; }
  .portfolio-grid-inner { grid-template-columns: repeat(3, 1fr); }

  .line-from-left { margin-left: 0; width: 100%; }
  .line-from-left::after { display: none; }
  .home-manifesto .line-from-left { margin-left: 0; width: 100%; }
  .home-manifesto p { padding-left: 0; }
}

@media (max-width: 640px) {
  .portfolio-grid-inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .areas-block { width: 100%; }
  .fieldnotes-quote { font-size: clamp(1.5rem, 6vw, 2rem); }
}

/* =============================================
   PROJECT PAGE
   ============================================= */
.project-hero {
  padding: 60px 40px 0;
}

.project-hero-inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

.project-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.hero-image {
  width: 100%;
  overflow: hidden;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-right: 40px;
}

.hero-text h1 {
  font-weight: 700;
}

/* PROJECT EDITORIAL GRID */
.project-hero-grid-row-1-editorial {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-hero-grid-row-1-editorial .hero-image {
  width: 100%;
  overflow: hidden;
}

.project-hero-grid-row-1-editorial .hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* PROJECT NARRATIVE GRID */
.project-hero-grid-row-1 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.project-hero-grid-row-1 .hero-image {
  width: 100%;
  overflow: hidden;
}

.project-hero-grid-row-1 .hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-hero-grid-row-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 0;
}

.project-hero-grid-row-2 .hero-image {
  width: 100%;
  overflow: hidden;
}

.project-hero-grid-row-2 .hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.hero-text-narrative {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-right: 40px;
}

.hero-text-narrative h1 {
  font-weight: 800;
}

.project-left {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.project-description {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-description p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

.project-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.project-images-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.project-images-grid img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-images-grid img:nth-child(3) {
  grid-column: 1 / -1;
}

/* PROJECT RESPONSIVE */
@media (max-width: 1023px) {
  .project-hero { padding: 32px 24px 0; }

  .project-hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-left { gap: 24px; }
  .project-right { gap: 16px; }
}

@media (max-width: 640px) {
  .project-images-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .project-images-grid img:nth-child(3) {
    grid-column: 1;
  }
}

/* PROJECT SECTION — Additional content */
.project-section {
  padding: 40px 40px 0;
}

.project-section-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-images-row {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 0;
}

.project-images-row img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-images-row-small {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 0 auto;
  margin-bottom: 0;
  max-width: 70%;
}

.project-images-row-small img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-images-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 50px;
}

.project-images-row-2col img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-images-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 50px;
}

.project-images-row-3col img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-images-row-4col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 50px;
}

.project-images-row-4col img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.edition-label {
  font-size: clamp(0.675rem, 0.9vw, 0.81rem);
  color: #999;
  margin-bottom: 24px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.project-text-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-text-block h2 {
  font-family: var(--body-font);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--black);
}

.project-text-block p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

.project-text-block h2 {
  font-family: var(--body-font);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--black);
}

.project-text-block p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

.project-text-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.project-text-block-empty {
  display: none;
}

.project-videos-block {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 32px;
}

.project-videos-block video {
  width: 30%;
  display: block;
}

.project-three-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 50px;
}

.project-column-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.project-column-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-column-text h2 {
  font-family: var(--body-font);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--black);
}

.project-column-text p {
  font-family: var(--body-font);
  font-size: clamp(0.9rem, 1.05vw, 1.09rem);
  line-height: 1.6;
  color: var(--black);
}

/* PROJECT SECTION RESPONSIVE */
@media (max-width: 1023px) {
  .project-section { padding: 60px 24px 0; }
}

@media (max-width: 640px) {
  .project-images-row {
    gap: 16px;
  }
}

/* VÍDEO DO PROJETO — sempre rectangular 16:9 */
.project-video {
  max-width: 70%;
  margin: 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.project-video iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* gap consistente antes dos thumbnails em todas as páginas:
   a última linha não soma a sua margem inferior — o espaço fica
   apenas o padding do .next-projects */
.project-section:has(+ .next-projects) .project-section-inner > *:last-child {
  margin-bottom: 0;
}

/* NEXT PROJECTS */
.next-projects {
  padding: 100px 40px;
}

.next-projects-row {
  max-width: var(--max-content);
  margin: 0 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 64%;
  position: relative;
}

/* label "OUTROS TRABALHOS / +WORKS" por cima dos thumbnails —
   mesmo estilo do .edition-label, a ocupar a largura toda da grelha */
.works-label {
  grid-column: 1 / -1;
  font-size: clamp(0.675rem, 0.9vw, 0.81rem);
  color: #999;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
}

.next-projects-row::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 0;
  height: 0.5px;
  background: var(--black);
  width: 100%;
}

.next-projects-row::after {
  content: "";
  position: absolute;
  top: -40px;
  left: 100%;
  height: 0.5px;
  background: var(--black);
  width: 100vw;
}

.next-project-thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: none;
}

.next-project-thumb::after {
  display: none !important;
}

.next-project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.next-project-thumb:hover img {
  transform: scale(1.03);
}

/* NEXT PROJECTS RESPONSIVE */
@media (max-width: 1023px) {
  .next-projects { padding: 140px 24px 100px; }

  .next-projects-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .next-projects-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  /* retira padding-bottom para o footer margin-top ser o único espaço */
  .next-projects { padding-bottom: 0; }

}

/* =============================================
   xl — LAPTOPS (MacBook Air 1025–1440px)
   ============================================= */
@media (min-width: 1025px) and (max-width: 1700px) {
  .site-logo        { width: clamp(108px, 8.5vw, 140px); }
  .nav-desktop li a { font-size: clamp(1.05rem, 1.4vw, 1.35rem); }
  .lang-switch-link { font-size: 0.88rem; }
  h1                { font-size: clamp(1.05rem, 1.55vw, 1.68rem); }
}

/* =============================================
   RESILIÊNCIA CROSS-BROWSER / TOUCH / ULTRAWIDE
   ============================================= */

/* Toque (iOS/Android): sem highlight azul + clique otimizado */
a, button, .nav-toggle {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Media nunca ultrapassa o ecrã (Blink/WebKit/Gecko) */
img, video, iframe { max-width: 100%; }

/* Cursor custom só em dispositivos com hover real (desktop).
   Em touch (telemóvel/tablet) volta ao cursor normal. */
@media (hover: none), (pointer: coarse) {
  #custom-cursor { display: none !important; }
  body, a, button, .folio-link, .portfolio-item,
  .next-project-thumb { cursor: auto; }
}

/* next-projects/next-essays ocupam largura total em tablet/mobile */
@media (max-width: 1023px) {
  .next-projects-row { width: 100%; }
}

/* xxl — Ultrawide (≥2560px): mais respiração sem esticar infinitamente.
   Não afeta iMac 24" (que fica abaixo deste limite). */
@media (min-width: 2560px) {
  :root { --max-content: 1600px; }
}

/* =============================================
   TÍTULOS RESPONSIVOS — h1 maior em tablet/telemóvel
   (o clamp base caía no mínimo ~15px em ecrãs pequenos).
   Não afeta .essay-content h1 / .field-note-item h1,
   que têm tamanho próprio com maior especificidade.
   ============================================= */
@media (max-width: 1023px) {
  h1 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); }

  /* parágrafos maiores e mais legíveis em tablet (todas as páginas) */
  p,
  .project-description p,
  .essay-content p,
  .field-notes-description p,
  .project-text-block p,
  .project-column-text p { font-size: 1.0625rem; }

  /* títulos do folio (selected) mais pequenos em tablet.
     Fica aqui — depois da regra base .folio-item h2 (1.5rem) —
     para realmente ganhar. */
  .folio-item h2,
  .folio-item h2 a { font-size: 1.3rem; }
}
@media (max-width: 640px) {
  h1 { font-size: clamp(1.5rem, 5vw, 1.9rem); }
}

/* =============================================
   TABLET & MOBILE — LAYOUT DE IMAGENS
   As células vazias intencionais desaparecem e dão lugar
   às imagens, que ficam lado a lado. Só o texto empilha.
   (Este bloco fica no fim de propósito: ganha sobre as
    regras dispersas mais acima.)
   ============================================= */

/* --- TABLET (≤1023px) — imagens em pares, lado a lado --- */
@media (max-width: 1023px) {

  /* células/colunas vazias desaparecem */
  .portfolio-empty,
  .folio-empty,
  .audio-empty,
  .project-hero-grid-row-1 > div:empty,
  .project-images-row-4col > div:empty {
    display: none;
  }

  /* grelhas de imagens → 2 colunas lado a lado */
  .folio-top-grid,
  .project-hero-grid-row-1,
  .project-hero-grid-row-1-editorial,
  .project-three-columns,
  .project-images-row-3col,
  .project-images-row-4col {
    grid-template-columns: repeat(2, 1fr);
  }

  /* editorial — hero: as outras duas lado a lado em cima, a 1ª imagem
     a largura toda por baixo */
  .project-hero-grid-row-1-editorial .hero-image:first-child {
    order: 1;
    grid-column: 1 / -1;
  }

  /* editorial — as duas últimas imagens empilhadas (uma por baixo da outra) */
  .project-images-row-2col {
    grid-template-columns: 1fr;
  }

  /* texto + imagem → empilham (texto a largura toda) */
  .project-hero-grid-row-2,
  .project-text-row-2col {
    grid-template-columns: 1fr;
  }

  /* narrativa — a imagem órfã da última linha de 4 imagens fica a
     largura toda (em vez de isolada com vazio ao lado) */
  .project-images-row-4col:last-of-type img:last-child {
    grid-column: 1 / -1;
  }

  /* editorial: o texto ocupa a largura toda por baixo das imagens */
  .project-three-columns .project-column-text {
    grid-column: 1 / -1;
  }

  /* hero genérico: duas imagens lado a lado, a 3ª (última) maior a
     largura toda por baixo, e o texto a seguir (order empurra-o p/ o fim) */
  .project-hero-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-hero-grid .hero-image:last-child {
    grid-column: 1 / -1;
  }
  .project-hero-grid .hero-text {
    grid-column: 1 / -1;
    order: 1;
  }

  /* comunicação — é a 1ª imagem que fica sozinha a largura toda por baixo
     (as outras duas em cima), depois o texto */
  .project-hero-comm .hero-image:first-child {
    order: 1;
    grid-column: 1 / -1;
  }
  .project-hero-comm .hero-text {
    order: 2;
  }

  /* remove a margem lateral do texto do hero quando empilha */
  .hero-text,
  .hero-text-narrative {
    margin-right: 0;
  }

  /* ensaio e field-notes — tira padding inferior, footer margin trata do espaço */
  .essay-section { padding: 40px 24px 0; }
  .field-notes-section { padding: 40px 24px 0; }

  /* ensaio — texto preenche a largura toda em tablet/mobile */
  .essay-content p { max-width: 100%; }

  /* comunicação — vídeo e a imagem antes dele a largura toda */
  .project-video { max-width: 100%; }
  .project-images-row-small { max-width: 100%; }
}

/* --- TELEMÓVEL (≤640px) — uma imagem por linha onde a leitura pede --- */
@media (max-width: 640px) {

  /* narrativa — espaço entre as imagens da row-1 e o texto da row-2 */
  .project-hero-grid-row-2 {
    margin-top: 40px;
  }

  /* identidade — vídeos empilhados, um por baixo do outro, largura toda */
  .project-videos-block {
    flex-direction: column;
    gap: 16px;
  }
  .project-videos-block video { width: 100%; }
  .portfolio-grid-inner,
  .folio-top-grid,
  .project-hero-grid,
  .project-three-columns,
  .project-images-row-2col,
  .project-images-row-3col {
    grid-template-columns: 1fr;
  }

  .project-three-columns .project-column-text,
  .project-hero-grid .hero-text {
    grid-column: auto;
  }

  /* a linha de 4 imagens mantém pares lado a lado */
  .project-images-row-4col {
    grid-template-columns: repeat(2, 1fr);
  }

  /* editorial — secção seguinte ao texto sem padding-top em mobile */
  .project-section-no-top { padding-top: 0; }
}

