/* ---------- Tokens ---------- */
:root {
  --bg: #0e0e0f;
  --surface: #18181a;
  --line: #2a2a2d;
  --text: #f2efe9;
  --muted: #a09c94;
  --accent: #d9b77e;
  --accent-ink: #1a1408;
  --pad: 16px;
  --radius: 4px;
  color-scheme: dark;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (min-width: 700px)  { :root { --pad: 28px; } }
@media (min-width: 1100px) { :root { --pad: 40px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex; flex-direction: column; /* o rodapé fica no pé da tela mesmo com poucas fotos */
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--serif); font-weight: 500; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius);
}
.skip:focus { left: 8px; }

.eyebrow {
  margin: 0 0 8px;
  font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px;
  border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500; font-size: .9375rem;
  transition: border-color .2s, background .2s, color .2s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
/* Mesma logo do site principal (portal/site.css) */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400 800; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin.woff2) format("woff2"); }
.logo { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font: 800 1.3rem/1.2 "Plus Jakarta Sans", Arial, sans-serif; letter-spacing: -.01em; white-space: nowrap; }
.logo .flor { width: 32px; height: 32px; flex: none; }
.logo small { padding-left: 10px; border-left: 1px solid var(--line); font: 500 .6875rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 560px) { .logo { font-size: 1.1rem; gap: 6px; } .logo .flor { width: 28px; height: 28px; } .logo small { padding-left: 8px; letter-spacing: .12em; } }
@media (max-width: 350px) { .logo small { display: none; } }
.nav { display: flex; align-items: center; gap: 4px; font-size: .9375rem; }
.nav a { padding: 10px 12px; border-radius: 999px; color: var(--muted); transition: color .2s; }
.nav a:hover { color: var(--text); }

/* Área de toque de 44 px em telas de toque, sem mudar o tamanho visível */
@media (pointer: coarse) {
  .chip, .btn-sm, .lb-link, .nav a { position: relative; }
  .chip::after, .btn-sm::after, .lb-link::after, .nav a::after {
    content: ""; position: absolute; left: -2px; right: -2px;
    top: 50%; height: 44px; transform: translateY(-50%);
  }
}

