/*
 * A página inicial (Épico 7). Folha própria: o estilo.css continua a ser o de /v e
 * /partilha, que esta entrega não toca.
 *
 * Fora do herói, a linguagem visual é a da app (ui/tema/Cor.kt). O herói é o único sítio
 * com cor saturada, e a cor é CSS — nunca imagem —, para estar completo antes de qualquer
 * imagem chegar. Tipos de letra gerados por ferramentas/fontes_site.py.
 */

@font-face {
  font-family: "Archivo";
  src: url("/fontes/archivo.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fontes/plex-mono.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --fundo: #f8fafc;
  --cartao: #ffffff;
  --borda: #e4e9ee;
  --texto: #33404d;
  --secundario: #5b6875;
  --valor: #3d4e60;
  --botao: #dce7f2;
  --botao-sobre: #c9daea;
  --botao-premido: #b9cde1;
  --botao-texto: #33404d;
  --nota: #eaf1f8;
  --nota-texto: #3d4e60;
  --areia: #f1eee8;
  --areia-borda: #e3ddd3;
  --areia-texto: #68604f;
  --verde: #3e7a2e;
  --ecra: #f2f5f8;
  --ecra-escuro: #28313c;
  --moldura: #ffffff;
  --heroi: #1f3a52;
  --heroi-moldura: #14293a;
  --foco: #3d4e60;
  --sombra: 0 18px 36px -16px rgba(51, 64, 77, 0.22);

  --letra: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --barra: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #22282f;
    --cartao: #2f3742;
    --borda: #3c4553;
    --texto: #e7ecf1;
    --secundario: #a9b5c1;
    --valor: #c9d6e3;
    --botao: #dce7f2;
    --botao-sobre: #eef3f8;
    --botao-premido: #c9daea;
    --botao-texto: #22282f;
    --nota: #2b3a4a;
    --nota-texto: #d3dfeb;
    --areia: #3a342a;
    --areia-borda: #4d4536;
    --areia-texto: #ddd2bd;
    --verde: #9fcd8a;
    --ecra: #2f3742;
    --moldura: #2f3742;
    --heroi: #16293a;
    --heroi-moldura: #0f1e2b;
    --foco: #dce7f2;
    --sombra: 0 18px 36px -16px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--barra) + 12px);
  background: var(--fundo);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 400 16px/1.55 var(--letra);
}

h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
strong { font-weight: 600; }

a { color: var(--valor); }
a:hover { color: var(--texto); }

:focus-visible { outline: 2px solid var(--foco); outline-offset: 3px; }

h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
h3 { font-size: 17px; font-weight: 600; line-height: 1.35; }

.largura {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.saltar {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  background: var(--cartao);
  color: var(--texto);
  padding: 10px 16px;
  border-radius: 999px;
}
.saltar:focus { top: 12px; }

/* As etiquetas escrevem-se em minúsculas e passam a maiúsculas aqui: o leitor de ecrã lê
   palavras e não siglas, e o Plex Mono só traz as maiúsculas. */
.etiqueta {
  font: 500 11px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secundario);
}

/* ---------- Botões ---------- */

.botao {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font: 600 17px/1.25 var(--letra);
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s;
}
.botao small { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; }

