/* Layout: mural de fotos de ponta a ponta; barra fixa com o macaquinho (início), busca e grupos. Texto só no visualizador. */
:root {
  --bg: #11150f;
  --surface: #1a2016;
  --line: #2c3526;
  --fg: #e6e9dc;
  --muted: #98a189;
  --accent: #e3a93b;       /* dourado do mico-leão */
  --accent-ink: #1a1405;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gap: 10px;
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --gap: 6px; } }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-body); }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 1800px; margin: 0 auto;
  padding-left: max(var(--gap), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gap), env(safe-area-inset-right, 0px));
}

/* Barra */
.bar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar .row { display: flex; gap: 14px; align-items: center; padding-block: 10px 8px; }
.logo { flex: none; display: block; width: 38px; height: 38px; border-radius: 50%; }
.logo svg { width: 100%; height: 100%; display: block; transition: transform .3s ease; }
@media (hover: hover) { .logo:hover svg { transform: rotate(-12deg) scale(1.06); } }
/* a busca fica recolhida numa lupa; abre ao tocar */
.search { position: relative; flex: 0 0 auto; margin-left: auto; margin-right: -8px; }
.search.open { margin-right: 0; }
.search input { display: none; }
.search.open { flex: 1 1 auto; min-width: 0; max-width: 420px; }
.search.open input { display: block; }
.search.open .lupa { display: none; }
.search input {
  width: 100%; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit;
}
.search input::placeholder { color: var(--muted); }
.tools { display: flex; gap: 6px; flex: none; }
.tool {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.tool:hover { border-color: var(--muted); }
.tool svg, .close svg { width: 20px; height: 20px; }
/* botão de som: ondas quando tocando, um x quando mudo; pulsa enquanto o arquivo baixa */
.som .ondas { display: none; } .som[aria-pressed="true"] .ondas { display: inline; }
.som[aria-pressed="true"] .mudo { display: none; }
.tool.som[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.som.carregando { animation: pulse 1s ease-in-out infinite; }
.suggest {
  position: absolute; left: 0; right: 0; top: 44px; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; z-index: 40;
  max-height: 60vh; overflow-y: auto; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.suggest button {
  width: 100%; text-align: left; border: 0; background: none; color: var(--fg); font: inherit;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; display: grid;
}
.suggest button:hover, .suggest button:focus-visible { background: var(--line); outline: none; }
.suggest small { color: var(--muted); font-style: italic; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-block: 0 10px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--fg);
  font: 14px var(--f-body); padding: 5px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Mural */
main { padding-block: 2px 40px; }
.grid { display: flex; gap: var(--gap); align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.card {
  margin: 0; cursor: zoom-in; position: relative; overflow: hidden;
  border-radius: 6px; background: var(--surface);
}
.card img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s, transform .4s ease; }
.card img.ok { opacity: 1; }
@media (hover: hover) { .card:hover img { transform: scale(1.03); } }

.status { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }
.status button {
  margin-top: 10px; font: inherit; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.skel { background: var(--surface); border-radius: 6px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
/* loader do fim da página: três pontinhos dourados */
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: hop 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-6px); opacity: 1; } }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 16px 30px; }
/* título só para leitores de tela e buscadores; a tela continua sem texto */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* sem JavaScript: as fotos embutidas aparecem como lista simples */
.nojs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.nojs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.nojs small { color: var(--muted); font-size: 12px; }
/* página Sobre */
.prose { max-width: 640px; padding-block: 24px 40px; font-size: 16px; line-height: 1.6; }
.prose h1 { font-size: 26px; margin: 0 0 12px; }
.prose h2 { font-size: 18px; margin: 28px 0 6px; }
.prose p, .prose ul { margin: 0 0 10px; color: var(--fg); }
.prose a { color: var(--accent); }
.prose .groups { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
footer a { text-decoration-color: var(--line); }

/* Visualizador: sempre escuro, nos dois temas, para a foto aparecer melhor */
dialog#viewer {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  --fg: #e6e9dc; --muted: #98a189; --line: #3a4532; --accent: #e3a93b;
  background: #0b0d0a; color: var(--fg); color-scheme: dark;
}
dialog#viewer::backdrop { background: transparent; }
.vw {
  height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px;
  padding: max(56px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.stage { min-height: 0; position: relative; touch-action: pan-y; }
/* posição absoluta: a foto se encaixa na área disponível, qualquer que seja o tamanho original */
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.thumbs:empty { display: none; }
.thumbs button { border: 2px solid transparent; padding: 0; background: none; border-radius: 4px; cursor: pointer; }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 46px; height: 46px; object-fit: cover; border-radius: 2px; }
.cap { text-align: center; display: grid; gap: 2px; min-width: 0; }
.cap .sp {
  font: 600 17px var(--f-body); color: var(--fg); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.cap .sp:hover { text-decoration-color: currentColor; }
.cap .sp:disabled { cursor: default; text-decoration: none; }
.cap .sci { font-style: italic; color: var(--muted); font-size: 14px; }
.cap .cred { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cap .cred a { text-decoration-color: var(--line); }
.nav, .close {
  position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.45); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
/* presas ao centro da tela, e não da área da foto: a altura da legenda e das miniaturas muda de foto para foto */
.nav { position: fixed; top: 50%; transform: translateY(-50%); }
.nav:disabled { opacity: 0; pointer-events: none; }
.prev { left: max(8px, env(safe-area-inset-left, 0px)); } .next { right: max(8px, env(safe-area-inset-right, 0px)); }
.close {
  top: max(8px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 5; font-size: 18px;
}
.close.share { right: max(64px, calc(env(safe-area-inset-right, 0px) + 52px)); display: grid; place-items: center; }
.close.full { right: max(116px, calc(env(safe-area-inset-right, 0px) + 104px)); display: grid; place-items: center; }
.close[hidden] { display: none; }
[data-full] .sair { display: none; } [data-full][aria-pressed="true"] .sair { display: inline; }
[data-full][aria-pressed="true"] .abrir { display: none; }
.toast {
  position: absolute; left: 50%; bottom: max(90px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 999px; font-size: 14px; z-index: 6;
}
@media (hover: none) { .nav { display: none; } }

/* Modo relaxar: uma foto por vez, trocando devagar com esmaecimento e um zoom bem lento */
dialog#relax {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  background: #000; color: #e6e9dc; overflow: hidden; color-scheme: dark;
}
dialog#relax::backdrop { background: #000; }
dialog#relax:not(.ui) { cursor: none; }
.rx { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 2s ease; }
.rx.on { opacity: 1; }   /* o movimento (zoom e deslize) é sorteado no app.js, foto a foto */
.rx-cap {
  position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom, 0px)); padding: 0 16px;
  text-align: center; font-size: 12px; color: rgba(230, 233, 220, .55); text-shadow: 0 1px 3px #000;
}
.rx-ui {
  position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; gap: 8px; opacity: 0; transition: opacity .4s; z-index: 2;
}
.rx-ui .close { position: static; display: grid; place-items: center; }
.rx-ui .som[aria-pressed="true"] { color: var(--accent); }
dialog#relax.ui .rx-ui { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .card img { transition: none; } .card:hover img { transform: none; } .skel { animation: none; }
  .logo svg { transition: none; } .logo:hover svg { transform: none; }
  .dots i { animation-name: pulse; }
  .rx { transition-duration: .8s; }
}