/* ---------- Filtros ---------- */
/* Fixos logo abaixo do topo ao rolar (--topbar-h é medido no JS) */
.filtros {
  position: sticky; top: var(--topbar-h, 60px); z-index: 15;
  display: flex; align-items: center; gap: 16px;
  padding: 12px var(--pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.filters { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--muted);
  font: 500 .8125rem var(--sans); cursor: pointer;
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .count { margin-left: 6px; font-size: .75rem; opacity: .8; font-variant-numeric: tabular-nums; }

/* ---------- Galeria em linhas justificadas ----------
   Cada foto mantém a proporção real (--r = largura/altura): verticais em pé,
   panorâmicas deitadas. As fotos de cada linha crescem juntas até preencher
   a largura toda, então não sobram buracos. */
.mosaic {
  --row: 110px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px; /* de ponta a ponta; as margens (--pad) valem para o topo, os filtros e o rodapé */
}
@media (min-width: 600px)  { .mosaic { --row: 150px; } }
@media (min-width: 900px)  { .mosaic { --row: 180px; } }
@media (min-width: 1300px) { .mosaic { --row: 210px; } }
/* "Mola" invisível no fim: a última linha fica no tamanho natural em vez de
   esticar (esticar cortaria as fotos em cima e embaixo). */
.mosaic::after { content: ""; flex: 1000000 1 0; }

.tile {
  flex: calc(var(--r, 1.5) * 1000) 1 calc(var(--r, 1.5) * var(--row));
  aspect-ratio: var(--r, 1.5);
  position: relative; overflow: hidden;
  padding: 0; border: 0; border-radius: 0;
  background: var(--surface); color: #fff;
  cursor: zoom-in; text-align: left;
}

/* Fotos abaixo da primeira tela surgem suavemente ao entrar na tela */
.tile.reveal { opacity: 0; transform: translateY(18px); }
.tile.reveal.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }

/* Esqueleto enquanto a primeira visita carrega a lista de fotos */
.tile.skeleton {
  cursor: default;
  background: linear-gradient(100deg, var(--surface) 30%, #232326 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

.tile img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.03);
  transition: opacity .6s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.tile img.loaded { opacity: 1; transform: none; }
.tile:hover img.loaded, .tile:focus-visible img.loaded { transform: scale(1.05); }

.tile-info {
  position: absolute; inset: auto 0 0 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 32px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.tile:hover .tile-info, .tile:focus-visible .tile-info { opacity: 1; transform: none; }
.tile-info strong { font: 500 1rem/1.2 var(--serif); }
.tile-info small { font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
@media (hover: none) { .tile-info { display: none; } }

.empty { padding: 48px var(--pad); color: var(--muted); text-align: center; }

/* ---------- Rodapé ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line);  }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: .875rem; }

.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 24px var(--pad) calc(24px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: .8125rem;
}
.footer-bottom a:hover { color: var(--text); }
.about { flex-basis: 100%; margin: 0 0 4px; font: italic 500 1.0625rem var(--serif); color: var(--text); }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  background: #08080a; color: #fff;
}
/* Fundo: a própria foto, bem desfocada e escurecida */
.lb-bg {
  position: absolute; inset: -60px; z-index: 0;
  background: center / cover no-repeat var(--lb-img, none);
  filter: blur(40px) saturate(1.2) brightness(.35);
}
.lightbox figure { position: relative; z-index: 1; transition: transform .25s ease, opacity .25s ease; }
.lightbox figure.swiping { transition: none; }
.lightbox[open] { display: grid; place-items: center; animation: fade .25s ease; }
.lightbox::backdrop { background: #000; }
@keyframes fade { from { opacity: 0; } }

.lightbox figure {
  margin: 0; max-width: 100vw;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 64px 16px 20px;
}
.lightbox img { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 2px; }
/* O quadro já abre no tamanho final; a versão grande entra por cima com fade */
.lb-frame { position: relative; }
.lb-frame #lb-img { display: block; }
#lb-full {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
  opacity: 0; transition: opacity .35s ease;
}
#lb-full.on { opacity: 1; }
.lightbox figcaption {
  display: flex; justify-content: space-between; gap: 24px; width: 100%;
  font-size: .875rem; color: rgba(255, 255, 255, .7);
}
#lb-title { font: 500 1.125rem var(--serif); color: #fff; }
#lb-title small {
  margin-left: 10px; font: 500 .6875rem var(--sans); letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent);
}
#lb-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
#lb-title small { margin-left: 0; }
.lb-nome { overflow-wrap: anywhere; }
.lb-autor { padding: 4px 0; border: 0; background: none; color: rgba(255, 255, 255, .75); font: 400 .875rem var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lb-autor:hover { color: #fff; }
.lightbox figcaption { align-items: center; flex-wrap: wrap; row-gap: 8px; width: 0; min-width: 100%; } /* largura da foto, não do texto */
.lightbox figure { min-width: min(460px, 100vw); }
#lb-desc {
  order: 1; flex: 1 0 100%; margin: 0; padding-right: max(0px, 100% - 75ch); max-height: 2.9em; overflow: hidden;
  font: 400 .9375rem/1.45 var(--sans); color: rgba(255, 255, 255, .88); white-space: pre-line; overflow-wrap: anywhere;
}
#lb-desc.longa { cursor: pointer; }
#lb-desc.longa:not(.aberta) { -webkit-mask: linear-gradient(#000 55%, transparent); mask: linear-gradient(#000 55%, transparent); }
#lb-desc.aberta { max-height: 34dvh; overflow-y: auto; overscroll-behavior: contain; }
#lb-title { flex: 1; min-width: 0; }
.lb-link {
  flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px;
  font-size: .8125rem; font-weight: 500; color: #fff; white-space: nowrap;
  transition: border-color .2s, color .2s;
}
.lb-link:hover { border-color: var(--accent); color: var(--accent); }

.lb-btn {
  position: fixed; z-index: 2;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: background .2s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-close { top: 12px; right: 12px; font-size: 1.125rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
@media (max-width: 700px) {
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .lightbox figure { padding-bottom: 76px; }
  .lightbox img { max-height: calc(100dvh - 230px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