.botao-principal { background: var(--botao); color: var(--botao-texto); }
.botao-principal:hover { background: var(--botao-sobre); color: var(--botao-texto); }
.botao-principal:active { background: var(--botao-premido); }
.botao-principal small { color: #3d4e60; }

.botao-branco { background: #fff; color: var(--heroi); }
.botao-branco:hover { background: #e8eef4; color: var(--heroi); }
.botao-branco:active { background: #d6e1eb; }

.botao-contorno-claro { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.botao-contorno-claro:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.botao-contorno { background: transparent; color: var(--texto); border-color: var(--texto); }
.botao-contorno:hover { background: var(--nota); color: var(--texto); }

.botao-pequeno { min-height: 40px; padding: 8px 18px; font-size: 14px; }

.heroi :focus-visible, .barra :focus-visible { outline-color: #fff; }

/* ---------- Barra de marca ---------- */

.barra {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--heroi);
}
.barra-dentro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--barra);
}
.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}
.marca:hover { color: #fff; }
.marca img { width: 30px; height: 30px; border-radius: 8px; background: #fff; }

/* ---------- Herói ---------- */

.heroi {
  background: var(--heroi);
  color: #fff;
  overflow: hidden;
}
.heroi-dentro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 36px;
  min-height: min(720px, calc(100svh - var(--barra)));
}
.heroi-texto {
  flex: 1 1 440px;
  min-width: min(290px, 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  padding: clamp(36px, 7vh, 80px) 0 clamp(40px, 7vh, 80px);
  align-self: center;
}
.etiqueta-heroi { color: rgba(255, 255, 255, 0.72); letter-spacing: 0.12em; }
.heroi h1 {
  max-width: 16ch;
  font-size: clamp(31px, 6vw, 68px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.heroi h1 strong { font-weight: 700; }
.heroi-sub {
  max-width: 26rem;
  font-size: clamp(17px, 1.7vw, 19px);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.84);
  text-wrap: pretty;
}
.heroi-botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  max-width: 30rem;
}
.heroi-botoes .botao-branco { flex: 1 1 230px; }
.heroi-botoes .botao-contorno-claro { flex: 0 1 auto; font-size: 16px; }
.heroi-confianca { font-size: 13px; line-height: 1.6; color: rgba(255, 255, 255, 0.8); }

/* O telemóvel entra por baixo e é cortado pelo bordo do campo de cor: perde 52 px. */
.heroi-ecra {
  flex: 1 1 320px;
  display: flex;
  justify-content: center;
  margin-bottom: -52px;
}

/* ---------- Molduras das capturas ---------- */

.moldura {
  position: relative;
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  aspect-ratio: 9 / 19.5;
  padding: 8px;
  background: var(--moldura);
  border: 1px solid var(--borda);
  border-radius: 32px;
  box-shadow: var(--sombra);
}
.moldura img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  border-radius: 25px;
  background: var(--ecra);
  /* Se a imagem não chegar, fica o fundo do ecrã e o texto alternativo legível. */
  color: var(--secundario);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}
.moldura-escura img { background: var(--ecra-escuro); color: #c9d3dd; }
.moldura-heroi {
  width: min(300px, 72vw);
  padding: 9px;
  background: var(--heroi-moldura);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 40px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}
.moldura-heroi img { border-radius: 32px; background: #f2f5f8; color: #5b6875; }
.moldura-pequena { max-width: 208px; border-radius: 30px; }
.moldura-pequena img { border-radius: 23px; }

/* ---------- Blocos ---------- */

.bloco { padding: 46px 0; border-top: 1px solid var(--borda); }
.heroi + .largura > .bloco:first-child { border-top: 0; padding-top: 88px; }
.bloco > h2 + .bloco-sub { margin-top: 6px; }
.bloco-sub { max-width: 36rem; color: var(--secundario); }
.bloco > h2, .bloco > .bloco-sub { margin-bottom: 30px; }
.bloco > h2.etiqueta { margin-bottom: 22px; }

.numeral {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--valor);
}

.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cartao p { color: var(--secundario); font-size: 15px; }
.cartao p.etiqueta { font-size: 11px; }

/* O problema */
.problema { display: flex; flex-direction: column; gap: 22px; }
.problema-lista {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.problema-lista li { display: flex; flex-direction: column; gap: 8px; }
.problema-lista strong { font-size: 17px; line-height: 1.35; }
.problema-lista span:last-child { font-size: 15px; color: var(--secundario); }
.problema-remate { font-size: clamp(19px, 2.2vw, 24px); font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }

/* Três passos */
.passos-ecra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 26px;
}
.passos-ecra li { display: flex; flex-direction: column; gap: 16px; }
.passo { display: flex; gap: 14px; align-items: flex-start; }
.passo .numeral { font-size: 38px; line-height: 0.9; letter-spacing: -0.04em; }
.passo h3 { font-size: 18px; margin-bottom: 5px; }
.passo p { font-size: 15px; color: var(--secundario); }
/* Sem imagem: o numeral é o elemento dominante da linha (anexos de desenho, componentes). */
.passos-sem-imagem .passo {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 20px;
  height: 100%;
}
.passos-sem-imagem .numeral { font-size: 48px; }

/* Mais-valias */
.grelha-cartoes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 16px;
}

/* Progressão */
.progressao {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.progressao .cartao { padding: 22px; gap: 12px; }
.progressao h3 { font-size: 19px; }
.cartao-percurso .moldura { margin-bottom: 4px; }
.patamar { width: 120px; height: 120px; object-fit: contain; }
.verde { color: var(--verde); }
.pequeno { font-size: 13px !important; line-height: 1.5; }

/* Relógio */
.relogio {
  background: var(--nota);
  border-radius: 24px;
  padding: clamp(22px, 3vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: center;
}
.relogio-texto { flex: 1 1 340px; min-width: min(270px, 100%); display: flex; flex-direction: column; gap: 16px; }
.relogio-texto h2 { font-size: clamp(22px, 2.8vw, 30px); line-height: 1.25; }
.relogio-texto p { max-width: 30rem; color: var(--nota-texto); }
.relogio .etiqueta { color: var(--nota-texto); }
.relogio-ecra { flex: 0 1 240px; min-width: 200px; display: flex; justify-content: center; }
.mostrador {
  width: 220px;
  height: 220px;
  padding: 10px;
  border-radius: 50%;
  background: #28313c;
  box-shadow: 0 18px 36px -14px rgba(51, 64, 77, 0.35);
}
.mostrador img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  color: #c9d3dd;
  font-size: 13px;
  text-align: center;
}

/* Privacidade */
.privacidade { display: flex; flex-wrap: wrap; gap: 30px; }
.privacidade h2 { flex: 1 1 280px; }
.lista-numerada { flex: 1 1 380px; min-width: min(280px, 100%); }
.lista-numerada li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--borda);
}
.lista-numerada li:last-child { border-bottom: 0; }
.lista-numerada span { font: 500 12px/1.9 var(--mono); color: var(--secundario); }

/* Instalar */
.instalar { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.instalar-lado {
  flex: 1 1 330px;
  min-width: min(275px, 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}
@media (min-width: 760px) {
  .instalar-lado { position: sticky; top: calc(var(--barra) + 22px); }
}
.instalar h2 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; letter-spacing: -0.025em; }
.instalar-lado .botao-principal { align-self: stretch; max-width: 26rem; font-size: 18px; padding: 17px 22px; }
.razoes { display: flex; flex-wrap: wrap; gap: 8px; }
.razoes li {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
}
.nota-lateral { max-width: 26rem; font-size: 14px; color: var(--secundario); }

.passos-instalar { flex: 1 1 380px; min-width: min(285px, 100%); display: flex; flex-direction: column; gap: 12px; }
.passos-instalar li {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.passos-instalar .numeral { font-size: 26px; min-width: 1ch; }
.passos-instalar li > div { display: flex; flex-direction: column; gap: 6px; }
.passos-instalar .aviso { background: var(--areia); border-color: var(--areia-borda); }
.passos-instalar .aviso .numeral, .etiqueta-areia { color: var(--areia-texto); }
.passos-instalar .etiqueta-areia { font-weight: 500; }

/* Perguntas: details/summary do navegador. O «+» é CSS. */
.perguntas { display: flex; flex-direction: column; gap: 10px; max-width: 46rem; }
.perguntas details {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 4px 20px;
}
.perguntas summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  cursor: pointer;
  list-style: none;
}
.perguntas summary::-webkit-details-marker { display: none; }
.perguntas summary::after {
  content: "+";
  flex: none;
  font-size: 22px;
  line-height: 1;
  color: var(--secundario);
  transition: transform 0.18s;
}
.perguntas details[open] summary::after { transform: rotate(45deg); }
.perguntas summary h3 { font-size: 17px; }
.perguntas details p { margin: 0 0 16px; color: var(--secundario); line-height: 1.6; }

/* Contacto */
.contacto {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-radius: 20px;
}
.contacto > div { flex: 1 1 300px; display: flex; flex-direction: column; gap: 6px; }
.contacto h2 { font-size: 19px; letter-spacing: 0; }
.contacto .botao { font-size: 16px; overflow-wrap: anywhere; }

/* Rodapé */
.rodape { border-top: 1px solid var(--borda); }
.rodape-dentro {
  padding-top: 30px;
  padding-bottom: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 13px;
  line-height: 1.6;
  color: var(--secundario);
}
.rodape-dentro > p:first-child { max-width: 34rem; }
.rodape-fim { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
.rodape .etiqueta { font-size: 13px; letter-spacing: 0.06em; }

/* Barra fixa em telemóvel (pagina.js) */
.barra-fixa {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 12px 16px 16px;
  background: color-mix(in srgb, var(--fundo) 95%, transparent);
  border-top: 1px solid var(--borda);
  transform: translateY(0);
  transition: transform 0.18s;
}
.barra-fixa .botao { display: flex; max-width: 420px; margin: 0 auto; }
.barra-fixa.escondida { transform: translateY(110%); }
@media (min-width: 760px) {
  .barra-fixa { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .botao, .barra-fixa, .perguntas summary::after { transition: none; }
}

/* ---------- Ecrãs estreitos ---------- */

@media (max-width: 380px) {
  .largura { padding: 0 16px; }
  .heroi-botoes .botao { flex: 1 1 100%; }
  .contacto .botao { width: 100%; }
}

/* ---------- Impressão ---------- */

@media print {
  :root { --fundo: #fff; --sombra: none; }
  .barra, .barra-fixa, .saltar, .heroi-ecra, .heroi-botoes { display: none !important; }
  .heroi { background: none; color: #000; }
  .heroi-dentro { min-height: 0; }
  .heroi .etiqueta-heroi, .heroi-sub, .heroi-confianca { color: #333; }
  .bloco { break-inside: avoid; }
  .perguntas summary::after { content: none; }
  a[href^="mailto:"]::after { content: ""; }
  .instalar-lado .botao-principal::after { content: " — https://cofrevolta.pt/cofre-volta.apk"; font-weight: 400; }
}
