/* Mar dos Ecos: the shared ground every scene stands on. Sea palette and house type from art-src/DIRECAO.md §2, §6.
   IM Fell English is declared in abertura.css (the opening's narration). Alegreya is not in public/fonts/ yet: its
   stack falls back to a local serif until the build task that adds it. */
:root {
  --abismo: #0F2C3A; --mare: #1E5466; --vidro: #3E8C93; --espuma: #8CC7C2;
  --nevoa: #D9E8E3; --perola: #EFE6DA; --lilas: #B9A6C9;
  --fundo-painel: #133847;          /* between abismo and maré: névoa on it stays above 7:1 */
  --nevoa-baixa: #B5CCC8;           /* quieter text, still 7:1 on --fundo-painel */
  --letra-titulo: 'IM Fell English', 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --letra-texto: 'Alegreya', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --letra-meta: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --alvo: 48px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--abismo) radial-gradient(120% 70% at 50% -10%, #17394A 0%, var(--abismo) 60%) no-repeat;
  color: var(--nevoa); font: 17px/1.55 var(--letra-texto);
}
@media (min-width: 900px) { body { font-size: 18px; } }
h1, h2, h3, h4 { font-family: var(--letra-titulo); font-weight: 400; color: var(--perola); line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: var(--espuma); }
[hidden] { display: none !important; }
.oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* focus: a 2 px espuma ring with a soft outer glow, on every ground */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--espuma); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(140, 199, 194, .22); border-radius: 6px; }
[tabindex="-1"]:focus-visible { outline-offset: 4px; }

/* buttons */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: var(--alvo); min-width: var(--alvo); padding: 10px 20px;
  border: 1.5px solid var(--espuma); border-radius: 10px;
  background: var(--espuma); color: var(--abismo);
  font: 600 17px/1.2 var(--letra-texto); cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.botao:hover { background: #A3D4CF; border-color: #A3D4CF; }
.botao.secundario { background: transparent; color: var(--nevoa); border-color: var(--vidro); }
.botao.secundario:hover { background: rgba(62, 140, 147, .18); border-color: var(--espuma); }
.botao[aria-busy="true"] { cursor: progress; opacity: .8; }
/* destructive: an outline in lilás, never the filled primary */
.botao.perigo { background: transparent; color: var(--lilas); border-color: var(--lilas); }
.botao.perigo:hover { background: rgba(185, 166, 201, .14); border-color: var(--lilas); }
.botao.pequeno { min-height: 44px; padding: 8px 14px; font-size: 16px; }

.campo {
  width: 100%; min-height: var(--alvo); padding: 12px 14px;
  border: 1.5px solid var(--mare); border-radius: 10px;
  background: var(--abismo); color: var(--nevoa);
  font: inherit; line-height: 1.55;
}
.campo { transition: border-color .18s ease; }
.campo:hover { border-color: var(--vidro); }
.campo:focus-visible, .campo:focus { border-color: var(--espuma); outline: 2px solid var(--espuma); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(140, 199, 194, .18); }
.campo[aria-invalid="true"] { border-color: var(--lilas); }
textarea.campo { resize: vertical; }

/* the note at the bottom of the screen */
.aviso {
  position: fixed; z-index: 50; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 10px;
  background: var(--perola); color: var(--abismo); font: 16px/1.4 var(--letra-texto);
  box-shadow: 0 8px 30px rgba(6, 22, 30, .55);
  animation: aviso-entra .22s ease-out both;
}
.aviso.erro { border-left: 6px solid var(--lilas); }
.aviso.sai { animation: aviso-sai .16s ease-in both; }
@keyframes aviso-entra { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes aviso-sai { to { opacity: 0; transform: translate(-50%, 8px); } }

/* the confirm dialog */
.confirma-fundo {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 30, 40, .78); animation: nevoa-entra .2s ease-out both;
}
.confirma {
  width: min(480px, 100%); padding: 24px; border-radius: 14px;
  background: var(--fundo-painel); border: 1.5px solid var(--vidro);
  box-shadow: 0 20px 60px rgba(6, 22, 30, .6);
}
.confirma h2 { font-size: 24px; margin-bottom: 12px; }
.confirma p { color: var(--nevoa); }
.confirma-botoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 22px; }
@keyframes nevoa-entra { from { opacity: 0; } }
.confirma-fundo.sai { animation: nevoa-sai .16s ease-in both; }
@keyframes nevoa-sai { to { opacity: 0; } }

/* the placeholder for every scene not built yet */
.em-breve { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; text-align: center; gap: 12px; padding: 24px 16px; }
.em-breve h1 { font-size: 40px; }
.em-breve p { font-style: italic; color: var(--nevoa-baixa); }
.em-breve .em-breve-volta { margin-top: 14px; font-style: normal; }
.em-breve .botao { text-decoration: none; }

/* reduced motion: the note and the dialog only change opacity, quickly */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; }
  .aviso, .aviso.sai, .confirma-fundo { animation-duration: .12s; animation-name: nevoa-entra; }
  .confirma-fundo.sai { animation-duration: .12s; animation-name: nevoa-sai; }
  .aviso.sai { animation-direction: reverse; }
}

a.botao { text-decoration: none; }
