/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* NUPI STUDIO brand colours */
  --brand-gray:  #c1c1c1;
  --brand-black: #232321;

  --bg:       #afafae;   /* light (175,175,174) */
  --bg-alt:   #a8a8a7;
  --surface:  #a0a09f;
  --border:   #909090;
  --text:     #232321;   /* (35,35,33) */
  --muted:    #60605f;   /* borda das pílulas (96,96,95) */
  --accent:   #232321;
  --accent-2: #000000;
  --radius:   12px;
  --nav-h:    78px;
  --font: "neue-haas-grotesk-text", "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "neue-haas-grotesk-display", "neue-haas-grotesk-text", "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.4,0,.2,1);
}

/* Dark mode — black background, gray foreground */
body.dark {
  --bg:       #1c1c1c;   /* dark (28,28,28) */
  --bg-alt:   #1d1d1d;
  --surface:  #242424;
  --border:   #333333;
  --text:     #c1c1c1;   /* (193,193,193) */
  --muted:    #8e8e8c;   /* borda das pílulas (142,142,140) */
  --accent:   #c1c1c1;
  --accent-2: #ffffff;
}

html { scroll-behavior: auto; font-size: 16px; scrollbar-gutter: stable; }   /* auto: o Lenis trata da suavidade (evita conflito) */

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
/* empurra o rodapé para o fim da página */
body > main { flex: 1 0 auto; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
/* dificultar guardar/arrastar imagens */
img, .home-gif {
  -webkit-user-drag: none; user-select: none;
  -webkit-touch-callout: none;
}

/* ── Typography ── */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.8rem, 7vw, 5.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.1rem; }

/* ── Nav (header em cápsula) ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  min-height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 1rem;
  padding: 16px 30px;
  background: transparent;   /* header sempre transparente — o conteúdo passa por baixo */
}
.nav-over { background: transparent; }

/* Relógio — canto esquerdo */
.nav-clock {
  grid-column: 1; justify-self: start;
  font-size: .82rem; color: var(--text);
  letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.nav-over .nav-clock { color: #fff; }
body:not(.dark) .nav-over .nav-clock { color: var(--text); }
/* (removido o override do About: a foto foi removida, o relógio segue o tema) */

/* Cápsula central com as páginas */
.nav-pill {
  grid-column: 2; justify-self: center;
  display: flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: 999px;
  background: rgba(176, 176, 175, .75);
  border: 1px solid rgba(0, 0, 0, .1);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);
}
body.dark .nav-pill {
  background: rgba(21, 21, 21, .55); border-color: rgba(255, 255, 255, .13);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
}
.nav-over .nav-pill {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
body:not(.dark) .nav-over .nav-pill { background: rgba(0, 0, 0, .05); border-color: rgba(0, 0, 0, .12); }

.nav-pill > a,
.nav-pill .nav-dd > a {
  display: block;
  font-size: .82rem; font-weight: 400; letter-spacing: .01em;
  color: var(--text);
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.nav-over .nav-pill > a,
.nav-over .nav-pill .nav-dd > a { color: #fff; }
body:not(.dark) .nav-over .nav-pill > a,
body:not(.dark) .nav-over .nav-pill .nav-dd > a { color: var(--text); }

/* Home = logótipo (imagem) no meio do menu — B para light, C para dark */
.nav-home { display: inline-flex; align-items: center; }
.nav-pill > a.nav-home { align-self: stretch; display: flex; align-items: center; }   /* mesma altura dos links de texto → a pílula fica igual às outras */
.nav-home-img { height: 15px; width: auto; display: block; }
.nav-home-c { display: none; }
body.dark .nav-home-b { display: none; }
body.dark .nav-home-c { display: block; }

.nav-pill > a:hover,
.nav-pill .nav-dd:hover > a { background: rgba(0, 0, 0, .05); }
body.dark .nav-pill > a:hover,
body.dark .nav-pill .nav-dd:hover > a,
.nav-over .nav-pill > a:hover,
.nav-over .nav-pill .nav-dd:hover > a { background: rgba(255, 255, 255, .08); }

/* Página atual — segmento destacado (estilo da imagem) */
.nav-pill > a.is-current,
.nav-pill .nav-dd.is-current > a {
  background: rgba(0, 0, 0, .07);
  border-color: rgba(0, 0, 0, .12);
}
body.dark .nav-pill > a.is-current,
body.dark .nav-pill .nav-dd.is-current > a,
.nav-over .nav-pill > a.is-current,
.nav-over .nav-pill .nav-dd.is-current > a {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .16);
}

/* ── Pílula deslizante que segue o hover (encolhe a meio da transição) ── */
.nav-pill { position: relative; }
.nav-pill > a, .nav-pill .nav-dd > a { position: relative; z-index: 1; }
/* o destaque passa a ser a pílula móvel — sem fundo estático nos links */
.nav-pill > a, .nav-pill .nav-dd > a,
.nav-pill > a:hover, .nav-pill .nav-dd:hover > a,
.nav-pill > a.is-current, .nav-pill .nav-dd.is-current > a,
body.dark .nav-pill > a:hover, body.dark .nav-pill .nav-dd:hover > a,
body.dark .nav-pill > a.is-current, body.dark .nav-pill .nav-dd.is-current > a,
.nav-over .nav-pill > a:hover, .nav-over .nav-pill .nav-dd:hover > a,
.nav-over .nav-pill > a.is-current, .nav-over .nav-pill .nav-dd.is-current > a {
  background: transparent; border-color: transparent;
}
.nav-indicator {
  position: absolute; z-index: 0; top: 0; left: 0;
  border-radius: 999px; background: rgba(0, 0, 0, .08);
  pointer-events: none; opacity: 0;
  transition: left .4s var(--ease), width .4s var(--ease),
              top .3s var(--ease), height .3s var(--ease), opacity .2s var(--ease);
}
body.dark .nav-indicator { background: rgba(255, 255, 255, .13); }
.nav-indicator.moving { animation: nav-pinch .42s var(--ease); }
@keyframes nav-pinch { 0%, 100% { transform: scaleX(1); } 45% { transform: scaleX(.8); } }

/* Dropdown Work */
.nav-dd { position: relative; display: flex; align-items: center; }
.nav-dd-menu {
  position: absolute; top: calc(100% + 8px); left: 50%;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--border);
  white-space: nowrap;
  opacity: 0; visibility: hidden;
  transform: translate(-50%, -4px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.nav-dd:hover .nav-dd-menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.nav-dd-menu a {
  color: var(--text); font-size: .9rem;
  padding: 6px 14px; border-radius: 999px;
  transition: background .2s var(--ease);
}
.nav-dd-menu a:hover { background: rgba(0, 0, 0, .06); }
body.dark .nav-dd-menu a:hover { background: rgba(255, 255, 255, .08); }

/* Dark-mode toggle — ícone sol (light) / lua (dark) */
.theme-toggle {
  grid-column: 3; justify-self: end;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0; font-size: 0;
  color: var(--text);
  transition: transform .3s var(--ease), color .3s var(--ease);
}
.theme-toggle:hover { transform: rotate(20deg); }
.theme-toggle svg { width: 100%; height: 100%; display: block; }
.theme-toggle .ic-moon { display: none; }
body.dark .theme-toggle .ic-sun { display: none; }
body.dark .theme-toggle .ic-moon { display: block; }
.nav-over .theme-toggle { color: #fff; }
body:not(.dark) .nav-over .theme-toggle { color: var(--text); }

/* lado direito do header: ícone Play + dark mode (Play à esquerda do dark mode) */
.nav-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 15px; }
.nav-play {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); transition: transform .3s var(--ease), color .3s var(--ease);
}
.nav-play:hover { transform: scale(1.12); }
.nav-play svg { width: 100%; height: 100%; display: block; }
.nav-over .nav-play { color: #fff; }
body:not(.dark) .nav-over .nav-play { color: var(--text); }

/* Hamburger */
.nav-toggle {
  grid-column: 1; justify-self: start;
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s;
}
.nav-over .nav-toggle span { background: #fff; }
body:not(.dark) .nav-over .nav-toggle span { background: var(--text); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .75rem 1.75rem; border-radius: 9999px;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--bg);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-2px); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text); transform: translateY(-2px); }
.btn-full { width: 100%; }

/* ── Hero ── */
.hero {
  min-height: 100dvh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 2rem) clamp(1rem, 5vw, 3rem) 4rem;
  position: relative; overflow: hidden;
}

.hero-content { position: relative; z-index: 1; max-width: 640px; }

.hero-tag {
  font-size: .85rem; font-weight: 500; color: var(--accent);
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .75rem;
}

.hero-name { margin-bottom: .5rem; }

.hero-role {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--muted); font-weight: 400;
  margin-bottom: 1.5rem;
}

.hero-desc {
  font-size: 1.05rem; color: #aaa; max-width: 480px;
  margin-bottom: 2.5rem; line-height: 1.7;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Blob */
.hero-visual {
  position: absolute; top: 50%; right: -5%;
  transform: translateY(-50%);
  pointer-events: none; z-index: 0;
}
.blob {
  width: min(600px, 70vw); height: min(600px, 70vw);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(242,242,242,.12), transparent 70%);
  filter: blur(60px);
  animation: pulse 8s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: .8; }
  50%      { transform: scale(1.1); opacity: 1; }
}

/* ── Sections ── */
.section { padding: 6rem clamp(1rem, 5vw, 3rem); }
.section-alt { background: var(--bg-alt); }
.container { max-width: 1100px; margin: 0 auto; }

.section-title { margin-bottom: .5rem; }
.section-sub { color: var(--muted); font-size: 1rem; margin-bottom: 3rem; }

