/* ==========================================================
   COMPONENTS — peças reutilizáveis. Todas pensadas para o dedo:
   alvos de toque >= 44px, sem depender de hover.
   ========================================================== */

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 52px; padding: 0 var(--s6);
  background: var(--yellow); color: var(--ink);
  border: var(--line); border-radius: var(--r-pill); box-shadow: var(--shadow);
  font-weight: 700; font-size: var(--fs-base); text-decoration: none; text-align: center;
  transition: transform .08s, box-shadow .08s;
  touch-action: manipulation;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn--block { width: 100%; }.btn--ghost { background: var(--paper); }
.btn--sm { min-height: var(--tap); padding: 0 var(--s4); font-size: var(--fs-sm); box-shadow: var(--shadow-sm); }
.btn--icon { width: 52px; padding: 0; flex: none; }
.btn[aria-pressed="true"].btn--ghost { background: var(--pink); }
.btn svg { width: 20px; height: 20px; }

/* ---------- Barra de navegação inferior (celular) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--paper); border-top: var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .6875rem; font-weight: 500;
  touch-action: manipulation; position: relative;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: 6px; width: 40px; height: 28px; z-index: -1;
  background: var(--yellow); border: var(--line); border-radius: var(--r-pill);
}

@media (max-width: 400px) { .tabbar a { font-size: .625rem; letter-spacing: -.01em; white-space: nowrap; } }

/* ---------- Navegação de topo (desktop) ---------- */
.topnav { display: none; }

@media (min-width: 960px) {
  .tabbar { display: none; }
  main { padding-bottom: var(--s10); }
  .topnav { display: flex; gap: var(--s8); }
  .topnav a {
    text-decoration: none; color: var(--muted); font-weight: 500; padding: var(--s2) 0;
    border-bottom: 3px solid transparent;
  }
  .topnav a:hover { color: var(--ink); }
  .topnav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--yellow); }
  .topnav svg { display: none; }
}

/* ---------- Chips de humor / opções ---------- */
.moods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }

.mood {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 56px; padding: var(--s2) var(--s3); min-width: 0;
  background: var(--paper); border: var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  font-weight: 600; text-align: left; touch-action: manipulation;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.mood img { width: 38px; height: 38px; object-fit: contain; object-position: center top; flex: none; }
.mood:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.mood[aria-pressed="true"] { background: var(--yellow); }

@media (min-width: 600px) {
  .moods { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mood { min-height: 64px; gap: var(--s3); }
  .mood img { width: 46px; height: 46px; }
}

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 var(--s4);
  background: var(--paper); border: var(--line); border-radius: var(--r-pill);
  font-weight: 500; font-size: .9375rem; text-decoration: none; touch-action: manipulation;
  transition: background .15s;
}
.pill[aria-pressed="true"], .pill.is-on { background: var(--yellow); font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* ---------- Balões de conversa ---------- */
.bubble {
  max-width: 85%; padding: var(--s3) var(--s4);
  background: var(--paper); border: var(--line); border-radius: var(--r-md);
  font-weight: 500; width: fit-content;
}
.bubble--user { background: var(--yellow); margin-left: auto; border-bottom-right-radius: 4px; }
.bubble--bot  { border-bottom-left-radius: 4px; }
.bubble--float { /* balão sobre a ilustração */
  position: absolute; z-index: 2; max-width: 70%;
  box-shadow: var(--shadow-sm); font-size: var(--fs-sm); font-weight: 500;
}
.typing { display: inline-flex; gap: 5px; padding: var(--s4); }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); opacity: .3; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Pôsteres (placeholders até a integração com a API de filmes) ---------- */
.poster {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; aspect-ratio: 2 / 3; padding: var(--s2); text-align: center; text-decoration: none;
  border: var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  overflow: hidden; background-size: cover; background-position: center;
}
.poster__t { font-weight: 800; font-size: .95rem; line-height: 1.1; text-transform: uppercase; letter-spacing: -.01em; }
.poster__s { font-weight: 600; font-size: .8rem; opacity: .9; }
.poster__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }   /* o pôster aparece inteiro, nunca cortado */
.poster:has(.poster__img) { background: var(--ink); }
.legal { margin-top: var(--s8); text-align: center; }
.poster__y { position: absolute; bottom: var(--s2); font-size: .6875rem; font-weight: 500; opacity: .7; }
.poster--teal   { background-color: var(--teal);   color: var(--cream); }
.poster--teal .poster__t { color: var(--yellow); }
.poster--red    { background-color: var(--red);    color: var(--paper); }
.poster--blue   { background-color: var(--blue);   color: var(--ink); }
.poster--yellow { background-color: var(--yellow); color: var(--ink); }
.poster--lav    { background-color: var(--lav);    color: var(--ink); }
.poster--pink   { background-color: var(--pink);   color: var(--ink); }
.poster--peach  { background-color: var(--peach);  color: var(--ink); }
.poster--sky    { background-color: var(--sky);    color: var(--ink); }
.poster--mint   { background-color: var(--mint);   color: var(--ink); }
/* pôster grande: o texto acompanha a largura do próprio pôster (nunca corta) */
.poster--lg { container-type: inline-size; }
.poster--lg .poster__t { font-size: 10.5cqw; overflow-wrap: anywhere; }
.poster--lg .poster__s { font-size: 8cqw; overflow-wrap: anywhere; }

.poster-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.poster-grid--2 { grid-template-columns: repeat(2, 1fr); gap: var(--s4); }
.poster-grid .poster { box-shadow: var(--shadow-sm); border-radius: var(--r-sm); }
.poster-grid .poster__t { font-size: .72rem; }
.poster-grid .poster__s { font-size: .62rem; }
.poster-grid--2 .poster__t { font-size: .9rem; }
.poster-grid--2 .poster__s { font-size: .75rem; }

button.poster { font: inherit; touch-action: manipulation; }
.poster[aria-pressed="true"] { outline: 4px solid var(--blue); outline-offset: 2px; }

@media (min-width: 600px) { .poster-grid { grid-template-columns: repeat(4, 1fr); } .poster-grid--2 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 960px) { .poster-grid { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Estrelas ---------- */
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 20px; height: 20px; fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.stars svg.on { fill: var(--yellow); }

/* ---------- Texto utilitário ---------- */
.eyebrow { font-size: var(--fs-sm); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--blue); }
.muted { color: var(--muted); }
.note { font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Abas (segmented control, rola de lado se faltar espaço) ---------- */
.tabs {
  display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .pill { flex: none; scroll-snap-align: start; }

/* ---------- Faixa rolável horizontalmente ---------- */
.rail {
  display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 10px;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: none; width: 132px; scroll-snap-align: start; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; z-index: 60;
  top: calc(var(--topbar-h) + var(--safe-t) + var(--s3));   /* no topo: não cobre os botões do polegar */
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100vw - 2rem); padding: var(--s3) var(--s5);
  background: var(--ink); color: var(--cream); border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 500; text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Barra de ação fixa (CTA ao alcance do polegar) ---------- */
.sticky-cta {
  position: sticky; z-index: 10;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s3));
  padding-top: var(--s4);
  background: linear-gradient(to top, var(--cream) 70%, transparent);
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
}
@media (min-width: 960px) {
  .sticky-cta { position: static; background: none; margin: 0; padding: 0; }
}

/* ---------- Botão de som (topo) ---------- */
.topbar__end { display: flex; align-items: center; gap: var(--s2); }
.sfxbtn {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  background: var(--paper); border: var(--line); border-radius: 50%;
}
.sfxbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sfxbtn[aria-pressed="false"] { opacity: .55; }
.sfxbtn:active { transform: scale(.92); }
