/* ===== Fontes da marca (as mesmas do app) ===== */
@font-face { font-family: "Sora"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("./assets/fonts/sora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("./assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("./assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("./assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Desliga o flash cinza padrão do navegador ao tocar em links/botões no celular; os
     próprios estados de :hover/:active da página já dão o retorno visual do toque. */
  -webkit-tap-highlight-color: transparent;
}

/* ===== Tokens: tema escuro (padrão) ===== */
:root {
  --text-color: #f0f2f6;
  --bg-color: #0a0d13;
  --bg-url: url(./assets/bg-mobile.jpg);
  --stroke-color: rgba(255, 255, 255, 0.5);
  --surface-color: rgba(255, 255, 255, 0.05);
  --surface-color-hover: rgba(255, 255, 255, 0.02);
  --highlight-color: rgba(255, 255, 255, 0.2);
  --switch-bg-url: url(./assets/moon-stars.svg);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);

  /* Amarelo de destaque do app */
  --accent: #e8cb00;
  --accent-text: #0d121b;
}

/* ===== Tokens: tema claro ===== */
.light {
  --text-color: #11161f;
  --bg-color: #f6f7fb;
  --bg-url: url(./assets/bg-mobile-light.jpg);
  --stroke-color: rgba(0, 0, 0, 0.5);
  --surface-color: rgba(255, 255, 255, 0.2);
  --surface-color-hover: rgba(0, 0, 0, 0.02);
  --highlight-color: rgba(0, 0, 0, 0.1);
  --switch-bg-url: url(./assets/sun.svg);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Mesmas cores do app em oklch, para telas que suportam */
@supports (color: oklch(0% 0 0)) {
  :root {
    --text-color: oklch(96% 0.006 262);
    --bg-color: oklch(16% 0.014 262);
    --accent: oklch(84% 0.19 100);
    --accent-text: oklch(18% 0.02 262);
  }
  .light {
    --text-color: oklch(20% 0.02 262);
    --bg-color: oklch(97% 0.006 262);
  }
}

/* ===== Base ===== */
body {
  background: var(--bg-url) no-repeat top center / cover;
  background-color: var(--bg-color);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100svh;
}

body * {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-color);
}

/* Foco visível para navegação por teclado */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 3px;
}

#container {
  width: 100%;
  max-width: 588px;
  margin: 56px auto;
  padding: 0 24px;
  animation: fade-up 0.6s ease both;
}

/* ===== Perfil ===== */
#profile {
  text-align: center;
  padding: 24px;
}

#profile img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

#profile p {
  font-weight: 500;
  line-height: 24px;
  margin-top: 8px;
}

/* ===== Switch de tema ===== */
#switch {
  position: relative;
  width: 64px;
  height: 24px;
  margin: 4px auto;
}

#switch button {
  width: 32px;
  height: 32px;
  background: #fff var(--switch-bg-url) no-repeat center / 20px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;

  position: absolute;
  top: 50%;
  left: 0;
  z-index: 1;
  transform: translateY(-50%);
  transition: outline-color 0.2s;
  animation: slide-back 0.3s forwards;
}

.light #switch button {
  animation: slide-in 0.3s forwards;
}

#switch button:hover {
  outline: 8px solid var(--highlight-color);
}

#switch span {
  display: block;
  width: 64px;
  height: 24px;
  background: var(--surface-color);
  border: 1px solid var(--stroke-color);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 9999px;
}

/* ===== Links ===== */
ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0;
}

ul li a {
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px 24px;
  background: var(--surface-color);
  border: 1px solid var(--stroke-color);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  text-decoration: none;
  font-weight: 500;

  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

ul li a:hover {
  background: var(--highlight-color);
  border-color: var(--text-color);
  transform: translateY(-2px);
}

ul li a:active {
  transform: translateY(0);
}

/* ===== Primeira caixinha: botão de destaque (amarelo do app) ===== */
ul li a.cta {
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  background: var(--accent);
  border-color: var(--accent);
  text-align: center;
}

ul li a.cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  filter: brightness(1.05);
}

ul li a.cta:focus-visible {
  outline-color: var(--text-color);
}

ul li a.cta span {
  color: var(--accent-text);
}

.cta-title {
  font-family: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.3;
  text-wrap: balance;
}

.cta-sub {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
}

/* ===== Link de duas linhas (título + descrição) ===== */
ul li a.link-2 {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.link-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.link-title .lock {
  flex: none;
  opacity: 0.85;
}

.link-title .lock[hidden] {
  display: none;
}

.link-sub {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.8;
}

/* ===== Diálogo do livro (liberação por confiança) ===== */
#livro-dialog {
  width: min(420px, calc(100% - 32px));
  margin: auto;
  padding: 0;
  background: var(--bg-color);
  border: 1px solid var(--stroke-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: visible;
}

#livro-dialog[open] {
  animation: dialog-in 0.2s ease-out both;
}

#livro-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.dlg-body {
  position: relative;
  padding: 28px 24px 20px;
}

.dlg-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.dlg-close:hover {
  background: var(--highlight-color);
}

#livro-titulo {
  font-family: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.3;
  padding-right: 32px;
  text-wrap: balance;
}

#livro-desc {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.55;
}

.dlg-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border: 1px solid var(--stroke-color);
  border-radius: 8px;
  background: var(--surface-color);
  font: inherit;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn:hover {
  background: var(--highlight-color);
  border-color: var(--text-color);
}

.btn.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn.btn-primary,
.btn.btn-primary * {
  color: var(--accent-text);
}

.btn.btn-primary:hover {
  filter: brightness(1.05);
}

/* Download ainda bloqueado: visível, mas claramente inativo */
.btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.is-locked:hover {
  background: var(--surface-color);
  border-color: var(--stroke-color);
}

.btn-text {
  align-self: center;
  padding: 8px 12px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-text[hidden] {
  display: none;
}

.dlg-status {
  min-height: 1.4em;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.dlg-nota {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.75;
  text-align: center;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Redes sociais ===== */
#social-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 24px 0;
  font-size: 24px;
}

#social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 50%;
  transition: background 0.2s, transform 0.2s;
}

#social-links .icon {
  display: block;
}

#social-links a:hover {
  background: var(--highlight-color);
  transform: scale(1.1);
}

/* ===== Rodapé ===== */
footer {
  padding: 24px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}

footer a {
  color: inherit;
  font-weight: 600;
}

footer .disclaimer {
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.8;
}

/* ===== Responsivo ===== */
@media (min-width: 700px) {
  :root {
    --bg-url: url(./assets/bg-desktop.jpg);
  }
  .light {
    --bg-url: url(./assets/bg-desktop-light.jpg);
  }
}

/* ===== Animações ===== */
@keyframes slide-in {
  from { left: 0; }
  to { left: 50%; }
}

@keyframes slide-back {
  from { left: 50%; }
  to { left: 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