/* ── Projects grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s;
}
.card:hover { transform: translateY(-6px); border-color: #333; }

.card-img {
  height: 200px;
  background-size: cover; background-position: center;
}
.card-img-1 { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.card-img-2 { background: linear-gradient(135deg, #1a0a2e 0%, #2d1b69 50%, #11998e 100%); }
.card-img-3 { background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 50%, #2d2d2d 100%); }
.card-img-4 { background: linear-gradient(135deg, #0a2e1a 0%, #145a32 50%, #1e8449 100%); }

/* Card decorative grid overlay */
.card-img::after {
  content: '';
  display: block; width: 100%; height: 100%;
  background-image:
    linear-gradient(rgba(242,242,242,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242,242,242,.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

.card-body { padding: 1.5rem; }
.card-tag {
  display: inline-block;
  font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
  background: rgba(242,242,242,.08);
  padding: .25rem .75rem; border-radius: 9999px;
  margin-bottom: .75rem;
}
.card-title { margin-bottom: .5rem; }
.card-desc { font-size: .9rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.6; }
.card-link {
  font-size: .875rem; font-weight: 600; color: var(--accent);
  transition: letter-spacing .2s;
}
.card-link:hover { letter-spacing: .03em; }

/* ── Contact ── */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.contact-list {
  list-style: none; display: flex; flex-direction: column; gap: 1.25rem;
  margin-top: 2rem;
}
.contact-list li {
  display: flex; align-items: center; gap: .75rem;
}
.contact-list svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.contact-list a { color: var(--muted); font-size: .9rem; transition: color .2s; }
.contact-list a:hover { color: var(--text); }

/* Form */
.contact-form { display: flex; flex-direction: column; gap: 1.25rem; }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.field input,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  resize: vertical;
  transition: border-color .2s;
  outline: none;
  width: 100%;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field input::placeholder,
.field textarea::placeholder { color: #444; }

/* Feedback message */
.form-feedback {
  font-size: .875rem; text-align: center; min-height: 1.2rem;
}
.form-feedback.success { color: var(--accent); }
.form-feedback.error   { color: #f87171; }

/* ── Footer ── */
.footer {
  padding: 2rem 30px 10px;
  text-align: left;
  font-size: .8rem; color: var(--muted);
}

/* ── Home (NUPI STUDIO) ── */
.home {
  width: 100vw; height: 100dvh;
  margin: 0; padding: 0;
  overflow: hidden;
  position: relative;
}
/* Hero estilo loading screen: só o logo (nupi-extenso) ao fundo, com fundo cinza */
.home-loading {
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--bg);                       /* segue o tema (cinza em light) */
  padding: 0 clamp(0.5rem, 1.4vw, 1.1rem);     /* mesma margem lateral do loading */
}
.home-loading .pt-logo { width: 100%; height: auto; display: block; }

/* Cursor: bola simples branca com mix-blend difference (blend natural em qualquer fundo) */
/* esconde o cursor do sistema desde o 1º paint (não espera pelo JS) — só desktop */
@media (hover: hover) and (pointer: fine) {
  *, *::before, *::after { cursor: none !important; }
}
/* anel em stroke à volta do cursor — segue com atraso (lag) */
.cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9998; will-change: transform;
  width: 40px; height: 40px; box-sizing: border-box;
  border: 1.5px solid #fff; border-radius: 999px;
  background: transparent; mix-blend-mode: difference;
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: opacity .3s var(--ease),
              width .55s cubic-bezier(.16, 1, .3, 1), height .55s cubic-bezier(.16, 1, .3, 1);
}
.cursor-ring-txt {
  display: inline-block; max-width: 0; overflow: hidden; opacity: 0;
  white-space: nowrap; line-height: 1;
  font-size: .62rem; letter-spacing: .07em; text-transform: uppercase;
  transition: max-width .45s var(--ease), opacity .3s var(--ease);
}
/* "View Project" (hover nas capas): o anel estica e passa a ser o contorno do botão */
.cursor-ring.is-label { height: 26px; }
.cursor-ring.is-label .cursor-ring-txt { max-width: 240px; opacity: 1; transition-delay: .08s; }
/* …e a bola do meio desaparece */
.cursor-dot.is-gone { width: 0; height: 0; border-width: 0; }
.cursor-dot {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999; will-change: transform;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  width: 14px; height: 14px; padding: 0;
  border: 1.5px solid transparent; border-radius: 999px;
  background: #fff; color: transparent;
  mix-blend-mode: difference;
  transition: width .55s cubic-bezier(.16, 1, .3, 1), height .55s cubic-bezier(.16, 1, .3, 1),
              padding .55s cubic-bezier(.16, 1, .3, 1), border-radius .55s cubic-bezier(.16, 1, .3, 1),
              background .45s var(--ease), border-color .45s var(--ease), color .4s var(--ease);
}
.cursor-dot-txt {
  display: inline-block; max-width: 0; overflow: hidden;
  white-space: nowrap; line-height: 1;
  font-size: .62rem; letter-spacing: .07em; text-transform: uppercase;
  transition: max-width .4s var(--ease), font-size .3s var(--ease);
}
/* durante o merge (goo) o cursor deixa de inverter — mantém a cor constante */
.cursor-dot.cursor-merging { mix-blend-mode: normal; }
/* hover num botão/link: a bola cresce mas fica dentro do anel (40px) */
.cursor-dot.is-over { width: 24px; height: 24px; }
/* hover num botão/link: a bola torna-se o próprio botão (funde-se com ele) */
.cursor-dot.is-fill { background: rgba(255, 255, 255, .85); border-color: transparent; }
/* "View Project": pílula com contorno (como estava) */
.cursor-dot.is-label {
  width: auto; height: 24px; padding: 0 14px;
  background: transparent; border-color: #fff; color: #fff;
}
.cursor-dot.is-label .cursor-dot-txt { max-width: 240px; }
/* Redes (etiqueta pequena): pílula com fundo sólido, conforme o tema */
.cursor-dot.is-label.is-small {
  height: 20px; padding: 0 10px;
  mix-blend-mode: normal;
}
/* light → pílula cinza escuro · dark → pílula cinza claro */
body:not(.dark) .cursor-dot.is-label.is-small {
  background: #232321; border-color: #232321; color: #c1c1c1;
}
body.dark .cursor-dot.is-label.is-small {
  background: #c1c1c1; border-color: #c1c1c1; color: #232321;
}
.cursor-dot.is-label.is-small .cursor-dot-txt { font-size: .52rem; }
/* Archive — arrastar para os lados: setas ‹ › (chevrons) à esquerda e à direita da bola */
.cursor-dot::before, .cursor-dot::after {
  content: ''; position: absolute; top: 50%;
  width: 8px; height: 8px; box-sizing: border-box;
  border: solid #fff; border-width: 1.8px 0 0 1.8px;
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease), left .45s cubic-bezier(.16, 1, .3, 1), right .45s cubic-bezier(.16, 1, .3, 1);
}
.cursor-dot::before { left: 0;  transform: translateY(-50%) rotate(-45deg); }   /* ‹ */
.cursor-dot::after  { right: 0; transform: translateY(-50%) rotate(135deg); }   /* › */
.cursor-dot.is-drag::before, .cursor-dot.is-drag::after { opacity: 1; }
.cursor-dot.is-drag::before { left: -18px; }
.cursor-dot.is-drag::after  { right: -18px; }
/* a arrastar: a bola encolhe e as setas afastam-se */
body.cursor-dragging .cursor-dot.is-drag { width: 10px; height: 10px; }
body.cursor-dragging .cursor-dot.is-drag::before { left: -24px; }
body.cursor-dragging .cursor-dot.is-drag::after  { right: -24px; }
.home-gif {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: filter .45s var(--ease);
}
/* Dark (default) = gif normal · Light = inverte as cores (branco → cinza claro) */
body:not(.dark) .home-gif { filter: invert(1) brightness(0.76); }

/* Nav sobre o gif: branco no dark, escuro no light (gif invertido) */
body:not(.dark) .nav-over .nav-dd-menu a { color: var(--text); }

/* ── About ── */
.about {
  padding: 0; max-width: none; margin: 0;
  position: relative;   /* referência para o wordmark que atravessa tudo */
}
.about-layout {
  display: block;   /* sem foto na coluna: intro ocupa a largura toda */
}
/* foto (retrato) no topo-direito, ATRÁS do wordmark, acima do título */
.about-portrait {
  position: absolute; z-index: -1;                /* atrás do wordmark e do título (texto por cima) */
  top: calc(var(--nav-h) + 0.4rem);
  left: 32.3vw; right: auto;                         /* borda esquerda alinha ~ fim da palavra "into" */
  /* largura: a de EDITAR-ABOUT.js (--foto-w, ex.: 460px) mas encolhe com o ecrã (32vw = 460px a 1440px) */
  width: min(var(--foto-w, 320px), 32vw);
  aspect-ratio: 3 / 4;                             /* fallback; o JS ajusta a altura ao fundo do título (ratio 3/4) */
  object-fit: cover; border-radius: 8px;
  filter: grayscale(1);
}
/* ecrãs médios (tablet / portátil pequeno): foto maior e o título agarrado à foto (não ao fundo do ecrã),
   para não abrir um vazio entre a foto e o texto — o título sobrepõe o fundo da foto, como no desktop */
@media (min-width: 769px) and (max-width: 1100px) {
  .about-portrait { width: min(var(--foto-w, 320px), 44vw); }
  .page-about .about-text {
    min-height: 0; justify-content: flex-start;
    padding-top: calc(var(--nav-h) + 48vw - 1rem);   /* ≈ fundo da foto (44vw × 4/3) menos a altura do título */
  }
}
/* telemóvel/tablet: a foto entra no fluxo, no topo e a toda a largura (o NUPI STUDIO passa por cima
   dela, como no desktop); o título e o texto ficam por baixo */
@media (max-width: 768px) {
  .about-portrait {
    position: relative; display: block; z-index: 0;
    left: auto; right: auto; top: auto;
    width: 64%; max-width: 380px; height: auto;
    margin: calc(var(--nav-h) + 1rem) clamp(1.25rem, 5vw, 2rem) 0 auto;   /* do lado direito */
    aspect-ratio: 3 / 4; border-radius: 6px;
  }
}
.about-photo { position: sticky; top: 0; height: 100vh; }
.about-photo img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  filter: grayscale(1); background: var(--surface);
  display: block;
}
.about-text {
  padding: calc(var(--nav-h) + 4rem) clamp(1.5rem, 5vw, 5rem) 5rem;
  display: flex; flex-direction: column; justify-content: flex-end;   /* título (e parágrafo) alinhados ao fundo */
  min-height: 100vh;
  position: relative;
}
/* wordmark NUPI STUDIO — grande, atravessa toda a largura (foto + painel),
   marquee right→left em loop; blend difference (inverte a cor por baixo, como o cursor);
   fade ("fosco") nas margens para não entrar/sair cru. */
.about-wordmark {
  position: absolute;
  top: calc(var(--nav-h) + 0.75rem);
  left: 0; right: 0;
  overflow: hidden;
  z-index: 6;                    /* acima da foto/painel, abaixo do nav (100) */
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
}
/* DARK: logo claro com blend difference (inverte sozinho por cima da foto) */
body.dark .about-wordmark:not(.wm-over) { mix-blend-mode: difference; }
/* LIGHT: logo escuro; por cima da foto entra uma cópia CLARA, recortada à forma da foto (EDITAR-ABOUT.js)
   (o difference não chega no light: fundo e foto são ambos claros → o logo ficava escuro nos dois) */
.about-wordmark .wm-track img.wm-c { display: none; }
body.dark .about-wordmark .wm-track img.wm-b { display: none; }
body.dark .about-wordmark .wm-track img.wm-c { display: block; }
.about-wordmark.wm-over .wm-track img.wm-b { display: none; }
.about-wordmark.wm-over .wm-track img.wm-c { display: block; }
.about-wordmark.wm-over { z-index: 7; }
body.dark .about-wordmark.wm-over { visibility: hidden; }   /* não display:none → o marquee não reinicia ao trocar de tema */
/* marquee partilhado — About (.about-wordmark) e Play (.bolas-wordmark) */
.wm-track {
  display: flex; width: max-content;
  animation: wm-marquee 18s linear infinite;
}
.wm-track img {
  display: block;
  height: clamp(48px, 6vw, 92px); width: auto;
  margin-right: 6vw;             /* espaço entre repetições */
}
/* -50% = metade da faixa → loop sem salto */
@keyframes wm-marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wm-track { animation: none; } }

/* ── Serviços (About) ── */
.services {
  max-width: none; margin: 0;   /* largura toda, como o hero */
  padding: clamp(2rem, 6vw, 5rem) clamp(1.5rem, 5vw, 5rem) clamp(3rem, 8vw, 6rem);
  overflow-x: clip;   /* reveal dos serviços entra da direita sem criar scroll horizontal */
}
/* serviços: título full-width (fica na margem) + lista mais estreita */
.services-inner { display: block; }
.about-secondary { display: none; }   /* parágrafo passou para o hero */
.services-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.3rem, 2.8vw, 1.9rem); letter-spacing: -.02em; line-height: 1.05;
  color: var(--text);
  margin: 0 0 clamp(2.2rem, 4.5vw, 3.6rem);
}
.services-list { display: flex; flex-direction: column; max-width: 1500px; margin-inline: auto; }
@media (max-width: 768px) {
  .services-inner { grid-template-columns: 1fr; gap: clamp(1rem, 4vw, 1.6rem); }
}
.service {
  display: grid; grid-template-columns: 1fr auto;
  gap: clamp(2rem, 6vw, 6rem); align-items: center;   /* estendido: título à esquerda, ícone à direita */
  padding: clamp(1.6rem, 3.5vw, 2.6rem) 0;
  border-top: 1px solid var(--border);
}
.service:first-child { border-top: 0; }   /* sem divider acima do Brand Identity */
/* sem divider abaixo do Graphic Design (último) */
/* reveal ao scroll: cada serviço entra da esquerda ou da direita (um de cada vez) */
.service.svc-left, .service.svc-right {
  opacity: 0;
  transition: opacity .7s var(--ease), transform .9s cubic-bezier(.16, 1, .3, 1);
  will-change: transform, opacity;
}
.service.svc-left  { transform: translateX(-90px); }
.service.svc-right { transform: translateX(90px); }
.service.svc-left.visible, .service.svc-right.visible { opacity: 1; transform: none; }
.service-icon {
  width: clamp(40px, 4.5vw, 58px); color: var(--muted);   /* ícones mais pequenos */
  justify-self: end;
}
.service-icon svg { width: 100%; height: auto; display: block; }
/* seta que desliza para o serviço em hover */
.service-body { display: flex; align-items: center; }
.service-arrow {
  display: inline-flex; align-items: center; color: var(--text);
  width: 0; opacity: 0; transform: translateX(-8px); overflow: hidden;
  transition: width .35s cubic-bezier(.5, 0, .15, 1), opacity .3s var(--ease), transform .35s cubic-bezier(.5, 0, .15, 1);
}
.service-arrow svg { width: clamp(24px, 2.6vw, 34px); height: auto; flex: none; display: block; }
.service:hover .service-arrow { width: clamp(30px, 3.2vw, 42px); opacity: 1; transform: translateX(0); }
.service-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.3rem, 2.8vw, 1.9rem); letter-spacing: -.02em; line-height: 1.05;
}
@media (max-width: 768px) {
  .service { grid-template-columns: 1fr; gap: 1.2rem; }
  .service-icon { order: -1; width: 48px; justify-self: start; }
}

/* ── SERVIÇOS v2 (estilo referência) ──────────────────────────────
   título+botão à esquerda · anel iridescente ao meio · lista à direita */
