:root {
  --pad: clamp(20px, 2.8vw, 56px);
  --ease: cubic-bezier(.76, 0, .24, 1);
  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --brand: #77341a;
  --cream: #ece4e2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--brand); /* fundo do loading = terracota dos contactos */
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

/* depois do loading, o fundo passa a escuro: qualquer zona fora da imagem
   (barras do browser, ecrãs mais altos que o viewport) fica escura e não terracota */
html:has(body.ready), body.ready { background: #1a1410; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  left: var(--pad);
  bottom: var(--pad);
  z-index: 5;
  color: var(--cream);
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 300;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: opacity .5s ease;
}
.loader.done { opacity: 0; }

/* ---------- Palco ---------- */
.stage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  /* altura "grande" do ecrã: no telemóvel cobre também a zona por trás das barras do browser */
  height: 100vh;
  height: 100lvh;
  min-height: 100%;
  z-index: 1;
  overflow: hidden;
  background: #1a1410;
  /* altura 0, alinhado ao centro do ecrã */
  clip-path: inset(50% 0 50% 0);
  transition: clip-path 1.6s var(--ease);
}
.stage.open { clip-path: inset(0 0 0 0); }

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  will-change: transform;
}
.slide.active, .slide.entering { visibility: visible; }
.slide.active { z-index: 1; }
.slide.entering { z-index: 2; }

.slide-inner { position: absolute; inset: 0; will-change: transform; }
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  will-change: transform;
}

/* sombras para leitura do texto */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.38), rgba(0,0,0,0) 22%),
    linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,0) 48%);
}

