/* RESET + BASE */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --font: Arial, Helvetica, sans-serif;
  --ink: #0f172a;
  --bg: #f8faf5;
  --line: #e2e8f0;
  --brand: #2563eb;
  --accent: #22d3ee;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 16px;
  --shadow: 0 10px 26px rgba(15,23,42,.15);
}

html {
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
}

/* alvo dos links #topo não ficar escondido atrás do header fixo */
#topo {
  scroll-margin-top: 140px;
}

/* largura comum a todas as páginas */
body > header,
body > main,
body > footer {
  width: min(1800px, 100%);
  margin-inline:auto;
}

/* tipografia básica */
h1,
h2,
h3,
h4 {
  margin:0 0.5rem;
  line-height: 1.2;
}

p,
ul,
ol,
dl,
table,
figure,
fieldset,
form,
details {
  margin: 0 0 1rem;
}

small {
  opacity: .85;
}

/* links + seletores de atributos */
a {
  color: var(--brand);
  text-underline-offset: 3px;
}

a:visited {
  color: #7c3aed;
}

a[href^="mailto:"] {
  font-weight: bold;
}

a[href^="http"]:not([href*="localhost"])::after {
  content: "↗";
  margin-left: .35ch;
  font-size: .9em;
  opacity: .7;
}

a[href$=".pdf" i] {
  border-bottom: 2px dotted currentColor;
}

a:hover {
  filter: brightness(1.06);
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* transições globais simples */
* {
  transition:
    background-color .25s ease,
    color .25s ease,
    border-color .25s ease,
    box-shadow .25s ease,
    transform .25s ease;
}

   /*HEADER + NAV (BASE) */

header {
  color: #fff;
  background: var(--hd, linear-gradient(90deg,#0b1220,#273449));
  border-radius: var(--radius);
  box-shadow: 0 14px 4px rgba(15,23,42,.35);
  padding: 10px 20px;
  position: relative;
  z-index: 10;
}

header h1 {
  font-size: clamp(1.rem, 2.2vw, 3.6rem);
  opacity: .82;
}

/* nav principal com lista (index, curriculo, interesses, biografia) */
header nav ul {
  list-style: none;
  margin: .6rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 80px;
  
}

header nav ul li {
  display: inline;
}

header nav a {
  display:inline-block;
  text-decoration:none;
  color:#fff !important;
  padding:.45rem 1.0rem;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background:linear-gradient(180deg,rgba(255,255,255,.1),rgba(255,255,255,.02));
  text-transform:uppercase;
  letter-spacing:.04em;
  font-size:.90rem;
}


header nav a:hover {
  color: #fffbeb !important;
  background: rgba(255,255,255,.12);
}

/* nav “simples” (caso uses) */
header > nav a {
  margin-right: .35rem;
}

/* linhas horizontais em header/footer */
header hr,
footer hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent);
}

/* INDEX (fundo.png) — TÍTULO + MENU SOBRE O VÍDEO */

/* tema da página */
body[background$="fundo.png"] {
  --bg: radial-gradient(1200px 800px at 20% -20%,#020617 0,#020617 40%,#0b1120 100%);
  --ink: #e5f0ff;
  --line: #1e293b;
  --brand: #38bdf8;
  --accent: #22d3ee;
  --hd: transparent;
}

/* header POSICIONADO por cima do vídeo, NÃO fixo */
body[background$="fundo.png"] > header {
  position: absolute;
  left: 50%;
  top: 8vh;
  transform: translateX(-50%);
  width: min(1000px, 92%);
  background: transparent;
  box-shadow: none;
  padding: 0;
  text-align: center;
}

/* vídeo logo a seguir ao header */
body[background$="fundo.png"] figure:first-of-type {
  margin: 0 0 1rem;
  position: relative;
  z-index: 1;
}

/* título e menu com sombra forte para ser legível sobre o vídeo */
body[background$="fundo.png"] header h1,
body[background$="fundo.png"] header nav a {
  -webkit-text-stroke: .6px rgba(0,0,0,.6);
  text-shadow:
    0 0 3px rgba(0,0,0,.9),
    0 4px 18px rgba(0,0,0,.9);
}

body[background$="fundo.png"] header h1 {
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  margin-bottom: .3rem;
}

body[background$="fundo.png"] header nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

body[background$="fundo.png"] header nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

body[background$="fundo.png"] header nav a {
  background: none;
  border: 0;
  border-radius: 0;
  padding: .4rem .8rem;
  font-weight: bold;
  font-size: clamp(.9rem, 1.4vw, 1.3rem);
}

/* linha subtil sob o link ao passar o rato (pseudo-elemento) */
body[background$="fundo.png"] header nav a {
  position: relative;
}

body[background$="fundo.png"] header nav a::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -4px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}

body[background$="fundo.png"] header nav a:hover::after {
  transform: scaleX(1);
}

/* vídeo mantém o tamanho definido no HTML */
body[background$="fundo.png"] figure:first-of-type video {
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(15,23,42,.6);
}

/* o resto do conteúdo começa depois do vídeo */
body[background$="fundo.png"] > main {
  padding-top: 2rem;
}

/* animação suave de entrada do header */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

body[background$="fundo.png"] > header {
  animation: fadeIn .7s ease-out both;
}

/* se existir <video> no header, esconde nas restantes páginas */
body:not([background$="fundo.png"]) header video {
  display: none;
}

/*HEADER FIXO NAS PÁGINAS INTERNAS (tudo exceto index)*/

/* espaço para o header fixo em todas as páginas menos no index */
body:not([background$="fundo.png"]) {
  padding-top: 120px;
}

body:not([background$="fundo.png"]) > header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  border-radius: 0 0 var(--radius) var(--radius);
  text-align: center; 
}
/* Centrar menu em todas as páginas internas */
body:not([background$="fundo.png"]) header nav ul {
  width: 100%;
  justify-content: center;
}