.svc2 { max-width: none; margin: 0; padding: clamp(3rem, 7vw, 6rem) clamp(1.5rem, 5vw, 5rem); }
.svc2-inner {
  display: grid; grid-template-columns: 1fr auto 2.1fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.svc2-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 4.2rem); letter-spacing: -.02em; line-height: 1;
  margin: 0 0 clamp(1.2rem, 2.5vw, 2rem);
}
.svc2-cta {
  display: inline-flex; align-items: center; gap: .55rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: .7rem 1.3rem; font-size: .95rem; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.svc2-cta:hover { border-color: var(--text); }
.svc2-cta svg { width: 16px; height: 16px; }
/* anel cinza (contorno) com seta */
.svc2-ring {
  width: clamp(52px, 5vw, 68px); aspect-ratio: 1; align-self: center;
  border-radius: 50%; border: 2.5px solid var(--text);   /* cinza claro (segue o texto) */
  display: flex; align-items: center; justify-content: center;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1);   /* arrasta suavemente até ao serviço sob o rato */
}
.svc2-ring svg { width: 42%; height: auto; color: var(--text); }
/* lista: título (esquerda) + descrição (direita), com dividers */
.svc2-list { display: flex; flex-direction: column; }
.svc2-row {
  display: grid; grid-template-columns: minmax(140px, 240px) 1fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;   /* nome do serviço centrado (na vertical) em relação à descrição */
  padding: clamp(1.1rem, 2.4vw, 1.7rem) 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left .35s var(--ease), border-color .35s var(--ease);
  cursor: pointer;
}
.svc2-row:last-child { border-bottom: 0; }
/* ativo: conteúdo vai um pouco para dentro (padding → dividers ficam à largura toda) */
.svc2-row.is-active { padding-left: clamp(8px, 1vw, 16px); }
/* acende os dividers à volta do serviço ativo (o de baixo e o de cima) */
.svc2-row.is-active { border-bottom-color: var(--text); }
.svc2-row:has(+ .svc2-row.is-active) { border-bottom-color: var(--text); }
/* esbate só o TEXTO (não a linha) → os borders mantêm-se sempre a 100% */
.svc2-name, .svc2-desc { opacity: .5; transition: opacity .35s var(--ease); }
.svc2-row.is-active .svc2-name, .svc2-row.is-active .svc2-desc { opacity: 1; }
.svc2-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem); letter-spacing: -.01em; line-height: 1.15;
}
.svc2-desc { color: var(--muted); font-size: clamp(.95rem, 1.3vw, 1.05rem); line-height: 1.5; max-width: 62ch; }
@media (max-width: 900px) {
  .svc2-inner { grid-template-columns: 1fr; gap: clamp(1.5rem, 5vw, 2.5rem); align-items: start; }
  .svc2-ring { display: none; }
  .svc2-name, .svc2-desc { opacity: 1; }   /* no mobile: todos visíveis */
  /* tudo centrado: título + cada serviço (nome por cima, descrição por baixo) */
  .svc2-left { text-align: center; }
  .svc2-row { grid-template-columns: 1fr; gap: .5rem; text-align: center; }
  .svc2-row.is-active { padding-left: 0; }
  .svc2-row.is-active, .svc2-row:has(+ .svc2-row.is-active) { border-bottom-color: var(--border); }
  .svc2-desc { margin: 0 auto; }
}

/* Clientes (About) */
.about-clients {
  max-width: none; margin: 0;          /* largura toda da página (dividers full-width) */
  padding: clamp(1.2rem, 3vw, 2rem) clamp(1.5rem, 5vw, 5rem);   /* topo = fundo (espaço igual aos dividers) */
  text-align: left;                    /* alinhado à esquerda */
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);   /* divider em cima e em baixo */
}
.about-clients-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.3rem, 2.8vw, 1.9rem); letter-spacing: -.02em; line-height: 1.05;   /* tamanho dos títulos dos serviços */
  margin-bottom: clamp(2.8rem, 5.5vw, 4.5rem);   /* mais espaço até aos logos */
}
/* roster: 5 logos (menores), à esquerda, com transição em onda */
.about-clients-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(1.4rem, 3vw, 2.6rem);
  align-items: center; justify-items: center;
  width: 100%;                         /* ocupa toda a largura */
}
.client-slot { width: 100%; display: flex; align-items: center; justify-content: center; }
.about-clients-grid .client-logo {
  width: auto; height: clamp(94px, 10vw, 120px); max-width: 100%; object-fit: contain;   /* tamanho original */
  transition: opacity .32s var(--ease), transform .32s var(--ease);   /* fade da troca */
}
.about-clients-grid .client-logo.is-out { opacity: 0; transform: translateY(-8px); }
/* logos wordmark (largos, muito espaço transparente): ampliar p/ ficarem
   com presença semelhante aos restantes */
.about-clients-grid .client-logo[src*="Fundamentum"],
.about-clients-grid .client-logo[src*="Autosueco"],
.about-clients-grid .client-logo[src*="Apartments2stay"] { transform: scale(1.55); }
.about-clients-grid .client-logo[src*="Fundamentum"].is-out,
.about-clients-grid .client-logo[src*="Autosueco"].is-out,
.about-clients-grid .client-logo[src*="Apartments2stay"].is-out { transform: translateY(-8px) scale(1.55); }
@media (max-width: 640px) { .about-clients-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── ESTATÍSTICAS (números + label, com dividers verticais) ── */
.about-stats {
  max-width: none; margin: 0;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 5vw, 5rem);
  display: flex; justify-content: center; align-items: stretch; flex-wrap: nowrap;   /* sempre numa linha */
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);   /* divider acima e abaixo dos números */
}
.about-stats .stat {
  display: flex; flex-direction: row; align-items: flex-end;   /* texto ao lado, alinhado ao limite inferior do número */
  gap: clamp(.6rem, 1.4vw, 1.1rem);
  padding: clamp(.4rem, 1.2vw, 1rem) clamp(1.5rem, 4.5vw, 7rem);   /* afastados (encolhe em portáteis → cabem numa linha) */
}
.about-stats .stat + .stat { border-left: 1px solid var(--border); }   /* divider vertical */
.stat-num {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1; letter-spacing: -.02em;
  color: var(--text);
}
.stat-label {
  font-family: var(--font); text-transform: uppercase;
  letter-spacing: .1em; font-size: clamp(.72rem, 1vw, .88rem); line-height: 1.4;
  color: var(--muted);
  margin-bottom: clamp(.3rem, .8vw, .6rem);   /* sobe o texto p/ alinhar o glifo à baseline do número */
}
/* ecrãs médios: menos espaço lateral → os 3 números cabem numa linha */
@media (max-width: 1100px) {
  .about-stats .stat { padding: clamp(.4rem, 1.2vw, 1rem) clamp(1.2rem, 3.5vw, 2.6rem); }
}
.stat-num { white-space: nowrap; }   /* o JS reserva a largura final → a animação não faz saltar de linha */
/* tablet/telemóvel: os 3 números sempre numa linha — número em cima, label por baixo, centrados */
@media (max-width: 900px) {
  .about-stats { flex-wrap: nowrap; padding: clamp(2rem, 6vw, 3rem) clamp(.75rem, 3vw, 2rem); }
  .about-stats .stat {
    flex: 1 1 0; min-width: 0;
    flex-direction: column; align-items: center; text-align: center;
    gap: .5rem; padding: .2rem clamp(.4rem, 2vw, 1.5rem);
  }
  .stat-num { font-size: clamp(2.2rem, 8vw, 3.6rem); }
  .stat-label { margin-bottom: 0; letter-spacing: .06em; font-size: clamp(.62rem, 1.9vw, .8rem); }
}

/* Botão flutuante "voltar ao topo" */
.scrolltop-float {
  position: fixed; right: clamp(16px, 3vw, 32px); bottom: clamp(40px, 6vw, 72px); z-index: 60;
  width: 34px; height: 34px; padding: 0;   /* igual ao dos projetos */
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--bg); color: var(--text); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s,
    color .15s linear .2s, border-color .2s var(--ease);   /* saída: escurece quando a cor já recuou */
}
.scrolltop-float.show { opacity: 1; visibility: visible; transform: none; }
body.dark .scrolltop-float { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }

/* CTA final do About */
/* CTA — sem fundo (título+sub à esquerda, botão à direita) */
.about-cta {
  max-width: none; margin: 0 0 clamp(3rem, 8vw, 7rem);   /* largura toda + espaço até ao rodapé */
  padding: clamp(2.6rem, 6vw, 4.6rem) clamp(1.5rem, 5vw, 5rem);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);   /* divider em cima e em baixo */
}
.about-cta-inner {
  max-width: 1080px; margin: 0 auto;   /* conteúdo mais estreito (dividers ficam full-width) */
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 3rem); flex-wrap: wrap; text-align: left;
}
/* texto da esquerda um pouco mais à esquerda — só em ecrãs largos, onde o
   bloco (max 1080px) está realmente centrado; abaixo alinha ao padding normal */
@media (min-width: 1240px) { .about-cta-text { margin-left: clamp(-3rem, -2.5vw, -1rem); } }
.about-cta-title {
  color: var(--text); font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem); letter-spacing: -.02em; line-height: 1.1;
  margin: 0 0 .55rem;
}
.about-cta-sub {
  color: var(--muted); font-family: var(--font);
  font-size: clamp(.95rem, 1.4vw, 1.05rem); line-height: 1.5; max-width: 46ch; margin: 0;
}
/* CTA do About: só contorno → cheio no hover; a seta atravessa POR TRÁS da palavra.
   O botão nunca muda de tamanho (a largura da seta está sempre reservada). */
.about-cta-link {
  --acl-ease: cubic-bezier(.5, 0, .15, 1);
  --acl-arrow: 16px; --acl-gap: .55rem;
  position: relative; isolation: isolate; flex-shrink: 0;
  /* recorte pela borda de FORA (não overflow:hidden, que corta por dentro do contorno e deixava
     uma linha do fundo entre a cor e o contorno) → a cor cobre o botão todo, contorno incluído */
  -webkit-clip-path: inset(0 round 999px); clip-path: inset(0 round 999px);
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; border: 1.5px solid var(--text); border-radius: 999px;
  background: transparent; color: var(--text);
  padding: calc(.9rem - 1.5px) calc(1.65rem - 1.5px);
  font-size: .98rem; font-weight: 500; font-family: inherit;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color .35s var(--acl-ease);
}
/* preenchimento: varrimento pela ESQUERDA (ponta arredondada), em sincronia com a seta
   (que sai pela direita e reaparece pela esquerda) — mesmos tempos e curvas dos keyframes da seta */
