/* Layout do site. Mobile first: base para celular; 640px tablet; 1024px computador. */
/* Tema: claro por padrão; escuro quando <html data-theme="dark"> (definido em baseof.html). */
:root {
  --background-color: #eaedf0;
  --secondary-background-color: #f8f9fa;
  --text-color: #343a40;
  --text-secondary-color: #5c636a;
  --text-link-color: #0062cc;
  --primary-color: #007bff;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --background-color: #18191a;
  --secondary-background-color: #212529;
  --text-color: #e4e6eb;
  --text-secondary-color: #b0b3b8;
  --text-link-color: #ffffff;
  --primary-color: #ffffff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
img, svg { max-width: 100%; height: auto; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  background: var(--background-color);
  color: var(--text-color);
}
a { color: var(--text-link-color); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* Cabeçalho fixo */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background-color);
  border-bottom: 1px solid var(--secondary-background-color);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.25rem 1.25rem;
}
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text-color); min-height: 44px; display: inline-flex; align-items: center; }
.nav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 0.25rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  text-decoration: none;
  color: var(--text-secondary-color);
  border-radius: 999px;
}
/* Botão de tema (sol/lua) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-secondary-color);
  cursor: pointer;
}
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--secondary-background-color); color: var(--text-color); }
.theme-toggle svg { width: 22px; height: 22px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav a:hover, .nav a:focus-visible, .nav a[aria-current="page"] { color: var(--text-color); background: var(--secondary-background-color); }

/* Conteúdo */
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

/* Início (hero) */
.hero { padding: 1.5rem 0 0.5rem; }
h1 { font-size: clamp(2.4rem, 9vw, 3.8rem); line-height: 1.1; margin: 0.2rem 0 0.5rem; color: var(--primary-color); }
.intro { margin: 0; font-size: 1.1rem; color: var(--text-secondary-color); }
.lead { margin: 0 0 0.75rem; font-size: 1rem; color: var(--text-secondary-color); }
.hero p:last-child:not(.lead) { max-width: 60ch; margin: 0; color: var(--text-color); }

/* Seções em cartão */
.about, .map-section, .timeline-section, .gallery-section {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--secondary-background-color);
  box-shadow: var(--shadow);
}
.about { margin-top: 3rem; }
.section-title, .about h2 {
  font-size: 1.5rem;
  text-align: center;
  margin: 0 0 1rem;
}
.section-title::after, .about h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin: 0.5rem auto 0;
  border-radius: 3px;
  background: var(--primary-color);
}
.about p { margin: 0 0 1rem; }
.about p:last-child { margin-bottom: 0; }

/* Places: map */
.map { position: relative; margin: 0; }
.map svg { width: 100%; height: auto; display: block; }
.countries path { fill: var(--secondary-background-color); stroke: var(--text-secondary-color); stroke-width: 0.5; }
.pin { cursor: pointer; }
.pin path { fill: var(--primary-color); stroke: var(--background-color); stroke-width: 0.6; }
.pin-highlight { fill: var(--background-color); }
.pin:focus { outline: none; }
.pin:focus path { stroke: var(--text-color); stroke-width: 1; }
.map-tooltip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  background: var(--text-color);
  color: var(--background-color);
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 1;
}
.map-tooltip.visible { opacity: 1; }

/* Lugares: linha do tempo vertical */
.timeline { --line: 5.75rem; list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: var(--line);
  width: 2px;
  background: var(--primary-color);
  opacity: 0.35;
}
.timeline li { position: relative; display: grid; grid-template-columns: 5rem 1fr; gap: 1.5rem; padding-bottom: 1.5rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: calc(var(--line) - 0.4rem);
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--primary-color);
  box-shadow: 0 0 0 3px var(--secondary-background-color);
}
.year { font-weight: 700; color: var(--primary-color); text-align: right; font-variant-numeric: tabular-nums; }
.destinations { margin: 0; }

/* Rodapé */
footer { padding: 1.5rem 1.25rem; text-align: center; font-size: 0.9rem; color: var(--text-secondary-color); border-top: 1px solid var(--secondary-background-color); }
footer p { margin: 0.35rem 0; }
footer a { color: var(--text-link-color); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; background: var(--secondary-background-color); }
footer a:hover { text-decoration: underline; }
footer .social { display: flex; justify-content: center; gap: 0.75rem; margin: 0.5rem 0 0.75rem; }
footer .social-link { width: 44px; padding: 0; justify-content: center; }
footer .social-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* Tablet */
@media (min-width: 640px) {
  main { padding: 2.5rem 1.75rem 3.5rem; }
  .about, .timeline-section { padding: 2rem; }
}