/* em ecrãs estreitos, header full-width e mais margem no topo */
@media (max-width: 719px) {
  body:not([background$="fundo.png"]) > header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 0 0 16px 16px;
  }

  body:not([background$="fundo.png"]) {
    padding-top: 140px;
  }
}

/*MAIN / ARTIGOS*/

main {
  padding: 24px 0 32px;
  position: relative;
  z-index: 0;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel,#ffffff);
  color: var(--panel-ink,#0f172a);
  padding: 24px;
  box-shadow: var(--shadow);
}

legend {
  padding: 8px 14px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(90deg,var(--brand),var(--accent));
  font-weight: bold;
  letter-spacing: .02em;
}

fieldset:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(15,23,42,.20);
}

/* listas de definição */
dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: .35rem .9rem;
}

dt {
  font-weight: bold;
}

dd {
  margin: 0 0 .4rem;
}

/* details/summary */
details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  color: #09642a;
}

summary {
  cursor: pointer;
  font-weight: bold;
}

/* tabelas */
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15,23,42,.18);
}

caption {
  caption-side: top;
  padding: 10px 0;
  font-weight: bold;
}

thead th {
  text-align: left;
  color: #fff;
  padding: 12px 14px;
  background: linear-gradient(90deg,var(--brand),var(--accent));
}

tbody td,
tbody th {
  padding: 10px 14px;
  border-bottom: 10px solid var(--line);
}

tbody tr:nth-child(odd) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #e5edff;
}

/* formulários */
label {
  font-weight: bold;
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: .55rem .7rem;
  background: #fff;
}

textarea {
  width: 100%;
  resize: vertical;
}

input[type="email" i] {
  border-color: var(--brand);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37,99,235,.2);
}

button,
input[type=submit],
input[type=reset] {
  cursor: pointer;
  border: 0;
  color: #fff;
  background: linear-gradient(90deg,var(--brand),var(--accent));
  box-shadow: 0 6px 18px rgba(37,99,235,.25);
  border-radius: 999px;
  padding: .6rem 1rem;
  font-weight: bold;
}

button:hover,
input[type=submit]:hover,
input[type=reset]:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37,99,235,.30);
}

