/* ---------------------------------------------------------------------------
   ENERGISA — public site
   Colours come from tokens.css. No hex values below.
   --------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--ink-900);
  line-height: var(--leading-tight);
  margin: 0 0 var(--s-3);
  font-weight: 600;
  letter-spacing: -0.015em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }

p { margin: 0 0 var(--s-4); }

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--teal-500); }

img { max-width: 100%; height: auto; display: block; }

/* Keyboard focus must always be visible: a focus ring removed for looks is an
   accessibility defect, not a style choice. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.saltar {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-surface);
  color: var(--on-brand-strong);
  padding: var(--s-3) var(--s-4);
  z-index: 999;
}
.saltar:focus { left: var(--s-4); top: var(--s-4); }

/* The trap field. Hidden several ways over, because a screen reader honours
   only some of them and a robot reads the markup, not the styles. */
.campo-armadilha {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* --- Layout ------------------------------------------------------------- */

.envolvente {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}
.envolvente--estreita { width: min(100% - 2rem, var(--container-narrow)); }

.seccao { padding-block: var(--s-8); }
.seccao--calma { background: var(--surface-sunk); }
.seccao--marca { background: var(--brand-surface); color: var(--on-brand-strong); }
.seccao--marca h2,
.seccao--marca h3 { color: #fff; }

.grelha { display: grid; gap: var(--s-5); }
.grelha--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grelha--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grelha--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* --- Top bar and header -------------------------------------------------- */

.barra-topo {
  background: var(--brand-surface);
  color: var(--on-brand);
  font-size: var(--text-sm);
}
.barra-topo__interior {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  justify-content: space-between;
  padding-block: var(--s-2);
}
.barra-topo a { color: var(--on-brand); text-decoration: none; }
.barra-topo a:hover { color: #fff; text-decoration: underline; }

.cabecalho {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.cabecalho__interior {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding-block: var(--s-3);
}
.logotipo img { height: 42px; width: auto; }

.navegacao { display: flex; gap: var(--s-5); align-items: center; }
.navegacao a:not(.botao) {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  padding-block: var(--s-2);
  border-bottom: 2px solid transparent;
}
.navegacao a:hover,
.navegacao a[aria-current="page"] {
  color: var(--brand);
  border-bottom-color: var(--accent-text);
}

.alternar-menu {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-2) var(--s-3);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-sm);
}

/* --- Buttons ------------------------------------------------------------- */
/* Orange is the action colour. White text on it clears 4.5:1; orange text on
   white does not, which is why orange never sets body copy. */

.botao {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
/* Branco sobre o laranja da marca da 2,52:1. Tinta escura da 6,76:1 e e a
   unica forma de manter o laranja no botao principal do site. */
.botao--primario { background: var(--accent); color: var(--on-accent); }
.botao--primario:hover { background: var(--accent-hover); color: var(--on-accent); }
.botao--marca { background: var(--brand); color: #fff; }
.botao--marca:hover { background: var(--teal-800); color: #fff; }
.botao--contorno {
  background: transparent;
  border-color: currentColor;
  color: var(--brand);
}
.botao--contorno:hover { background: var(--teal-050); }
.botao--claro { background: #fff; color: var(--teal-900); }
.botao--claro:hover { background: var(--teal-050); color: var(--teal-900); }

/* --- Hero ---------------------------------------------------------------- */

.heroi {
  background: linear-gradient(135deg, var(--teal-900) 0%, var(--teal-700) 55%, var(--teal-600) 100%);
  color: #fff;
  padding-block: var(--s-9);
}
.heroi h1 { color: #fff; max-width: 18ch; }
.heroi__entrada {
  font-size: var(--text-lg);
  color: var(--on-brand);
  max-width: 56ch;
  margin-bottom: var(--s-6);
}
.heroi__accoes { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.heroi__nota {
  margin-top: var(--s-6);
  font-size: var(--text-sm);
  color: var(--on-brand);
}

/* --- Cards --------------------------------------------------------------- */

.cartao {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.cartao--ligacao { text-decoration: none; color: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.cartao--ligacao:hover { border-color: var(--teal-400); box-shadow: var(--shadow); color: inherit; }
.cartao h3 { margin: 0; color: var(--brand); }
.cartao p { margin: 0; color: var(--text-quiet); font-size: var(--text-sm); }
.cartao__numero {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-text);
}

.lista-marcada { margin: 0; padding-left: var(--s-5); color: var(--text-quiet); font-size: var(--text-sm); }
.lista-marcada li { margin-bottom: var(--s-1); }

.etiqueta {
  display: inline-block;
  background: var(--teal-050);
  /* O --teal-050 inverte-se com o tema e o --teal-700 nao: o par dava 1,85:1
     em modo escuro. O --brand acompanha o tema e mantem a cor da marca. */
  color: var(--brand);
  border-radius: var(--radius-pill);
  padding: var(--s-1) var(--s-3);
  font-size: var(--text-xs);
  font-weight: 600;
}

.cabeca-seccao { max-width: 60ch; margin-bottom: var(--s-6); }
.cabeca-seccao p { color: var(--text-quiet); }

/* --- Forms --------------------------------------------------------------- */

.campo { margin-bottom: var(--s-4); }
.campo label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--s-2);
  color: var(--ink-900);
}
.campo input,
.campo select,
.campo textarea {
  width: 100%;
  padding: var(--s-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-base);
}
.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  border-color: var(--brand-bright);
  outline: 2px solid var(--brand-bright);
  outline-offset: 0;
}
.campo__ajuda { font-size: var(--text-xs); color: var(--text-faint); margin-top: var(--s-1); }
.campo__erro { font-size: var(--text-sm); color: var(--bad-600); margin-top: var(--s-1); }
.obrigatorio { color: var(--bad-600); }

.aviso {
  border-radius: var(--radius);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
  font-size: var(--text-sm);
  border-left: 4px solid;
}
.aviso--bom { background: var(--good-050); border-color: var(--good-600); color: var(--good-600); }
.aviso--atencao { background: var(--warn-050); border-color: var(--warn-600); color: var(--warn-600); }
.aviso--mau { background: var(--bad-050); border-color: var(--bad-600); color: var(--bad-600); }
.aviso--nota { background: var(--teal-050); border-color: var(--brand); color: var(--brand); }

/* --- Footer -------------------------------------------------------------- */

.rodape {
  background: var(--brand-surface);
  color: var(--on-brand);
  padding-block: var(--s-8) var(--s-5);
  margin-top: var(--s-9);
}
.rodape h4 {
  color: #fff;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-3);
}
.rodape ul { list-style: none; margin: 0; padding: 0; }
.rodape li { margin-bottom: var(--s-2); }
.rodape a { color: var(--on-brand); text-decoration: none; font-size: var(--text-sm); }
.rodape a:hover { color: #fff; text-decoration: underline; }
.rodape__base {
  border-top: 1px solid var(--teal-800);
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: space-between;
  font-size: var(--text-xs);
}
.rodape__logotipo img { height: 38px; margin-bottom: var(--s-3); }
.rodape__lema { font-size: var(--text-sm); max-width: 32ch; }

/* --- Phone --------------------------------------------------------------- */

@media (max-width: 860px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }

  .alternar-menu { display: block; }
  .navegacao {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    padding: var(--s-3);
  }
  .navegacao[data-aberto="true"] { display: flex; }
  .navegacao a { padding: var(--s-3); border-bottom: 1px solid var(--line); }
  .cabecalho__interior { position: relative; }
  .seccao { padding-block: var(--s-7); }
  .heroi { padding-block: var(--s-8); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