/* ---------- Interface ---------- */
.ui {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
.ui.show { opacity: 1; }
.ui.show > * { pointer-events: auto; }

.top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: var(--pad);
  padding-top: max(var(--pad), env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.logo { display: block; }
.logo img { display: block; width: clamp(130px, 14vw, 230px); height: auto; }
/* ícone da marca, ao centro */
.icon {
  position: absolute;
  left: 50%;
  top: var(--pad);
  top: max(var(--pad), env(safe-area-inset-top));
  transform: translateX(-50%);
  height: clamp(36px, 3.2vw, 52px);
  width: auto;
}

.pill {
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(236,228,226,.35);
  background: rgba(30,22,16,.35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.pill:hover { background: var(--cream); color: #1a1410; border-color: var(--cream); }

/* barras de navegação na lateral direita */
.ticks {
  position: absolute;
  right: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* sombra suave para se lerem sobre zonas claras da imagem */
  filter: drop-shadow(0 0 5px rgba(0,0,0,.55));
}
.tick {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  height: 34px;
  padding-left: 24px;
}
.tick-line {
  display: block;
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: .65;
  transition: width .45s var(--ease), opacity .3s ease;
}
.tick-label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .3s ease, transform .45s var(--ease);
  pointer-events: none;
}
.tick.on .tick-line { width: 38px; opacity: 1; }
.tick:hover .tick-line, .tick:focus-visible .tick-line { width: 38px; opacity: 1; }
.tick:hover .tick-label, .tick:focus-visible .tick-label { opacity: 1; transform: none; }
.tick:focus-visible { outline: 1px solid var(--cream); outline-offset: 2px; }
.arrow {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(236,228,226,.35);
  background: rgba(30,22,16,.35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.arrow:hover { background: var(--cream); color: #1a1410; border-color: var(--cream); }
.arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.pill:focus-visible, .arrow:focus-visible, .logo:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }

.caption {
  position: absolute;
  left: var(--pad);
  bottom: var(--pad);
  bottom: max(var(--pad), env(safe-area-inset-bottom));
  max-width: min(640px, calc(100% - var(--pad) * 2 - 64px));
  transition: opacity .45s ease, transform .45s ease;
}
.caption.hide { opacity: 0; transform: translateY(10px); }

.count {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  opacity: .9;
  margin-bottom: clamp(10px, 1.2vw, 18px);
}
.count-sep { margin: 0 .35em; opacity: .6; }

.title {
  font-size: clamp(40px, 6.4vw, 112px);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: .95;
  text-wrap: balance;
}
.text {
  margin-top: clamp(14px, 1.4vw, 22px);
  max-width: 44ch;
  font-size: clamp(14px, 1.05vw, 17px);
  font-weight: 400;
  line-height: 1.5;
  opacity: .88;
  text-wrap: pretty;
}

/* ---------- Contactos ---------- */
.contact {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: var(--brand);
  display: grid;
  align-items: end;
  padding: var(--pad);
  opacity: 0;
  transition: opacity .5s ease;
}
.contact[hidden] { display: none; }
.contact.show { opacity: 1; }
.contact-close { background: transparent; }
/* os valores nunca passam para a esquerda do "o" de Francisco */
.contact-list li > :last-child { text-align: right; max-width: 58%; text-wrap: balance; }
/* a lista estica até ao fim do nome */
.contact-inner { width: fit-content; max-width: 100%; }
.contact-list { list-style: none; margin-top: clamp(24px, 3vw, 48px); width: 0; min-width: 100%; }
.contact-list li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid rgba(236,228,226,.25);
  font-size: 16px;
}
.contact-list li > span:first-child { opacity: .7; }
.nowrap { white-space: nowrap; }
.contact-list a:hover { text-decoration: underline; }

/* botão expandir: canto inferior direito, alinhado por baixo com o texto */
.expand {
  position: absolute;
  right: var(--pad);
  bottom: var(--pad);
  bottom: max(var(--pad), env(safe-area-inset-bottom));
}

/* ---------- Galeria (lightbox) ---------- */
.lightbox {
  --lb-gap: calc(var(--pad) + 44px + 24px);
  position: fixed;
  inset: 0;
  z-index: 7;
  background: var(--cream);
  color: #1a1410;
  opacity: 0;
  transition: opacity .45s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.show { opacity: 1; }
.lb-figure {
  position: absolute;
  inset: var(--lb-gap);
  display: grid;
  place-items: center;
}
.lb-figure img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  position: absolute;
  inset: 0;
  margin: auto;
  object-fit: contain;
  transition: opacity .25s ease;
}
.lb-figure img.swap { opacity: 0; }
.lightbox .pill, .lightbox .arrow {
  border-color: rgba(26,20,16,.3);
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.lightbox .pill:hover, .lightbox .arrow:hover { background: #1a1410; color: var(--cream); border-color: #1a1410; }
.lightbox .pill:focus-visible, .lightbox .arrow:focus-visible { outline-color: #1a1410; }
.lb-close { position: absolute; top: var(--pad); right: var(--pad); }
.lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: var(--pad); }
.lb-next { right: var(--pad); }
.lb-caption {
  position: absolute;
  left: 0; right: 0;
  bottom: var(--pad);
  text-align: center;
  font-size: 14px;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  pointer-events: none; /* não tapar as setas no telemóvel */
}
.lb-arrow, .lb-close { z-index: 2; }
.lb-caption span + span { margin-left: 1.2em; opacity: .7; }

/* ---------- Tablet e abaixo: só o ícone, à esquerda ---------- */
@media (max-width: 1024px) {
  .logo { display: none; }
  .top { justify-content: flex-end; }
  .icon { left: var(--pad); transform: none; height: 44px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .pill { height: 40px; padding: 0 18px; }
  .arrow { width: 42px; height: 42px; }
  .tick { height: 28px; }
  .contact-list li { font-size: 15px; }
  /* no telemóvel o bloco vai de margem a margem (alinha com o botão Fechar) */
  .contact-inner { width: 100%; }
  .icon { height: 40px; }
  /* galeria: imagem a toda a largura, setas em baixo */
  .lb-figure { inset: calc(var(--pad) + 60px) var(--pad); }
  .lb-arrow { top: auto; bottom: var(--pad); transform: none; width: 52px; height: 52px; }
  .lb-caption { bottom: calc(var(--pad) + 17px); padding: 0 calc(var(--pad) + 60px); }
  .text { max-width: 34ch; }
}

@media (prefers-reduced-motion: reduce) {
  .stage { transition-duration: .01s; }
}