.about-cta-link::before {
  content: ""; position: absolute; z-index: -1; inset: -2px;   /* por cima do contorno também */
  border-radius: 0 999px 999px 0; background: var(--text);
  transform: translateX(-101%);
}
.about-cta-link.is-in::before { animation: acl-fill-in .8s forwards; }
.about-cta-link.is-out::before { animation: acl-fill-out .8s forwards; }
@keyframes acl-fill-in {
  0%, 42% { transform: translateX(-101%); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { transform: translateX(0); }
}
@keyframes acl-fill-out {
  0%      { transform: translateX(0); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%,100%{ transform: translateX(-101%); }
}
/* o texto inverte quando a cor o alcança; ao sair volta logo a seguir */
.about-cta-link { transition: color .15s linear .2s; }                 /* saída: escurece quando a cor já recuou */
.about-cta-link.is-in { color: var(--bg); transition: color .12s linear .38s; }   /* entrada: fica claro quando a cor chega ao texto */
.acl-inner {
  position: relative; display: inline-flex; align-items: center;
  padding-right: calc(var(--acl-arrow) + var(--acl-gap));      /* espaço da seta */
}
.about-cta-link { --acl-pad: calc(1.65rem - 1.5px); }          /* padding lateral (até ao limite do botão) */
.acl-txt { position: relative; z-index: 1; transition: transform .5s var(--acl-ease); }
.acl-arrow {
  position: absolute; z-index: 0; top: 50%; margin-top: calc(var(--acl-arrow) / -2);
  width: var(--acl-arrow); height: var(--acl-arrow);
  left: calc(100% - var(--acl-arrow));                          /* repouso: à direita da palavra */
}
/* .is-in (rato/foco entra): a seta continua para a direita, some no limite do botão
   (overflow:hidden) e reaparece pela esquerda até à posição final. O texto desliza para o lugar dela. */
.about-cta-link.is-in .acl-arrow { animation: acl-in .8s forwards; }
.about-cta-link.is-in .acl-txt { transform: translateX(calc(var(--acl-arrow) + var(--acl-gap))); transition-delay: .3s; }
@keyframes acl-in {
  0%      { left: calc(100% - var(--acl-arrow)); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { left: calc(100% + var(--acl-pad)); }                                      /* fora, à direita */
  42.01%  { left: calc(-1 * (var(--acl-arrow) + var(--acl-pad))); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }  /* fora, à esquerda */
  100%    { left: 0; }
}
/* .is-out (rato sai): percurso inverso — sai pela esquerda e volta a entrar pela direita */
.about-cta-link.is-out .acl-arrow { animation: acl-out .8s forwards; }
@keyframes acl-out {
  0%      { left: 0; animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { left: calc(-1 * (var(--acl-arrow) + var(--acl-pad))); }
  42.01%  { left: calc(100% + var(--acl-pad)); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { left: calc(100% - var(--acl-arrow)); }
}
@media (prefers-reduced-motion: reduce) {
  .about-cta-link, .acl-txt { transition: none; }
  .about-cta-link.is-in .acl-arrow, .about-cta-link.is-out .acl-arrow,
  .about-cta-link.is-in::before, .about-cta-link.is-out::before { animation: none; }
  .about-cta-link.is-in::before { transform: none; }
  .about-cta-link.is-in .acl-arrow { left: 0; }
}

.about-lead {
  font-family: var(--font-display); font-weight: 550;   /* neue-haas-grotesk-display */
  font-size: clamp(2.4rem, 5.4vw, 5rem); line-height: .98; letter-spacing: -.015em;
  font-kerning: normal; -webkit-font-feature-settings: "kern" 1; font-feature-settings: "kern" 1;   /* kerning do tipo de letra */
  margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
  white-space: nowrap;   /* cada linha (do <br>) fica numa só */
}
@media (max-width: 768px) { .about-lead { white-space: normal; font-size: clamp(2.2rem, 9vw, 3.6rem); } }
.about-text p, .about-secondary p {
  font-family: var(--font); font-weight: 400;            /* neue-haas-grotesk-text, normal */
  color: var(--text); font-size: clamp(1.5rem, 3.4vw, 2.8rem); line-height: 1.28;
  margin-bottom: clamp(1rem, 2vw, 1.6rem); max-width: none;   /* grande, largura toda */
}
.about-text p:last-child, .about-secondary p { margin-bottom: 0; }
/* 2º parágrafo — à esquerda dos serviços, fixo no sítio (preenche a coluna) */
.about-secondary { padding: 0; }
.about-secondary p { font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.4; }
.about-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* ── CV ── */
.cv {
  padding: calc(var(--nav-h) + 4rem) clamp(1.25rem, 5vw, 5rem) 5rem;
  max-width: 820px; margin: 0 auto;
}
.cv-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 2.5rem;
}
.cv-back { color: var(--muted); font-size: .9rem; transition: color .2s; }
.cv-back:hover { color: var(--accent); }
.cv-pages { display: flex; flex-direction: column; gap: 1.5rem; }
.cv-pages img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border); background: #fff;
}

/* ── Work page ── */
.work {
  padding: calc(var(--nav-h) + 4rem) 30px 5rem;
  max-width: none; margin: 0;
}
.work-head { margin-bottom: 1.25rem; }
.work-title { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 600; margin-bottom: .5rem; }
.work-sub { color: var(--muted); font-size: 1rem; }

/* Grid: 2 columns, near-full-bleed with ~10px gaps */
.w-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 10px;
  row-gap: 10px;
}

.w-item { display: block; }

/* Rectangle 16:9 — supports <img> gifs natively */
.w-rect {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}
.w-rect img {
  width: 100%; height: 100%;
  object-fit: cover;
}
/* Animated stroke on hover — draws from two opposite corners until the frame closes */
.w-rect::before,
.w-rect::after {
  content: '';
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: width .28s var(--ease), height .28s var(--ease), opacity .1s var(--ease);
}
.w-rect::before {
  top: 0; left: 0;
  border-top: 4px solid var(--stroke, var(--brand-black));
  border-left: 4px solid var(--stroke, var(--brand-black));
}
.w-rect::after {
  bottom: 0; right: 0;
  border-bottom: 4px solid var(--stroke, var(--brand-black));
  border-right: 4px solid var(--stroke, var(--brand-black));
}
/* overshoot a few px so the corners always fill solidly (clipped by overflow) */
.w-item:hover .w-rect::before,
.w-item:hover .w-rect::after {
  width: calc(100% + 4px); height: calc(100% + 4px);
  opacity: 1;
}

/* Right column: mirror the origin to the opposite corners (top-right + bottom-left) */
.w-grid .w-item:nth-child(even) .w-rect::before {
  left: auto; right: 0;
  border-left: 0;
  border-right: 4px solid var(--stroke, var(--brand-black));
}
.w-grid .w-item:nth-child(even) .w-rect::after {
  right: auto; left: 0;
  border-right: 0;
  border-left: 4px solid var(--stroke, var(--brand-black));
}

/* Caption: name left, category right */
.w-caption {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;
  margin-top: 7px;
}
.w-name {
  font-family: var(--font);
  font-size: 1rem; font-weight: 400; color: var(--text);
  letter-spacing: -.01em;
}
.w-cat {
  font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted);
}

/* ── Projects (compact grid) ── */
.projects {
  padding: calc(var(--nav-h) + 4rem) 30px 0;   /* o espaço em baixo é dado pelo .work-totop (simétrico) */
}
.p-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 20px;
}
@media (max-width: 900px) { .p-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .p-grid { grid-template-columns: 1fr; } }
.p-item { display: block; }
.p-rect {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}
.p-rect img {
  width: 100%; height: 100%; object-fit: cover;
  transition: filter .35s var(--ease), transform .6s var(--ease);
}
/* hover na imagem: fica blur (scale evita mostrar as bordas do blur) */
.p-rect:hover img { filter: blur(8px); transform: scale(1.06); }

.p-rect-link { display: block; }   /* só a imagem é clicável (não a linha toda) */
.p-name {
  display: inline-block;            /* caixa clicável só à volta do nome */
  margin-top: 10px;
  font-family: var(--font);
  font-size: 1.25rem; font-weight: 300; color: var(--text);
}

/* Cabeçalho da Projects */
.p-head { margin-bottom: 1.1rem; }
.p-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.03em;
}

/* Linha de filtros: categorias à esquerda, visualização à direita */
.p-filterbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem 1.4rem; flex-wrap: wrap; margin-bottom: 1.9rem;
}
/* Barra de filtros (chips de categoria) */
.p-filters {
  display: flex; flex-wrap: wrap; gap: 7px;
  position: relative;   /* referência para a pílula deslizante */
}
/* Filtro de visualização (grelha / lista) — só ícones, alinhado à direita.
   Mesma altura e mesma pílula deslizante das categorias. */
