/* fofinja.com — visual do design original (fundo preto, fonte mono, cards arredondados) */

@font-face { font-family: "fofinja-title"; src: url(fonts/title-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "fofinja-title"; src: url(fonts/title-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #000;
  --stage-w: min(1176px, calc(100vw - 32px));
  --cell: calc(var(--stage-w) / 147);
  --radius: calc(var(--cell) * 2);
  --title-font: "fofinja-title", ui-monospace, "Courier New", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: #fff; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; }
a { color: inherit; }
.title-font { font-family: var(--title-font); font-weight: 700; }

/* ---------- Palco ---------- */
.stage {
  display: grid;
  width: var(--stage-w);
  grid-template-columns: repeat(147, 1fr);
  grid-template-rows: repeat(var(--rows), var(--cell));
  margin: clamp(72px, 12vh, 110px) auto 64px;
}

.tile {
  position: relative;
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tile-bg, transparent);
  color: var(--tile-color, #fff);
  container-type: size;
  animation: wipe 750ms cubic-bezier(.31, .92, .6, 1.01) both;
  animation-delay: calc(100ms + var(--order) * 60ms);
}
@keyframes wipe {
  from { clip-path: inset(-10% 100% -10% -10%); }
  to   { clip-path: inset(-10% -10% -10% -10%); }
}
@media (prefers-reduced-motion: reduce) { .tile { animation: none; } }

.tile-anchor { position: absolute; inset: 0; display: block; text-decoration: none; }
.media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fundo enquanto a mídia carrega, para o bloco não sumir no preto */
.tile-image, .tile-video { background: var(--tile-bg, #17171c); }

/* Perfil: avatar redondo saindo do topo do card cinza */
.tile-profile { overflow: visible; background: transparent; border-radius: 0; }
.tile-profile .avatar {
  position: absolute; left: 50%; top: 0; z-index: 1;
  width: 28cqw; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; object-fit: cover;
  border: 3px solid #1d1b2b; background: #1d1b2b;
}
.tile-profile .profile-card {
  position: absolute; inset: 14cqw 0 0 0;
  background: var(--tile-bg, #8e8e95);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  padding: 12cqw 22cqw 8cqw;
}
.tile-profile p {
  margin: 0; text-align: center; color: var(--tile-color, #000);
  font-size: 8.4cqw; line-height: 1.12;
}

.tile-text .rich {
  position: relative; height: 100%; overflow: auto; padding: 6cqw;
  font-size: max(14px, 3.1cqw); line-height: 1.55;
}
.tile-text .rich p { margin: 0 0 .8em; }

.tile-social { background: var(--tile-bg, #2c2c2e); }
.social { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-evenly; }
.social a { height: 70%; display: flex; align-items: center; }
.social .icon { height: 100%; width: auto; display: block; }

.link-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 2cqh 4cqw; font-size: min(60cqh, 9cqw); color: var(--tile-color, #fff);
}
.tile-link .link-text.title-font { font-family: var(--tile-font, var(--title-font)); }

.caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14cqw 6cqw 5cqw;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
  text-align: center; display: grid; gap: 1.5cqw;
}
.caption strong { font-family: var(--title-font); font-weight: 700; font-size: max(12px, 7cqw); }
.caption .desc { font-size: max(11px, 5cqw); line-height: 1.3; }

/* Botão em pílula (ex.: "Minhas Waifus") */
.pill {
  position: absolute; z-index: 2; transform: translate(-50%, -50%);
  padding: .2em .8em; border-radius: 999px; width: max-content; max-width: 80%;
  font-family: var(--pill-font, var(--title-font)); font-weight: 700; text-decoration: none;
  font-size: calc(var(--cell) * 3.9 * var(--pill-scale, 1)); line-height: 1.15; text-align: center;
  border: 2px solid var(--pill-border, transparent);
  transition: transform .15s ease;
}
.pill:hover { transform: translate(-50%, -50%) scale(1.04); }
/* Botão em imagem: sem fundo; largura pelo tamanho escolhido (100% = 131px no palco de 1176px, como no site original) */
.pill-image { padding: 0; border: 0; border-radius: 0; background: none; line-height: 0; max-width: 90%; }
.pill-image img { display: block; width: calc(var(--cell) * 16.4 * var(--pill-scale, 1)); max-width: 100%; height: auto; }
.pill.static { position: static; transform: none; display: inline-block; background: #fff; color: #000; }

/* ---------- Barra superior ---------- */
.topbar {
  position: fixed; top: 18px; right: 24px; z-index: 50;
  display: flex; align-items: center; gap: 4px; padding: 5px;
  border-radius: 14px; background: #2c2c2e;
}
.topbar a, .topbar button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 10px;
  border-radius: 10px; border: 0; background: transparent; color: #cfcfd8;
  font: 700 14px/1 var(--title-font); text-decoration: none; cursor: pointer;
}
.topbar a:hover, .topbar button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topbar .icon { width: 20px; height: 20px; border-radius: 5px; }
.top-btn span { display: none; }
.lang-group { display: inline-flex; gap: 2px; }
.lang-btn.active, .lang-btn.active:hover { background: #fff; color: #000; }
.lang-menu { position: relative; }
.lang-list {
  display: none; position: absolute; top: 100%; right: 0; padding-top: 10px; /* ponte para o mouse não perder o menu */
  flex-direction: column; gap: 2px; min-width: 150px;
}
.lang-list::before { content: ""; position: absolute; inset: 10px 0 0; z-index: -1; border-radius: 12px; background: #2c2c2e; }
.lang-list .lang-btn { justify-content: flex-start; margin: 0 5px; white-space: nowrap; }
.lang-list .lang-btn:first-child { margin-top: 5px; }
.lang-list .lang-btn:last-child { margin-bottom: 5px; }
.lang-menu:hover .lang-list, .lang-menu:focus-within .lang-list { display: flex; }
.sound-btn { padding: 0 !important; }
.sound-group { display: inline-flex; align-items: center; }
.volume {
  width: 0; opacity: 0; margin: 0; accent-color: #fff; cursor: pointer;
  transition: width .2s ease, opacity .2s ease, margin .2s ease;
}
.sound-group:hover .volume, .sound-group:focus-within .volume { width: 84px; opacity: 1; margin: 0 6px 0 8px; }
.music { display: inline-flex; align-items: center; gap: 2px; }
.music button { padding: 0 !important; }
.music svg { width: 18px; height: 18px; }
.music .music-pause, .music-btn[aria-pressed="true"] .music-play { display: none; }
.music-btn[aria-pressed="true"] .music-pause { display: inline; }
.music-btn[aria-pressed="true"] { color: #fff; }
.music-title {
  max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 700 12px/1 var(--title-font); color: #cfcfd8;
}
.music-title:empty { display: none; }
.music-title:not(:empty) { padding: 0 6px; }
.yt-hidden { position: fixed; left: -9999px; top: 0; width: 200px; height: 200px; overflow: hidden; pointer-events: none; }
@media (max-width: 600px) { .music-title { display: none; } }
.sound-btn svg { width: 18px; height: 18px; }
.sound-btn .sound-on, .sound-btn[aria-pressed="true"] .sound-off { display: none; }
.sound-btn[aria-pressed="true"] .sound-on { display: inline; }

.preview-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 6px;
  background: #ffcf4a; color: #000; text-align: center; font: 700 13px system-ui, sans-serif;
}

.not-found { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; }
.not-found .title-font { font-size: 72px; margin: 0; }

/* Troca de idioma: cortina só no texto que mudou */
.text-swap { animation: text-swap 550ms cubic-bezier(.31, .92, .6, 1.01) both; }
@keyframes text-swap {
  from { clip-path: inset(-25% 100% -25% -5%); opacity: .3; }
  to   { clip-path: inset(-25% -5% -25% -5%); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .text-swap { animation: none; } }

/* ---------- Transição entre páginas (swup) ---------- */
body { overflow-x: hidden; }
html.is-changing .transition-slide { transition: transform 450ms cubic-bezier(.65, 0, .35, 1), opacity 450ms ease; }
html.is-animating.is-leaving[data-dir="forward"] .transition-slide { transform: translateX(-100vw); opacity: .3; }
html.is-animating.is-rendering[data-dir="forward"] .transition-slide { transform: translateX(100vw); opacity: .3; }
html.is-animating.is-leaving[data-dir="back"] .transition-slide { transform: translateX(100vw); opacity: .3; }
html.is-animating.is-rendering[data-dir="back"] .transition-slide { transform: translateX(-100vw); opacity: .3; }
/* Depois de navegar pelo swup a página desliza; a cortina dos tiles fica só no primeiro carregamento */
html.swup-arrived .tile { animation: none; }
@media (prefers-reduced-motion: reduce) { html.is-changing .transition-slide { transition: none; } }

/* ---------- Página que cabe na tela (sem rolagem) ---------- */
body.fit-screen {
  height: 100vh; overflow: hidden;
  display: grid; place-items: start center;
  padding: clamp(72px, 12vh, 110px) 0 24px; box-sizing: border-box;
}
.stage.fit {
  --stage-w: min(1176px, calc(100vw - 64px), calc((100vh - clamp(72px, 12vh, 110px) - 24px) * 147 / var(--rows)));
  --cell: calc(var(--stage-w) / 147);
  --radius: calc(var(--cell) * 2);
  margin: 0;
}

.stage.large { --stage-w: calc(100vw - 64px); --cell: calc(var(--stage-w) / 147); --radius: calc(var(--cell) * 2); }
.stage.fit.large { --stage-w: min(calc(100vw - 64px), calc((100vh - clamp(72px, 12vh, 110px) - 24px) * 147 / var(--rows))); }

/* ---------- Celular: 2 colunas, depois 1 ---------- */
@media (max-width: 900px) {
  :root { --stage-w: calc(100vw - 32px); }
  body.fit-screen { height: auto; overflow: auto; display: block; padding: 0; }
  .stage.fit, .stage.large, .stage.fit.large { --stage-w: calc(100vw - 32px); margin: 72px auto 64px; }
  .stage {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    gap: 12px;
    align-items: start;
    margin-top: 72px;
  }
  .tile { grid-column: auto !important; grid-row: auto !important; order: var(--order); aspect-ratio: var(--ar); width: 100%; }
  .pill { font-size: calc(16px * var(--pill-scale, 1)); }
  .pill-image img { width: calc(131px * var(--pill-scale, 1)); }
  .topbar { top: 12px; right: 12px; }
}
@media (max-width: 480px) {
  .stage { grid-template-columns: 1fr; }
}