/* validação simples com :valid / :invalid */
input:invalid {
  border-color: var(--danger);
}

input:valid {
  border-color: var(--success);
}

/* progress / meter */
progress,
meter {
  width: min(420px, 100%);
  height: 14px;
}

/* imagens “flutuadas” se tiverem align ou title */
img[align="left" i],
img[title~="esquerda"] {
  float: left;
  margin: 0 18px 12px 0;
  max-width: 36%;
}

img[align="right" i],
img[title~="direita"] {
  float: right;
  margin: 0 0 12px 18px;
  max-width: 36%;
}

h4 {
  clear: both;
}

figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 1.5rem; /* opcional — deixa melhor espaçamento */
}

figure img,
figure iframe {
  display: block;
  margin: 0 auto;
  border-radius: 12px; /* opcional — fica mais bonito */
}


/*FOOTER*/

footer {
  padding: 16px 0 28px;
  color: var(--ink);
}

footer nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

footer nav a {
  text-decoration: none;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(15,23,42,.06);
}

footer nav a:hover {
  text-decoration: underline;
}

/*CURRÍCULO — CARTÕES*/

body[background$="curric.png"] {
  --bg: linear-gradient(120deg,#f3f6ff 0,#eef2ff 100%);
  --ink: #020617;
  --panel: #ffffff;
  --panel-ink: #020617;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --accent: #f59e0b;
  --hd: linear-gradient(90deg,#020617,#1d4ed8);
}

/* header com apeto de “vidro” discreto */
body[background$="curric.png"] > header {
  background: rgba(15,23,42,.88);
  backdrop-filter: saturate(140%) blur(6px);
  border: 1px solid rgba(148,163,184,.35);
}

/* layout base do main no CV */
body[background$="curric.png"] main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* cartões */
body[background$="curric.png"] main > section {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15,23,42,.12);
  padding: 18px 20px;
  margin-bottom: 18px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

body[background$="curric.png"] main > section > h2 {
  margin-bottom: .2rem;
  letter-spacing: .06em;
}

body[background$="curric.png"] main > section > h2::after {
  content: " ▾";
  font-size: .8em;
  opacity: .7;
}

/* Desktop / Portátil (≥ 992px): abre ao passar o rato */
@media (min-width: 992px) {
  body[background$="curric.png"] main > section {
    max-height: 3.6rem;
  }

  body[background$="curric.png"] main > section > *:not(h2) {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .25s ease, transform .25s ease;
  }

  body[background$="curric.png"] main > section:hover {
    max-height: 1000px;
    background: linear-gradient(180deg,#ffffff,#f8fafc);
    box-shadow: 0 18px 40px rgba(15,23,42,.20);
  }

  body[background$="curric.png"] main > section:hover > *:not(h2) {
    opacity: 1;
    transform: translateY(0);
  }

  body[background$="curric.png"] main > section:hover > h2::after {
    content: " ▴";
  }

  body[background$="curric.png"] form#botoes fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
}

/* Tablet + Telemóvel (≤ 991px): sempre aberto */
@media (max-width: 991px) {
  body[background$="curric.png"] main > section {
    max-height: none;
    cursor: default;
  }

  body[background$="curric.png"] main > section > *:not(h2) {
    opacity: 1;
    transform: none;
    transition: none;
  }

  body[background$="curric.png"] main > section > h2::after {
    content: "";
  }
}

/*INTERESSES*/

body[background$="interesses.png"] {
  --bg: linear-gradient(120deg,#fbf7ff 0,#f5f0ff 100%);
  --ink: #1e1b4b;
  --panel: #ffffff;
  --panel-ink: #1e1b4b;
  --line: #e2e8f0;
  --brand: #7c3aed;
  --accent: #06b6d4;
  --hd: linear-gradient(90deg,#2b1847,#7c3aed);
}

@keyframes pulseLegend {
  0%   { box-shadow: 0 0 0 0 rgba(124,58,237,.4); }
  70%  { box-shadow: 0 0 0 14px rgba(124,58,237,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,58,237,0); }
}

body[background$="interesses.png"] legend {
  animation: pulseLegend 2.6s ease-out infinite;
}

/* Layout em grelha para interesses (ecrãs largos)
   ESQ: Aquascaping + Viagens
   DIR: Tecnologias + Resumo */
@media (min-width: 900px) {
  body[background$="interesses.png"] main {
    display: grid;
    grid-template-columns: minmax(0,2.1fr) minmax(260px,1fr);
    gap: 20px;
    align-items: flex-start;
  }

  /* Aquascaping: coluna 1, linha 1 */
  body[background$="interesses.png"] main > section#aquascaping {
    grid-column: 1;
    grid-row: 1;
  }

  /* Viajar em família: coluna 1, linha 2 */
  body[background$="interesses.png"] main > section#viagens {
    grid-column: 1;
    grid-row: 2;
  }

  /* Tecnologias: coluna 2, linha 1 */
  body[background$="interesses.png"] main > section#tecnologias {
    grid-column: 2;
    grid-row: 1;
  }

  /* Resumo (de lado): coluna 2, linha 2, cartão */
  body[background$="interesses.png"] main > aside {
    grid-column: 2;
    grid-row: 2;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(248,250,252,.85);
    padding: 18px;
    box-shadow: var(--shadow);
  }
}

/*CONTACTOS - ainda fica estranho no telefone*/

body[background$="contactos.png"] {
  --bg: linear-gradient(120deg,#fff7f7 0,#ffefef 100%);
  --ink: #111827;
  --panel: #fffafa;
  --panel-ink: #111827;
  --line: #f1d1d1;
  --brand: #dc2626;
  --accent: #ea580c;
  --hd: linear-gradient(90deg,#3a0d0d,#dc2626);
}

body[background$="contactos.png"] tbody tr:nth-child(odd) {
  background: #fff5f5;
}

body[background$="contactos.png"] tbody tr:hover {
  background: #fee2e2;
}

/* qualquer section com id nesta página destaca-se quando é alvo (#...) */
body[background$="contactos.png"] section[id] {
  position: relative;
  scroll-margin-top: 110px;
}

body[background$="contactos.png"] section[id]::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius) + 4px);
  border: 2px dashed transparent;
  pointer-events: none;
}

body[background$="contactos.png"] section[id]:target::before {
  border-color: var(--brand);
}

/*RESPONSIVO / LAYOUT GERAL*/

/* Desktop grande (≥ 1200px) */
@media (min-width: 1200px) {
  main {
    display: grid;
    grid-template-columns: repeat(12,1fr);
    gap: 22px;
  }

  main > section:first-of-type {
    grid-column: 1 / 8;
  }

  main > section:first-of-type + section {
    grid-column: 8 / 13;
  }

  main > section:nth-of-type(n+3) {
    grid-column: 1 / -1;
  }
}

/* Portátil / Desktop normal (992–1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  main {
    display: grid;
    grid-template-columns: repeat(12,1fr);
    gap: 20px;
  }

  main > section {
    grid-column: 1 / -1;
  }
}

/* Tablet (720–991px) */
@media (min-width: 720px) and (max-width: 991px) {
  main {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
}

/* Telemóvel (≤ 719px) */
@media (max-width: 719px) {
  body > header,
  body > main,
  body > footer {
    width: 94%;
  }

  dl {
    grid-template-columns: 1fr;
  }

  header nav ul {
    gap: 6px;
  }

  body[background$="fundo.png"] > header {
    top: 10vh;
  }
}

/* Ajustes específicos para TELEMÓVEL no index */
@media (max-width: 480px) {
  body[background$="fundo.png"] > header {
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }

  body[background$="fundo.png"] header h1 {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
  }

  body[background$="fundo.png"] header nav {
    justify-content: center;
  }

  body[background$="fundo.png"] header nav ul {
    justify-content: center;
  }

  body[background$="fundo.png"] header nav a {
    font-size: .75rem;
    letter-spacing: .02em;
  }
}

/* ecrãs muito baixos em altura */
@media (max-height: 520px) {
  body[background$="fundo.png"] > header {
    top: 6vh;
  }
}