.p-view { display: flex; gap: 7px; flex-shrink: 0; position: relative; }
.p-vchip {
  font: inherit; font-size: .62rem; line-height: 1.6;   /* = .p-chip → mesma altura (25px) */
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 8px; border-radius: 999px;
  background: transparent; border: 1.5px solid var(--muted);
  position: relative; z-index: 1;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.p-vchip svg { width: 1.6em; height: 1.6em; display: block; }
/* chip sob a pílula: sem borda (senão a difference inverte-a) */
.p-vchip.pill-on { border-color: transparent; }
/* filtros = mesmo tamanho que as tags dos projetos (.p-cat) */
.p-chip {
  font: inherit; font-size: .62rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text);
  cursor: pointer; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
  background: transparent; border: 1.5px solid var(--muted);
  position: relative; z-index: 1;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.p-chip.is-active { background: transparent; color: var(--text); border-color: var(--muted); }
/* chip sob a pílula: sem borda (senão a difference inverte-a e mostra o "stroke") */
.p-chip.pill-on { border-color: transparent; }
/* pílula com mix-blend difference (base = bg+text → aparece a var(--text), igual às tags);
   a inversão do texto acompanha a pílula, e a borda tem timing assimétrico (não some antes) */
.p-filter-ind {
  position: absolute; z-index: 2; top: 0; left: 0;
  background: #d2d2cf; mix-blend-mode: difference; border-radius: 999px;
  pointer-events: none; opacity: 0;
  transition: left .4s var(--ease), width .4s var(--ease),
              top .3s var(--ease), height .3s var(--ease), opacity .2s var(--ease);
}
body.dark .p-filter-ind { background: #dddddd; }
.p-filter-ind.moving { animation: nav-pinch .42s var(--ease); }

/* Tags de categoria por projeto */
.p-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
/* texto do projeto + botão "View project" — escondidos na grelha, só na vista de lista */
.p-text { display: none; }
.p-viewproj { display: none; }

/* ── Vista de LISTA: 1 projeto por linha ──
   imagem à esquerda (mesmo tamanho que na grelha = 1/3); info à esquerda
   (categoria, título, texto), com bastante espaço entre a imagem e os textos */
.p-grid.is-list { grid-template-columns: 1fr; gap: 0; }
/* vista lista: cada projeto entra de baixo (fade + ease-in) ao dar scroll */
.p-grid.is-list .p-item.reveal-left,
.p-grid.is-list .p-item.reveal-up,
.p-grid.is-list .p-item.reveal-right {
  opacity: 0; transform: translateY(60px);
  transition: opacity .55s ease-in, transform .7s ease-in;
}
.p-grid.is-list .p-item.reveal-left.visible,
.p-grid.is-list .p-item.reveal-up.visible,
.p-grid.is-list .p-item.reveal-right.visible {
  opacity: 1; transform: none;
}
.p-item.is-list {
  display: grid;
  grid-template-columns: calc((100% - 40px) / 3) 1fr auto;   /* imagem | texto | categorias */
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(2.5rem, 6vw, 6rem);                  /* espaço maior entre imagem e textos */
  align-items: start;
  padding: clamp(2.2rem, 4.5vw, 3.4rem) 0;               /* espaço acima/abaixo (simétrico) */
  border-top: 1px solid var(--border);                   /* linha de separação entre projetos */
}
.p-item.is-list.p-firstvis { border-top: 0; padding-top: 0; }   /* 1º visível → sem linha acima */
.p-item.is-list .p-rect-link { grid-column: 1; grid-row: 1 / -1; align-self: start; }
.p-item.is-list .p-name {
  grid-column: 2; grid-row: 1; display: block; text-align: left; margin-top: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.1;   /* topo do glifo do título = topo do chip da categoria */
}
.p-item.is-list .p-text {
  grid-column: 2; grid-row: 2; display: block; text-align: left; margin: 21px 0 0;   /* título → texto */
  max-width: 60ch; font-family: var(--font); font-weight: 300;
  font-size: 1rem; line-height: 1.55; color: var(--muted);
}
/* categorias → topo-direito, em coluna (vertical), alinhadas ao topo do título */
.p-item.is-list .p-cats {
  grid-column: 3; grid-row: 1 / -1; margin: 0;   /* abrange todas as linhas → não infla a linha do título */
  justify-self: end; align-self: start;
  flex-direction: column; align-items: flex-end; gap: 6px;
}
/* botão "View project" → alinhado ao fundo do projeto */
.p-item.is-list .p-viewproj { display: inline-flex; grid-column: 2; grid-row: 3; align-self: end; justify-self: start; margin: 22px 0 0; }
.p-viewproj {
  align-items: center; gap: 7px;
  font-size: .62rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text); text-decoration: none; white-space: nowrap;
  padding: 3px 11px; border-radius: 999px; border: 1.5px solid var(--muted);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.p-viewproj svg { width: 12px; height: 12px; display: block; }
.p-viewproj:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
@media (max-width: 640px) {
  /* mobile: só a vista default (grelha) — sem opção de mudar */
  .p-view { display: none; }
}
.p-cat {
  font-size: .62rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text); white-space: nowrap; cursor: pointer;
  padding: 3px 9px; border-radius: 999px; border: 1.5px solid var(--muted);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.p-cat:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
/* Categorias que não estão nos filtros de cima: não clicáveis, mas mesmo aspeto (sem escurecer) */
.p-cat.is-static { cursor: default; }
.p-cat.is-static:hover { background: none; color: var(--text); border-color: var(--muted); }
/* Work: tags dos projetos preenchem sólido no hover (sem merge) */
.p-cats .p-cat:hover,
.p-cats .p-cat.is-static:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Filtro — esconder projetos que não correspondem */
.p-item.is-hidden { display: none; }

/* Reveal ao entrar no ecrã: esquerda vem da esquerda, meio de baixo, direita da direita */
.p-item.reveal-left,
.p-item.reveal-up,
.p-item.reveal-right {
  opacity: 0;
  transition: opacity .7s var(--ease), transform .9s cubic-bezier(.16, 1, .3, 1);
  will-change: transform, opacity;
}
.p-item.reveal-left  { transform: translateX(-70px); }
.p-item.reveal-right { transform: translateX(70px); }
.p-item.reveal-up    { transform: translateY(60px); }
.p-item.reveal-left.visible,
.p-item.reveal-up.visible,
.p-item.reveal-right.visible { opacity: 1; transform: none; }
@media (max-width: 560px) {
  /* 1 coluna: todos sobem */
  .p-item.reveal-left, .p-item.reveal-right { transform: translateY(60px); }
  /* galeria dos projetos: espaço entre imagens menor no telemóvel
     (seletor com .projeto para ganhar à regra base .pj-row, que vem depois no ficheiro) */
  .projeto .projeto-imgs, .projeto .pj-row { gap: 8px; }
}

/* ── Project page (scroll vertical, galeria empilhada e centrada) ── */
.projeto {
  padding: calc(var(--nav-h) + 5rem) 30px 5rem;
  width: 100%; max-width: 1400px; margin: 0 auto;   /* largura definida: não encolhe ao conteúdo */
}
/* cabeçalho: nome + links + categorias à esquerda, texto (largo) à direita */
/* grelha 2×2: título | texto (linha 1), tag | redes (linha 2, alinhadas) */
.projeto-head {
  display: grid;
  grid-template-columns: clamp(200px, 22vw, 300px) 1fr;
  column-gap: clamp(2rem, 6vw, 6rem);
  row-gap: 2.4rem;
  align-items: start;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
/* sem redes: título em cima, tag em baixo (col 1) e texto a atravessar as 2 linhas (col 2).
   nome e tag em linhas separadas → nunca se sobrepõem; a tag alinha à última linha do texto. */
.projeto-head.head-nolinks { grid-template-rows: auto 1fr; }
.projeto-head.head-nolinks .projeto-name { grid-column: 1; grid-row: 1; align-self: start; }
.projeto-head.head-nolinks .projeto-cats { grid-column: 1; grid-row: 2; align-self: end; }
.projeto-head.head-nolinks .projeto-text { grid-column: 2; grid-row: 1 / span 2; }
.projeto-name {
  font-family: var(--font); line-height: 1.3;   /* Neue Haas Grotesk Text */
  font-size: var(--pj-nome-size, 19px); font-weight: var(--pj-nome-weight, 300); color: var(--text);
}
.projeto-text {
  max-width: 1000px; font-family: var(--font);   /* Neue Haas Grotesk Text */
  font-size: var(--pj-texto-size, 18px); font-weight: var(--pj-texto-weight, 300); line-height: 1.5; color: var(--text);
}
/* nota (opcional, "nota:" no EDITAR-PROJETOS.js) — por baixo da categoria, mesmo tamanho do texto
   mas a cinza mais discreto (--muted: mais escuro no dark, mais claro no light) */
.projeto-note {
  grid-column: 1 / -1;   /* começa por baixo da categoria; pode seguir para o lado (1 linha) */
  /* colada à 1.ª imagem (0.75rem por baixo) e 50px abaixo da categoria (row-gap 2.4rem + isto) */
  margin: calc(50px - 2.4rem) 0 0;
  font-style: italic;
  font-family: var(--font); line-height: 1.5;
  font-size: 15px; font-weight: var(--pj-texto-weight, 300);   /* mais pequena que o texto (18px) */
  color: var(--muted);
}
/* com nota: o cabeçalho encosta mais à galeria (a nota fica logo acima da imagem) */
.projeto-head:has(.projeto-note) { margin-bottom: .75rem; }
.projeto-links { display: flex; gap: 22px; align-self: center; }
.projeto-links a { color: var(--text); display: inline-flex; }
/* o ícone não muda ao passar o cursor — a etiqueta do cursor é que aparece */
.projeto-links svg { width: 20px; height: 20px; display: block; }
.projeto-cats { display: flex; flex-wrap: wrap; gap: 6px; }
/* tag dentro do projeto: 1 cor, igual aos ícones/texto/título (var --text) */
.projeto-cats .p-cat { cursor: default; pointer-events: none; border-color: var(--text); font-size: var(--pj-cat-size, .62rem); font-weight: var(--pj-cat-weight, 400); }
/* galeria: replica a estrutura do site original (full-width + grelhas justificadas) */
.projeto-imgs {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 100%;
}
.pj-row {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 12px; width: 100%;
  /* fade-in ao entrar no ecrã */
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .9s cubic-bezier(.16, 1, .3, 1);
  will-change: opacity, transform;
}
.pj-row.in-view { opacity: 1; transform: none; }
.pj-row img,
.pj-row video {
  display: block; object-fit: cover;
  border-radius: 4px;   /* sem background: imagens/gifs transparentes não ganham caixa cinza */
}
/* barra de progresso vertical, fixa na margem esquerda */
.projeto-progress {
  position: fixed; left: 24px; top: 0; bottom: 0;   /* sem transform: não prende o botão fixed */
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  z-index: 40; pointer-events: none;                /* container não bloqueia cliques nas imagens */
}
.projeto-progress > * { pointer-events: auto; }
.projeto-progress-col {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 4.5ch;   /* largura fixa: a barra não desloca ao chegar aos 100% */
}
/* botão voltar ao topo — à direita da barra, centrado, mesma cor da barra */
.projeto-scrolltop {
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;   /* mesma cor da barra não preenchida */
  background: none; color: var(--border); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);   /* contraste como o menu */
  /* escondido até haver algum scroll (.show, em main.js) — como no About.
     usa 'translate' (não 'transform', que já centra o botão na vertical) */
  opacity: 0; visibility: hidden; translate: 0 10px;
  transition: opacity .25s var(--ease), translate .25s var(--ease), visibility .25s,
    color .15s linear .12s, border-color .2s var(--ease);
}
.projeto-scrolltop.show { opacity: 1; visibility: visible; translate: 0 0; }
body.dark .projeto-scrolltop { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }
/* botão voltar-ao-topo no fim da página Work — em fluxo, centrado */
.work-totop { display: flex; justify-content: center; padding: 5rem 0; }
.work-scrolltop {
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: none; color: var(--border); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);
  position: relative; overflow: hidden; isolation: isolate;
  transition: color .15s linear .12s, border-color .2s var(--ease);   /* seta inverte quando a cor a alcança */
}
body.dark .work-scrolltop { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }
/* TODOS os botões "voltar ao topo" (Work · About · Projetos): a cor entra de BAIXO para CIMA
   com a frente em CÚPULA (meia-redonda) e a seta sai para CIMA / reaparece por BAIXO, em sincronia
   (como o CTA "Work With Me!", na vertical). Comandado por .is-in / .is-out (handler partilhado em main.js).
   (cada botão define o seu próprio transition base; aqui só o preenchimento, a seta e o estado .is-in) */
.work-scrolltop, .scrolltop-float, .projeto-scrolltop { --stf-y: 28px; overflow: hidden; isolation: isolate; }
.work-scrolltop::before, .scrolltop-float::before, .projeto-scrolltop::before {
  content: ""; position: absolute; z-index: -1;
  inset: auto; left: -20%; top: 0; width: 140%; height: 140%;       /* forma mais larga e alta que o botão */
  border-radius: 50% 50% 0 0 / 35% 35% 0 0;                          /* topo arredondado = cúpula */
  background: var(--text);
  transform: translateY(80%);                                        /* repouso: escondida por baixo */
}
/* seta a cinza (como no botão dos projetos); inverte quando a cor a alcança */
.work-scrolltop svg, .scrolltop-float svg, .projeto-scrolltop svg { width: 14px; height: 14px; stroke: var(--muted); transition: stroke .15s linear .2s; }
.work-scrolltop.is-in svg, .scrolltop-float.is-in svg, .projeto-scrolltop.is-in svg { stroke: var(--bg); transition: stroke .12s linear .38s; }
.work-scrolltop.is-in, .scrolltop-float.is-in, .projeto-scrolltop.is-in { color: var(--bg); border-color: var(--text); }
.work-scrolltop.is-in { transition: color .12s linear .38s, border-color .2s var(--ease) .3s; }
.projeto-scrolltop.is-in { transition: opacity .25s var(--ease), translate .25s var(--ease), visibility .25s,
    color .12s linear .38s, border-color .2s var(--ease) .3s; }   /* mantém o aparecer/desaparecer */
.scrolltop-float.is-in { transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s,
    color .12s linear .38s, border-color .2s var(--ease) .3s; }   /* mantém as transições de aparecer do About */
.work-scrolltop.is-in::before, .scrolltop-float.is-in::before, .projeto-scrolltop.is-in::before { animation: stf-fill-in .8s forwards; }
.work-scrolltop.is-out::before, .scrolltop-float.is-out::before, .projeto-scrolltop.is-out::before { animation: stf-fill-out .8s forwards; }
.work-scrolltop.is-in svg, .scrolltop-float.is-in svg, .projeto-scrolltop.is-in svg { animation: stf-in .8s forwards; }
.work-scrolltop.is-out svg, .scrolltop-float.is-out svg, .projeto-scrolltop.is-out svg { animation: stf-out .8s forwards; }
@keyframes stf-in {
  0%      { transform: translateY(0); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { transform: translateY(calc(-1 * var(--stf-y))); }              /* fora, por cima */
  42.01%  { transform: translateY(var(--stf-y)); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }   /* fora, por baixo */
  100%    { transform: translateY(0); }
}
@keyframes stf-out {
  0%      { transform: translateY(0); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { transform: translateY(var(--stf-y)); }
  42.01%  { transform: translateY(calc(-1 * var(--stf-y))); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { transform: translateY(0); }
}
/* (a cúpula tem 140% da altura do botão: 80% = escondida por baixo · -25% = topo já acima do botão) */
@keyframes stf-fill-in {
  0%, 42% { transform: translateY(80%); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { transform: translateY(-25%); }
}
@keyframes stf-fill-out {
  0%      { transform: translateY(-25%); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%,100%{ transform: translateY(80%); }
}
@media (prefers-reduced-motion: reduce) {
  .work-scrolltop, .projeto-scrolltop, .work-scrolltop::before, .scrolltop-float::before, .projeto-scrolltop::before { transition: none; }
  .work-scrolltop.is-in svg, .work-scrolltop.is-out svg, .scrolltop-float.is-in svg, .scrolltop-float.is-out svg,
  .projeto-scrolltop.is-in svg, .projeto-scrolltop.is-out svg,
  .work-scrolltop.is-in::before, .work-scrolltop.is-out::before, .scrolltop-float.is-in::before, .scrolltop-float.is-out::before,
  .projeto-scrolltop.is-in::before, .projeto-scrolltop.is-out::before { animation: none; }
  .work-scrolltop.is-in::before, .scrolltop-float.is-in::before, .projeto-scrolltop.is-in::before { transform: translateY(-25%); }
}
.projeto-progress-track {
  width: 3px; height: clamp(120px, 28vh, 220px);
  background: var(--border); position: relative; overflow: hidden;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);   /* contraste como o menu */
}
body.dark .projeto-progress-track { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }
.projeto-progress-bar {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 0;
  background: var(--text);
}
.projeto-progress-pct {
  font-size: .72rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 100%; text-align: center;   /* preenche o contentor fixo: não salta de dígitos */
}

/* ── Reveal animation ── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

/* Work items: slide in from their side + fade */
.w-item.reveal-left,
.w-item.reveal-right {
  opacity: 0;
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.16,1,.3,1);
  will-change: transform, opacity;
}
.w-item.reveal-left  { transform: translateX(-220px); }
.w-item.reveal-right { transform: translateX(220px); }
.w-item.reveal-left.visible,
.w-item.reveal-right.visible { opacity: 1; transform: none; }

/* ── Responsive ── */
/* EXPERIMENTO: botão voltar-ao-topo sempre na margem direita, centrado na vertical
   (barra vertical + % ficam à esquerda). */
.projeto-scrolltop {
  position: fixed;
  right: 24px; left: auto; bottom: auto;
  top: 50%; transform: translateY(-50%);
  z-index: 45;
}
/* ecrãs mais pequenos: a barra de % sobreporia a imagem → esconde-a e o botão alinha em baixo */
@media (max-width: 1460px) {
  .projeto-progress-col { display: none; }
  .projeto-scrolltop { top: auto; bottom: 56px; transform: none; }
}

@media (max-width: 768px) {
  /* Header mobile: mantém o menu horizontal (sem hambúrguer), compacto para caber */
  .nav { padding: 10px 12px; }
  .nav-clock { display: none; }            /* liberta espaço para o menu caber */
  .nav-toggle { display: none; }           /* sem hambúrguer */
  .nav-indicator { display: block; }        /* pílula da página atual (estática) no mobile */
  .nav-pill { transform: none !important; padding: 3px; gap: 1px; }   /* anula o centerLogo, mantém horizontal */
  .nav-pill > a, .nav-pill .nav-dd > a { font-size: .6rem; padding: 5px 7px; }
  .nav-home-img { height: 15px; width: auto; }

  /* Página de projeto — empilha e esconde a barra vertical */
  .projeto { padding: calc(var(--nav-h) + 1.5rem) 20px 3rem; }
  .projeto-head { grid-template-columns: 1fr; row-gap: 1rem; }
  .projeto-text { max-width: 100%; }
  /* mobile: ordem título → texto → redes → tag */
  .projeto-links { order: 3; }
  .projeto-cats { order: 4; }
  /* reset do no-links no mobile (empilha normalmente) */
  .projeto-head.head-nolinks { grid-template-rows: none; }
  .projeto-head.head-nolinks .projeto-name,
  .projeto-head.head-nolinks .projeto-text,
  .projeto-head.head-nolinks .projeto-cats { grid-column: auto; grid-row: auto; align-self: auto; }
  .projeto-note { order: 5; grid-column: auto; margin-top: calc(50px - 1rem); }   /* mobile: row-gap 1rem → 50px abaixo da categoria */

  /* Hero */
  .hero { text-align: center; }
  .hero-content { max-width: 100%; }
  .hero-desc { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-visual { opacity: .3; right: -20%; }

  /* Contact */
  .contact-layout { grid-template-columns: 1fr; gap: 2.5rem; }

  /* Work grid → single column */
  .w-grid { grid-template-columns: 1fr; row-gap: 2.5rem; }

  /* About → stacked (foto no topo, altura normal) */
  .about-layout { grid-template-columns: 1fr; gap: 0; }
  .about-photo { position: static; height: 45vh; }
  .about-text {
    padding: 2.5rem clamp(1.25rem, 5vw, 2rem) 4rem;
    min-height: 0; justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .projects-grid { grid-template-columns: 1fr; }
  .btn { padding: .7rem 1.4rem; font-size: .85rem; }
}

/* ============================================================
   PROJECT INDEX — lista estilo "Another Collective" com
   abertura inline horizontal (sem trocar de página).
   ============================================================ */
.page-work-index { overflow-x: hidden; }
.ac-main { padding-top: var(--nav-h); }

/* Archive — cores e tipografia do site (sem fundo preto) */
.ac-index {
  padding: 0 30px 40px;
  color: var(--text);
  font-family: var(--font);
}
.ac-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -.02em;
  margin: 80px 0 40px;              /* separação projetos→Archive; e Archive→conteúdo (em baixo) */
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
/* vista lista: último projeto já tem padding em baixo → mesma margem que entre projetos */
body.work-list .ac-title { margin-top: 0; }
/* Colunas: Project · Services · Client · Year · See */
.ac-index-head,
.ac-index-row {
  display: grid;
  grid-template-columns: 1.3fr 1.7fr 1.2fr 0.7fr 150px;
  gap: 20px;
  align-items: baseline;
  text-align: left;
}
.ac-index-head {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Grupo = linha + painel expansível */
.ac-row-group { border-bottom: 1px solid var(--border); position: relative; }

.ac-index-row {
  position: relative;
  padding: 15px 0; font-size: var(--ix-row-size, .95rem);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.ac-c-name { font-weight: 500; transition: transform .3s var(--ease); }
/* hover: a linha inteira troca para o tema OPOSTO ao atual (e o nome desliza) */
/* fundo do hover: caixa com cantos redondos, cresce de BAIXO PARA CIMA (ease no fim) */
.ac-index-row::before {
  content: ''; position: absolute; z-index: -1;
  inset: 0 -14px; border-radius: 10px;
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .7s cubic-bezier(.16, 1, .3, 1);   /* mais tempo → mais smooth, desacelera no fim */
}
body.dark .ac-index-row::before { background: #afafae; }                /* dark → mostra light */
body:not(.dark) .ac-index-row::before { background: #1c1c1c; }          /* light → mostra dark */
/* hover E projeto aberto (.is-active) → mesmo estado: fundo no tema oposto, texto invertido, nome deslizado */
.ac-index-row:hover::before, .ac-index-row.is-active::before { transform: scaleY(1); }
body.dark .ac-index-row:hover, body.dark .ac-index-row:hover *,
body.dark .ac-index-row.is-active, body.dark .ac-index-row.is-active * { color: #232321; }
body:not(.dark) .ac-index-row:hover, body:not(.dark) .ac-index-row:hover *,
body:not(.dark) .ac-index-row.is-active, body:not(.dark) .ac-index-row.is-active * { color: #c1c1c1; }
.ac-index-row:hover .ac-c-name, .ac-index-row.is-active .ac-c-name { transform: translateX(12px); }

/* Botão / link "See more" — alinhado à esquerda */
.ac-c-see { white-space: nowrap; text-align: right; }   /* encosta à margem direita (= esquerda) */
.ac-see-btn,
.ac-see-link {
  font: inherit; color: var(--text);
  background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; opacity: 1;
}
.ac-nolink { opacity: .3; }
.ac-see-status { color: var(--muted); white-space: nowrap; }
/* "+" maior que roda para "X" quando o projeto está aberto */
.ac-see-plus {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: clamp(1.3rem, 2vw, 1.7rem); line-height: 1; font-weight: 300;
  transform: scale(0.83);   /* "+" mais pequeno → mesmo tamanho óptico do "X" */
  transition: transform .3s var(--ease);
}
/* + → X : à escala normal quando aberto */
.ac-index-row.is-active .ac-see-plus { transform: rotate(45deg); }

/* ── Painel expansível (galeria horizontal) ── */
.ac-index-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s var(--ease);
}
.ac-row-group.is-open .ac-index-expand { grid-template-rows: 1fr; }
.ac-expand-inner { overflow: hidden; min-height: 0; }

/* Cabeçalho do painel: nome + redes (esquerda, em cima) · texto (direita)
   · tag alinhada ao fundo = última linha do texto */
.ac-expand-head {
  display: grid;
  grid-template-columns: clamp(180px, 20vw, 300px) 1fr;
  column-gap: clamp(1.5rem, 5vw, 5rem);
  align-items: stretch;
  padding: 24px 0 4px;
}
.ac-expand-namecol {
  display: flex; flex-direction: column; justify-content: flex-start;   /* tags no topo */
}
.ac-expand-links { display: flex; gap: 22px; margin-top: 12px; }   /* redes abaixo das tags (= .projeto-links) */
.ac-expand-links a { color: var(--text); display: inline-flex; }
.ac-expand-links svg { width: 20px; height: 20px; display: block; }
.ac-expand-cats { margin-top: 0; }
.ac-expand-cats .p-cat { font-size: var(--ix-cat-size, .62rem); font-weight: var(--ix-cat-weight, 400); }
.ac-expand-text {
  flex: 1; max-width: 1000px;
  font-family: var(--font); font-size: var(--ix-texto-size, 18px); font-weight: var(--ix-texto-weight, 300);
  line-height: 1.5; color: var(--text);
  /* apara a meia-entrelinha inferior (line-height 1.5) → a caixa acaba na última linha,
     para o fundo das tags alinhar mesmo com a última linha do texto */
  margin-bottom: -0.25em;
}

.ac-expand-scroll {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  height: clamp(240px, 44vh, 440px);
  overflow-x: auto; overflow-y: hidden;
  padding: 22px 0 8px;
  scrollbar-width: none;
}
.ac-expand-scroll::-webkit-scrollbar { display: none; }
.ac-expand-scroll img,
.ac-expand-scroll video {
  height: 100%; width: auto; flex: 0 0 auto;
  display: block; border-radius: 4px; background: transparent;
}
/* pares empilhados no index (uma imagem em cima da outra, na mesma coluna) */
.ac-expand-scroll .ac-stack {
  display: flex; flex-direction: column; gap: 8px;
  height: 100%; flex: 0 0 auto;
}
.ac-expand-scroll .ac-stack img,
.ac-expand-scroll .ac-stack video {
  height: calc((100% - 8px) / 2); width: auto; flex: 0 0 auto;
}

/* projeto com 1 só foto/vídeo → centrado e maior (sem barra de percentagem) */
.ac-index-expand.is-single .ac-expand-scroll { justify-content: center; height: clamp(380px, 74vh, 720px); }
.ac-index-expand.is-single .ac-expand-progress { display: none; }

/* "+ Work" → uma linha horizontal por projeto. Cada linha é "justificada":
   as imagens têm a MESMA altura e larguras proporcionais ao rácio, preenchendo
   a largura toda (o rácio de cada imagem é mantido). */
.ac-expand-mosaic {
  display: flex; flex-direction: column;
  gap: 8px; padding: 22px 0 8px;
}
.ac-mosaic-row { display: flex; gap: 8px; align-items: flex-start; }
.ac-mosaic-row img,
.ac-mosaic-row video {
  /* largura/altura em px vêm do work-index.js (linha justificada, rácio real);
     height auto é só fallback enquanto o JS não corre */
  height: auto; display: block; border-radius: 4px; background: transparent;
}

/* barra de percentagem por baixo das imagens (toda a largura) */
.ac-expand-progress {
  display: flex; align-items: center; gap: 14px;
  width: 100%; margin-top: 16px; margin-bottom: 22px;
}
.ac-expand-progress-track {
  flex: 1; height: 2px; background: var(--border);
}
.ac-expand-progress-bar {
  height: 100%; width: 0; background: var(--text);
  transition: width .08s linear;
}
.ac-expand-progress-pct {
  min-width: 42px; text-align: right;
  font-size: .7rem; letter-spacing: .04em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Rodapé unificado: copy à esquerda · email + redes à direita */
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem 1.5rem;
  padding: 1.5rem 30px 30px;
}
.footer-copy { color: var(--muted); }
.footer-right { display: flex; align-items: center; gap: 1.4rem; }
.footer-email {
  color: var(--text);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  transition: opacity .2s var(--ease);
}
.footer-email:hover { opacity: .55; }
.footer-social { display: flex; align-items: center; gap: 1rem; }
.footer-social a { color: var(--text); display: inline-flex; transition: opacity .2s var(--ease); }
.footer-social a:hover { opacity: .55; }
.footer-social svg { width: 18px; height: 18px; display: block; }

/* ── Responsive ── */
@media (max-width: 560px) {
  .ac-index { padding: calc(var(--nav-h) + 24px) 20px 70px; }
  .ac-index-head { display: none; }
  .ac-index-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name    see"
      "serv    serv"
      "client  year";
    gap: 2px 16px;
    padding: 18px 0;
  }
  .ac-index-row { font-size: .82rem; }                         /* texto um pouco mais pequeno */
  .ac-c-name   { grid-area: name; }
  .ac-c-serv   { grid-area: serv; opacity: .85; font-size: .74rem; }
  .ac-c-client { grid-area: client; opacity: .85; font-size: .74rem; }
  .ac-c-year   { grid-area: year; font-size: .72rem; text-align: right; }
  .ac-c-see    { grid-area: see; align-self: start; }
  .ac-expand-head { grid-template-columns: 1fr; row-gap: .8rem; }
  /* tag e redes na mesma linha: tag à esquerda, redes na margem direita */
  .ac-expand-namecol { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
  .ac-expand-links { margin-top: 0; }
  .ac-expand-scroll { height: clamp(180px, 34vh, 300px); }
}

/* touch (mobile): o título do projeto não desliza no "hover" */
@media (hover: none) {
  .ac-index-row:hover .ac-c-name, .ac-index-row.is-active .ac-c-name { transform: none; }
}

/* ============================================================
   Transição de tema (crossfade suave) — ativa só durante o toggle
   ============================================================ */
/* Troca de tema instantânea (sem lag): desliga transições durante o toggle */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}
/* ===== Transição de página — cortina com o wordmark grande, ao fundo ===== */
.page-transition {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);   /* segue o tema (b em light, c em dark) */
  display: flex; align-items: flex-end; justify-content: center;   /* logo grande, ao fundo */
  padding: 0 clamp(0.5rem, 1.4vw, 1.1rem);   /* margem pequena e igual dos dois lados (N não colado) */
  transform: translateY(0);   /* cobre; o JS revela */
}
/* primeira abertura do site (sem navegação interna) → cortina escondida (sem loading) */
html.no-loading .page-transition { transform: translateY(-100%); }
.pt-logo { width: 100%; height: auto; display: block; }   /* grande, largura toda */
.pt-logo-c { display: none; }
body.dark .pt-logo-b { display: none; }
body.dark .pt-logo-c { display: block; }
@media (prefers-reduced-motion: reduce) { .page-transition { display: none; } }

/* troca de tema com reveal circular a partir do botão (View Transitions API) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;            /* desliga o cross-fade default → só o clip-path circular */
  mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 1; }   /* novo tema por cima → o círculo revela-o */
::view-transition-old(root) { z-index: 0; }

/* ============================================================
   Header transparente — só relógio, toggle e a pílula do meio ficam visíveis.
   A pílula ganha fundo próprio + sombra para contrastar com o que passa por baixo.
   ============================================================ */
.p-chip,
.p-cat,
.projeto-cats .p-cat,
.btn-ghost,
.projeto-scrolltop {
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
}

/* ============================================================
   DEMO metaball (goo) — 2 botões do About
   ============================================================ */
.goo-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.goo-field {
  position: fixed; pointer-events: none; z-index: 5;
  filter: url(#goo-filter);
}
.goo-base { position: absolute; }
/* blob "ajudante": funde o botão para a bola. A opacidade é controlada por JS
   (0 longe, 1 quando a bola toca no botão) — a bola normal mantém-se sempre igual. */
.goo-blob {
  position: absolute; width: 40px; height: 40px;   /* maior → ponte do merge mais forte/longe */
  border-radius: 999px; transform: translate(-50%, -50%);
  opacity: 0;
}
/* os botões do demo ficam por cima do goo (texto/contorno nítidos) */
[data-goo] { position: relative; z-index: 10; }
/* sem "saltinho" no hover (o fundo é dado pelo goo, que não sobe com o botão) */
[data-goo]:hover { transform: none !important; }

/* ── Work With Me — formulário de contacto/briefing ── */
/* ============================================================
   WORK WITH ME — ecrã dividido a meio: informação à esquerda,
   formulário à direita (o painel está no bloco .page-wwm2, mais abaixo)
   ============================================================ */
.wwm { padding: var(--nav-h) 0 0; }
.wwm-split {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: calc(100svh - var(--nav-h));
  align-items: stretch;
}
.wwm-intro {
  display: flex; flex-direction: column; justify-content: center;
  gap: clamp(2.5rem, 6vh, 5rem); padding: clamp(3rem, 7vw, 6rem) clamp(2rem, 5vw, 4.5rem);
}
.wwm-title { font-family: var(--font-display); font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 500; line-height: 1; letter-spacing: -0.02em; max-width: 13ch; }
.wwm-sub { color: var(--muted); margin-top: 1rem; font-size: 1.05rem; }
.wwm-intro-contact { display: flex; flex-direction: column; gap: .9rem; }
.wwm-aside-label { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wwm-aside-email {
  font-size: 1.05rem; color: var(--text); word-break: break-word; text-decoration: none;
  position: relative; align-self: flex-start;          /* largura = só o texto (a linha não atravessa espaço vazio) */
}
/* sublinhado IGUAL ao de antes (o text-decoration nativo do tipo de letra), mas revelado
   da ESQUERDA para a DIREITA: uma cópia invisível do texto por cima, só com o sublinhado,
   destapada com clip-path (e ao sair recolhe no sentido inverso) */
.wwm-aside-email::after {
  content: attr(data-text);
  position: absolute; inset: 0 0 -.6em 0; pointer-events: none;   /* caixa mais alta p/ baixo → a linha não é cortada */
  color: transparent; text-decoration: underline; text-decoration-color: var(--text);
  text-underline-offset: 5px;                                      /* mais espaço entre o email e a linha */
  clip-path: inset(0 100% 0 0);
  transition: clip-path .4s cubic-bezier(.5, 0, .15, 1);
}
.wwm-aside-email:hover::after, .wwm-aside-email:focus-visible::after { clip-path: inset(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .wwm-aside-email::after { transition: none; } }
.wwm-aside-social { display: flex; gap: 18px; margin-top: .3rem; }
.wwm-aside-social a { color: var(--text); display: inline-flex; }   /* o ícone não muda no hover — aparece a etiqueta no cursor (como nos projetos) */
.wwm-aside-social svg { width: 22px; height: 22px; display: block; }
.wwm-honey { position: absolute; left: -9999px; }   /* campo anti-spam (honeypot) escondido */

@media (max-width: 860px) {
  .wwm-split { grid-template-columns: 1fr; min-height: 0; }
  .wwm-intro { justify-content: flex-start; gap: 2rem; padding: clamp(2rem, 8vw, 3rem) clamp(1.5rem, 6vw, 2.5rem); }
}

/* ── Bolas (experiência de física) ── */
body.page-bolas { overflow: hidden; }
.bolas-stage {
  position: fixed; inset: 0; overflow: hidden; z-index: 1;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.bola {
  position: absolute; top: 0; left: 0;
  will-change: transform; color: var(--text); cursor: grab;
}
.bola:active { cursor: grabbing; }
.bola svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.bolas-hint {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 2; color: var(--muted); font-size: .8rem; letter-spacing: .04em;
  pointer-events: none; text-transform: lowercase;
}

/* ── Cesto + contador (página Bolas) ── */
.bolas-hoop { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 3; overflow: visible; }
.hoop-board { fill: var(--text); opacity: .14; stroke: var(--text); stroke-opacity: .3; stroke-width: 2; }
.hoop-rim { fill: var(--text); }                        /* barra grossa cinza */
.hoop-net { fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; opacity: .5; }
.bolas-floor-line { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 9; opacity: .4; }   /* mesa de lançamento */
.bolas-hoop.scored .hoop-rim { animation: rimFlash .55s var(--ease); }
.bolas-hoop.scored .hoop-net { animation: netFlash .55s var(--ease); }
@keyframes rimFlash { 0%, 100% { fill: var(--text); } 35% { fill: #37c46a; } }
@keyframes netFlash { 0%, 100% { stroke: var(--text); } 35% { stroke: #37c46a; } }

.bolas-score {
  position: fixed; top: calc(var(--nav-h) + 18px); right: clamp(16px, 3vw, 34px);
  z-index: 5; text-align: right; pointer-events: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;   /* não selecionável */
}
.bolas-score-num {
  display: block; font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; color: var(--text);
}
.bolas-score-lbl { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.bolas-score.pop .bolas-score-num { animation: scorePop .35s var(--ease); }
@keyframes scorePop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }

/* bola que voa do cesto até ao score + explosão */
.score-ball { position: fixed; top: 0; left: 0; z-index: 7; pointer-events: none; color: var(--text); will-change: transform; }
.score-ball svg { width: 100%; height: 100%; display: block; }
.score-spark { position: fixed; top: 0; left: 0; width: 7px; height: 7px; border-radius: 50%; background: #37c46a; z-index: 7; pointer-events: none; }

/* linha de mira (fisga) da página Bolas */
.bolas-aim { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 4; opacity: 0; overflow: visible; }
.bolas-aim polyline { fill: none; stroke: var(--text); stroke-width: 3; stroke-dasharray: 2 10; stroke-linecap: round; }
.bola { cursor: pointer; }

/* lançamento falhado → contador treme e pisca vermelho, volta a 0 */
.bolas-score.miss .bolas-score-num { animation: scoreMiss .5s var(--ease); }
@keyframes scoreMiss {
  0% { transform: translateX(0); }
  15% { transform: translateX(-6px); color: #e5484d; }
  30% { transform: translateX(5px); color: #e5484d; }
  45% { transform: translateX(-4px); color: #e5484d; }
  60% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}
/* marco (5, 10, 20, 30, ...) → pulso forte + anel + faíscas douradas + cesto a dourado */
.bolas-score.milestone .bolas-score-num { animation: scoreMilestone .62s var(--ease); }
@keyframes scoreMilestone { 0% { transform: scale(1); } 30% { transform: scale(1.9); } 60% { transform: scale(.94); } 100% { transform: scale(1); } }
.score-ring { position: fixed; top: 0; left: 0; width: clamp(60px, 8vw, 96px); height: clamp(60px, 8vw, 96px); border-radius: 50%; border: 3px solid var(--text); z-index: 7; pointer-events: none; }
.score-spark.gold { width: 9px; height: 9px; background: #f5b301; }
.bolas-hoop.big .hoop-rim { animation: rimBig .62s var(--ease); }
.bolas-hoop.big .hoop-net { animation: netBig .62s var(--ease); }
@keyframes rimBig { 0%, 100% { fill: var(--text); } 35% { fill: #f5b301; } }
@keyframes netBig { 0%, 100% { stroke: var(--text); } 35% { stroke: #f5b301; } }
/* festa de marco no meio do ecrã */
.confetti { position: fixed; top: 0; left: 0; width: 10px; height: 14px; border-radius: 2px; z-index: 8; pointer-events: none; will-change: transform, opacity; }
.party-num {
  position: fixed; top: 50%; left: 50%; z-index: 8; pointer-events: none;
  font-family: var(--font-display); font-weight: 600; line-height: 1;
  font-size: clamp(90px, 22vw, 240px); color: var(--text);
}

/* wordmark NUPI STUDIO — mesmo marquee do about, por baixo da linha das bolas, mais lento */
.bolas-wordmark {
  position: fixed; left: 0; right: 0; bottom: clamp(6px, 3.5vh, 40px);
  overflow: hidden; z-index: 2; pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
}
.bolas-wordmark .wm-track { animation-duration: 34s; }   /* about = 18s → aqui mais lento */
.bolas-wordmark .wm-track img { display: block; height: clamp(40px, 5vw, 78px); width: auto; margin-right: 6vw; }
/* logo como imagem: cinza ESCURO no light (versão b) · cinza CLARO no dark (versão c) */
.bolas-wordmark .wm-track img.wm-c { display: none; }
body.dark .bolas-wordmark .wm-track img.wm-b { display: none; }
body.dark .bolas-wordmark .wm-track img.wm-c { display: block; }

/* ── Flipbook (brandbook no fim do projeto) ── */
.projeto-brandbook {
  margin: clamp(3.5rem, 9vw, 7rem) 0 0;   /* largura toda do projeto */
}
.pj-bb-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem); letter-spacing: -.02em;
  text-align: center; margin-bottom: clamp(2.8rem, 6vw, 4.5rem);   /* espaço título → livro */
}
.fb { position: relative; width: 100%; margin: 0 auto; }
.fb-stage { position: relative; width: 100%; }   /* livro à largura toda (como a galeria) */
.fb-book {
  position: relative; width: 100%; aspect-ratio: 32 / 9;   /* spread = 2 páginas 16:9 */
  perspective: 3000px; cursor: pointer;
  border-radius: 4px; overflow: hidden;                     /* cantos curvos como as imagens do projeto */
  transition: transform .9s cubic-bezier(.62, 0, .21, 1);   /* centra a capa/última */
}
/* metades (páginas estáticas) — sem fundo (nada de retângulo cinza) */
.fb-half { position: absolute; top: 0; height: 100%; width: 50%; overflow: hidden; }
.fb-left { left: 0; } .fb-right { left: 50%; }
.fb-half .fb-page { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.fb-empty .fb-page { display: none; }
.fb-empty::before, .fb-empty::after { display: none; }
/* pilha de páginas nas margens de fora */
.fb-left::before, .fb-right::after {
  content: ''; position: absolute; top: 2%; bottom: 2%; width: 7px; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(to right, rgba(0,0,0,.10) 0 1px, transparent 1px 3px);
}
.fb-left::before { left: 0; } .fb-right::after { right: 0; }
/* sombra da lombada (centro) — só com 2 páginas */
.fb-book::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 70px; transform: translateX(-50%);
  z-index: 4; pointer-events: none;
  background: linear-gradient(to right, transparent, rgba(0,0,0,.18) 46%, rgba(0,0,0,.18) 54%, transparent);
}
.fb-book.fb-single::after { display: none; }
/* folha que vira (frente + verso) */
.fb-leaf { position: absolute; top: 0; height: 100%; width: 50%; z-index: 5; transform-style: preserve-3d; }
.fb-leaf-fwd { left: 50%; transform-origin: left center; }
.fb-leaf-bwd { left: 0;   transform-origin: right center; }
.fb-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; }
.fb-face-front { transform: translateZ(0.6px); }        /* separa as faces → sem z-fighting/piscar */
.fb-face-back { transform: rotateY(180deg) translateZ(0.6px); }
.fb-face-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-face-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: #000; }
/* sombra projetada no spread durante a viragem */
.fb-cast { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 4; pointer-events: none; }
.fb-cast-l { left: 0;  background: linear-gradient(to left,  rgba(0,0,0,.32), transparent 78%); }
.fb-cast-r { right: 0; background: linear-gradient(to right, rgba(0,0,0,.32), transparent 78%); }
/* modo página única (mobile): 1 página à largura toda, sem lombada nem pilha lateral */
.fb-book.fb-single-mode .fb-left { width: 100%; }
.fb-book.fb-single-mode .fb-right { display: none; }
.fb-book.fb-single-mode::after { display: none; }
.fb-book.fb-single-mode .fb-left::before { display: none; }
.fb-leaf-single { width: 100%; left: 0; transform-origin: left center; }
/* transição por arrasto (modo página única) */
.fb-slide { position: absolute; inset: 0; z-index: 5; }
.fb-slide .fb-page { width: 100%; height: 100%; object-fit: cover; display: block; }
/* controlos (setas + contador). Overlay do livro → setas nas laterais (desktop largo) */
.fb-ctrls { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
/* setas iguais ao botão scroll-to-top do projeto (círculo 34px, seta cinza) */
.fb-nav {
  position: absolute; top: 50%; transform: translateY(-50%) translateZ(0);
  pointer-events: auto;
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background-color: transparent; color: var(--border); cursor: pointer;
  -webkit-appearance: none; appearance: none; outline: none; -webkit-tap-highlight-color: transparent;
  isolation: isolate; overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
}
body.dark .fb-nav { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }
.fb-nav svg { width: 14px; height: 14px; stroke: var(--muted); transition: stroke .2s var(--ease); }
/* 34px FORA das páginas (34px de folga + 34px da própria seta), na margem lateral */
.fb-prev { left: -68px; } .fb-next { right: -68px; }
.fb-nav:hover { background-color: var(--text); color: var(--bg); border-color: var(--text); }
.fb-nav:hover svg { stroke: var(--bg); }
.fb-nav:disabled { opacity: .25; pointer-events: none; }
.fb-count { text-align: center; margin-top: 52px; font-size: .78rem; letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; }
/* sem margem lateral p/ 34px fora → setas passam para BAIXO do livro; números por baixo das setas */
@media (max-width: 1500px) {
  .fb-ctrls {
    position: static; pointer-events: auto;
    display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 26px;
  }
  .fb-nav { position: static; transform: translateZ(0); }
  .fb-count { margin-top: 25px; }
}
@media (max-width: 560px) {
  .fb-nav { width: 30px; height: 30px; }
}

/* ============================================================
   WORK WITH ME! 2 (body.page-wwm2) — ecrã a meio: informação à esquerda,
   formulário TODO À VISTA num painel arredondado à direita (2 colunas);
   perguntas de escolha em dropdown. (body.page-wwm2 em work-with-me.html)
   ============================================================ */
.page-wwm2 {
  --panel-bg: #bdbdbc;                       /* um pouco mais claro que o fundo */
  --dd-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 18px 40px -12px rgba(0, 0, 0, .30);
}
body.dark.page-wwm2 {
  --panel-bg: #262625;
  --dd-shadow: 0 1px 2px rgba(0, 0, 0, .40), 0 18px 40px -12px rgba(0, 0, 0, .65);
}
.page-wwm2 .wwm-split { align-items: stretch; }
/* painel da direita (sem divisória) */
.page-wwm2 .wwm2-panel {
  margin: clamp(1rem, 2.2vw, 1.8rem) clamp(1rem, 2.2vw, 1.8rem) clamp(1rem, 2.2vw, 1.8rem) 0;
  background: var(--panel-bg); border-radius: clamp(22px, 2.4vw, 34px);
  padding: clamp(1.6rem, 3.6vw, 3rem) clamp(1.6rem, 4vw, 3.4rem);
  display: flex; flex-direction: column; justify-content: center;
}
.page-wwm2 .wwm2-form { display: flex; flex-direction: column; gap: clamp(1.6rem, 3.4vh, 2.4rem); }
.page-wwm2 .wwm2-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(1.6rem, 4vh, 2.6rem) clamp(1.6rem, 4vw, 3.4rem);
  align-items: end;                           /* as linhas de baixo alinham mesmo com perguntas de 2 linhas */
}
.page-wwm2 .wwm2-field { display: flex; flex-direction: column; gap: .7rem; min-width: 0; position: relative; }
.page-wwm2 .wwm2-field.is-wide { grid-column: 1 / -1; }
.page-wwm2 .wwm2-label {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem); line-height: 1.15; letter-spacing: -0.01em; color: var(--text);
}
.page-wwm2 .wwm2-input {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--border); border-radius: 0;
  padding: .55rem 0; transition: border-color .2s var(--ease);
}
.page-wwm2 .wwm2-input:focus { outline: none; border-color: var(--text); }
.page-wwm2 .wwm2-input::placeholder { color: var(--muted); opacity: .75; }
.page-wwm2 .wwm2-textarea { resize: vertical; min-height: 2.8rem; line-height: 1.5; }
.page-wwm2 .wwm2-err { position: absolute; top: calc(100% + .25rem); left: 0; margin: 0; font-size: .8rem; color: #d9534f; }   /* não ocupa espaço */
.page-wwm2 .wwm2-field.invalid .wwm2-input,
.page-wwm2 .wwm2-field.invalid .wwm2-dd-btn { border-color: #d9534f; }

/* dropdown (mesma linha de baixo que os campos de texto) */
.page-wwm2 .wwm2-dd { position: relative; }
.page-wwm2 .wwm2-dd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: transparent; border: 0; border-bottom: 1.5px solid var(--border); border-radius: 0;
  padding: .55rem 0; font: inherit; font-size: 1.05rem; color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .2s var(--ease);
}
.page-wwm2 .wwm2-dd.is-open .wwm2-dd-btn, .page-wwm2 .wwm2-dd-btn:focus-visible { outline: none; border-color: var(--text); }
.page-wwm2 .wwm2-dd-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-wwm2 .wwm2-dd-val.is-ph { color: var(--muted); }
.page-wwm2 .wwm2-chev { width: 18px; height: 18px; flex: none; transition: transform .25s var(--ease); }
.page-wwm2 .wwm2-dd.is-open .wwm2-chev { transform: rotate(180deg); }
.page-wwm2 .wwm2-dd-list {
  position: absolute; z-index: 20; left: 0; top: calc(100% + 8px);
  width: max(100%, 360px); max-width: calc(100vw - 2rem);
  max-height: 300px; overflow-y: auto; overflow-x: hidden; padding: 6px;
  overscroll-behavior: contain;               /* no fim da lista não passa o scroll para a página */
  background: var(--bg); border-radius: 14px; box-shadow: var(--dd-shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.page-wwm2 .wwm2-dd.is-open .wwm2-dd-list { opacity: 1; visibility: visible; transform: none; }
/* campos da coluna da direita: a lista abre para a esquerda (não sai do painel) */
.page-wwm2 .wwm2-grid > .wwm2-field:nth-child(even) .wwm2-dd-list { left: auto; right: 0; }
.page-wwm2 .wwm2-dd-opt {
  display: flex; align-items: center; gap: .7rem; cursor: pointer;
  padding: .6rem .7rem; border-radius: 9px; font-size: .92rem; line-height: 1.25; color: var(--text);
}
.page-wwm2 .wwm2-dd-opt:hover { background: var(--panel-bg); }
.page-wwm2 .wwm2-dd-opt input { position: absolute; opacity: 0; pointer-events: none; }
.page-wwm2 .wwm2-dd-tick {
  width: 16px; height: 16px; flex: none; border: 1.5px solid var(--muted); border-radius: 4px;   /* quadrado em todos (escolha única e múltipla) */
  display: grid; place-items: center; transition: background .15s var(--ease), border-color .15s var(--ease);
}
.page-wwm2 .wwm2-dd-opt input:checked + .wwm2-dd-tick { background: var(--text); border-color: var(--text); }
.page-wwm2 .wwm2-dd-opt input:checked + .wwm2-dd-tick::after {
  content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--bg);
}
.page-wwm2 .wwm2-dd-opt input:focus-visible + .wwm2-dd-tick { outline: 2px solid var(--text); outline-offset: 2px; }

.page-wwm2 .wwm2-send {
  align-self: flex-start;
  /* a posição vertical é calculada no EDITAR-WORK-WITH-ME.js: centrado entre a linha
     do Project brief e o fundo do painel (margin-top compensada em baixo → as perguntas não mexem) */
}
/* depois de enviar: a frase de confirmação no lugar do botão Send */
.page-wwm2 .wwm2-sent {
  align-self: flex-start; margin: 0;
  font-size: 1.05rem; line-height: 1.4; color: var(--text);
  animation: wwm2SentIn .5s cubic-bezier(.22, 1, .36, 1);
}
@keyframes wwm2SentIn { from { opacity: 0; } to { opacity: 1; } }   /* só fade (sem deslocar → a posição centrada fica certa) */
@media (prefers-reduced-motion: reduce) { .page-wwm2 .wwm2-sent { animation: none; } }

@media (max-width: 860px) {
  .page-wwm2 .wwm2-panel { margin: 0 clamp(1rem, 4vw, 1.5rem) clamp(1.5rem, 6vw, 2.5rem); }
  .page-wwm2 .wwm2-grid { grid-template-columns: 1fr; }
}

/* ── Projeto: imagem ampliada ao clicar (quase ecrã inteiro) ── */
#projeto-imgs img { cursor: zoom-in; }
#projeto-imgs img:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.pj-lightbox {
  position: fixed; inset: 0; z-index: 200;               /* acima do menu (100) */
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 4vw; cursor: zoom-out;
  background: rgba(175, 175, 174, .9);                   /* fundo da página (light) */
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s;
}
body.dark .pj-lightbox { background: rgba(28, 28, 28, .92); }
.pj-lightbox.is-open { opacity: 1; visibility: visible; }
.pj-lightbox-img {
  max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain;
  border-radius: 4px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45);
  transform: scale(.96); transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.pj-lightbox.is-open .pj-lightbox-img { transform: none; }
.pj-lightbox-img { transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .2s var(--ease); }
.pj-lightbox-img.is-swapping { opacity: 0; }                 /* troca de imagem suave */
/* setas anterior / seguinte — IGUAIS ao botão voltar-ao-topo: círculo 34px com contorno e sombra,
   seta cinza; no hover a cor sobe em cúpula e a seta sai e reentra no sentido para onde aponta
   (comandado por .is-in / .is-out — handler partilhado em main.js; keyframes stf-fill-* partilhados) */
.pj-lightbox-nav {
  --stf-x: 28px;                                              /* seguinte: sai pela direita */
  position: absolute; top: 50%; translate: 0 -50%;
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: none; color: var(--border); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .12);
  overflow: hidden; isolation: isolate;
  transition: color .15s linear .2s, border-color .2s var(--ease);
}
.pj-lightbox-prev { --stf-x: -28px; left: clamp(12px, 2vw, 28px); }   /* anterior: sai pela esquerda */
.pj-lightbox-next { right: clamp(12px, 2vw, 28px); }
body.dark .pj-lightbox-nav { box-shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); }
.pj-lightbox-nav svg { width: 14px; height: 14px; display: block; stroke: var(--muted); transition: stroke .15s linear .2s; }
/* cor entra NA DIREÇÃO DA SETA, em cúpula deitada: seguinte → da esquerda para a direita;
   anterior → da direita para a esquerda (--d = 1 / -1) */
.pj-lightbox-nav::before {
  content: ""; position: absolute; z-index: -1;
  top: -20%; width: 140%; height: 140%;
  background: var(--text); transform: translateX(calc(-80% * var(--d)));
}
.pj-lightbox-next { --d: 1; }
.pj-lightbox-prev { --d: -1; }
.pj-lightbox-next::before { right: 0; border-radius: 0 35% 35% 0 / 0 50% 50% 0; }   /* frente arredondada à direita */
.pj-lightbox-prev::before { left: 0;  border-radius: 35% 0 0 35% / 50% 0 0 50%; }   /* frente arredondada à esquerda */
.pj-lightbox-nav.is-in { color: var(--bg); border-color: var(--text); transition: color .12s linear .38s, border-color .2s var(--ease) .3s; }
.pj-lightbox-nav.is-in svg { stroke: var(--bg); transition: stroke .12s linear .38s; }
.pj-lightbox-nav.is-in::before { animation: lbn-fill-in .8s forwards; }
.pj-lightbox-nav.is-out::before { animation: lbn-fill-out .8s forwards; }
@keyframes lbn-fill-in {
  0%, 42% { transform: translateX(calc(-80% * var(--d))); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { transform: translateX(calc(25% * var(--d))); }
}
@keyframes lbn-fill-out {   /* ao sair, recua pelo mesmo caminho (como a seta) */
  0%       { transform: translateX(calc(25% * var(--d))); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%, 100%{ transform: translateX(calc(-80% * var(--d))); }
}
.pj-lightbox-nav.is-in svg { animation: stf-x-in .8s forwards; }
.pj-lightbox-nav.is-out svg { animation: stf-x-out .8s forwards; }
@keyframes stf-x-in {
  0%      { transform: translateX(0); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { transform: translateX(var(--stf-x)); }                              /* sai no sentido da seta */
  42.01%  { transform: translateX(calc(-1 * var(--stf-x))); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }   /* reentra do outro lado */
  100%    { transform: translateX(0); }
}
@keyframes stf-x-out {
  0%      { transform: translateX(0); animation-timing-function: cubic-bezier(.55, 0, .9, .6); }
  42%     { transform: translateX(calc(-1 * var(--stf-x))); }
  42.01%  { transform: translateX(var(--stf-x)); animation-timing-function: cubic-bezier(.1, .5, .3, 1); }
  100%    { transform: translateX(0); }
}
.pj-lightbox.is-single .pj-lightbox-nav { display: none; }
/* sem "anterior" na 1ª imagem e sem "seguinte" na última (desaparecem com fade) */
.pj-lightbox-nav { transition: color .15s linear .2s, border-color .2s var(--ease), opacity .25s var(--ease), visibility .25s; }
.pj-lightbox.is-first .pj-lightbox-prev,
.pj-lightbox.is-last .pj-lightbox-next { opacity: 0; visibility: hidden; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .pj-lightbox-nav.is-in svg, .pj-lightbox-nav.is-out svg,
  .pj-lightbox-nav.is-in::before, .pj-lightbox-nav.is-out::before { animation: none; }
  .pj-lightbox-nav.is-in::before { transform: translateX(calc(25% * var(--d))); }
}
.pj-lightbox-close {
  position: absolute; top: 18px; right: 22px; display: inline-flex; padding: 6px;
  background: transparent; border: 0; color: var(--text); cursor: pointer; opacity: .75;
  transition: opacity .2s var(--ease);
}
.pj-lightbox-close:hover, .pj-lightbox-close:focus-visible { opacity: 1; }
.pj-lightbox-close svg { width: 26px; height: 26px; display: block; }
html.pj-lb-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .pj-lightbox, .pj-lightbox-img { transition: none; } }