/* Computador */
@media (min-width: 1024px) {
  main { padding: 3rem 2rem 4rem; }
  .hero { padding: 2.5rem 0 1rem; }
  .about, .map-section, .timeline-section { margin-top: 2.5rem; }
  .about { margin-top: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .map-tooltip { transition: none; }
}

/* Galeria de fotos */
.gallery { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.gallery-item { display: block; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--secondary-background-color); box-shadow: var(--shadow); }
.gallery-item img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.photo { margin: 0; }
.photo img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.photo figcaption { margin-top: 1rem; }
.photo h1 { font-size: 2rem; margin: 0 0 0.25rem; }
.photo-meta { margin: 0 0 0.5rem; color: var(--text-secondary-color); }
.exif { margin: 0.5rem 0 0; color: var(--text-secondary-color); font-size: 0.9rem; }
.exif span + span::before { content: "·"; margin: 0 0.5rem; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 1024px) { .gallery { grid-template-columns: repeat(4, 1fr); } }

/* Modal da galeria: a foto em destaque sobre fundo escuro, sem cartão. Setas sobre as bordas da foto, fechar no canto. */
.photo-dialog {
  width: min(96vw, 1400px);
  max-height: 96vh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: #111;
  color: #eee;
  box-shadow: none;
  overflow: auto;
}
.photo-dialog::backdrop { background: rgba(0, 0, 0, 0.85); }
.photo-dialog:focus, .photo-dialog:focus-visible { outline: none; }
.photo-dialog .photo { margin: 0; }
.photo-frame { position: relative; }
.photo-dialog .photo-frame { width: fit-content; max-width: 100%; margin: 0 auto; }
.photo-dialog .photo img { display: block; width: auto; max-width: 100%; max-height: calc(100vh - 13rem); height: auto; border-radius: 0; }
.photo-dialog figcaption { padding: 0.75rem 1rem 1rem; overflow-wrap: anywhere; }
.photo-dialog .photo-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.125rem; color: #fff; }
.photo-dialog .photo-meta { margin: 0 0 0.25rem; color: #aaa; }
/* Legenda do modal: história à esquerda, dados técnicos à direita (desktop); empilhado no celular. */
.photo-dialog figcaption { display: flex; flex-direction: column; gap: 0.25rem; }
.photo-dialog .photo-info { min-width: 0; }
.photo-dialog .exif { margin: 0; color: #aaa; font-size: 0.85rem; }
@media (min-width: 640px) {
  .photo-dialog figcaption { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 1.5rem; }
  .photo-dialog .exif { white-space: nowrap; }
}
.dialog-btn {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}
.dialog-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.dialog-btn:focus { outline: none; }
.dialog-btn:hover, .dialog-btn:focus-visible { border-color: #fff; }
.dialog-prev { left: 0.5rem; }
.dialog-next { right: 0.5rem; }
.dialog-close { top: 0.5rem; right: 0.5rem; transform: none; z-index: 2; }

/* Cabeçalho: itens do menu não quebram o texto; a lista pode ir para a linha de baixo. */
.nav ul { flex-wrap: wrap; }
.nav a { white-space: nowrap; }

/* Contato: cartão com formulário. */
.contact-section { margin-top: 2rem; padding: 1.5rem; border-radius: var(--radius); background: var(--secondary-background-color); box-shadow: var(--shadow); }
.contact-form { display: grid; gap: 1rem; max-width: 40rem; }
.contact-form label { display: grid; gap: 0.35rem; font-weight: 600; }
.contact-form input, .contact-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text-color);
  background: var(--background-color);
  border: 1px solid var(--text-secondary-color);
  border-radius: 8px;
}
.contact-form input:focus-visible, .contact-form textarea:focus-visible { outline: none; border-color: var(--text-color); }
.contact-form textarea { resize: vertical; }
.form-submit {
  justify-self: start;
  min-height: 44px;
  padding: 0 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--background-color);
  background: var(--primary-color);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.form-submit:disabled { opacity: 0.6; cursor: wait; }
.form-status { margin: 0; min-height: 1.5em; }
.privacy-note { margin: 0; font-size: 0.85rem; opacity: 0.75; }
.form-status.ok { color: #2e7d32; }
.form-status.erro { color: #c62828; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.hero + .hero { padding-top: 0.75rem; }

/* Navegação de uma página só: seções começam abaixo do cabeçalho fixo. */
[id] { scroll-margin-top: 5rem; }
/* Home: o hero ocupa quase a tela inteira, e o conteúdo começa abaixo da dobra. */
.home-hero { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
/* Home: Sobre mim ocupa a altura da tela, como o hero, com o conteúdo centralizado. */
#sobre { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
/* Home: Sobre mim tem uma área de altura de tela (só espaço) com o cartão branco ajustado ao texto. */
#sobre > .about { margin: 0; }

/* Texto só para leitores de tela (título escondido visualmente). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }


/* Home: foto de perfil ao lado do hero (no celular, abaixo do texto). */
.home-intro { display: grid; gap: 2rem; align-items: center; }
.profile-photo { display: block; width: 100%; max-width: 220px; height: auto; border-radius: 50%; aspect-ratio: 1 / 1; object-fit: cover; box-shadow: var(--shadow); justify-self: center; order: -1; }
@media (min-width: 1024px) {
  .home-intro { grid-template-columns: 1fr 320px; }
  .profile-photo { max-width: 320px; justify-self: end; order: 0; }
}
/* Celular: o texto do hero começa logo abaixo da foto (o espaço de tela fica depois dele). */
@media (max-width: 1023px) { .home-hero { justify-content: flex-start; } }
