/* ============================================================
   ARCHITECT & URBANIST — Academic Portfolio
   A minimalist, warm-toned stylesheet with smooth transitions,
   glassmorphism navigation, and responsive mobile-first design.
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,600&family=JetBrains+Mono:wght@400&display=swap');

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Core palette — dynamically updated by JS for day/night modes */
  --bg-color: #f5f0e8;
  --text-color: #2a2520;
  --accent-color: #c17f3e;

  /* Card & surface treatments */
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --shadow-color: rgba(0, 0, 0, 0.06);

  /* Transition timing */
  --transition-speed: 1s;

  /* Navigation */
  --nav-bg: rgba(245, 240, 232, 0.85);

  /* Tags & badges */
  --tag-bg: rgba(193, 127, 62, 0.1);
  --tag-color: #c17f3e;

  /* Form inputs */
  --input-bg: rgba(0, 0, 0, 0.03);
  --input-border: rgba(0, 0, 0, 0.1);

  /* Timeline */
  --timeline-line: rgba(0, 0, 0, 0.1);

  /* Muted / secondary text */
  --muted-text: rgba(42, 37, 32, 0.6);
}

/* ── Global Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base Typography & Body ───────────────────────────────── */
body {
  font-family: 'Lora', serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
  line-height: 1.75;
  font-size: 17px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ── Smooth Scroll ────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
  background: var(--accent-color);
  color: #fff;
}

/* ── Custom Scrollbar ─────────────────────────────────────── */

/* Webkit browsers (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.5);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 128, 0.3) transparent;
}

/* ============================================================
   NAVIGATION
   Fixed glassmorphism nav bar with hamburger toggle on mobile.
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  height: 64px;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

/* Logo */
.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-color);
}

/* Desktop nav links */
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--muted-text);
  transition: color 0.3s;
  position: relative;
}

/* Animated underline on nav links */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent-color);
  transition: width 0.3s;
}

.nav-links a:hover {
  color: var(--text-color);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
}

.nav-toggle button {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
  position: relative;
}

/* ── Mobile Navigation ────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    z-index: 999;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1.2rem;
  }
}

/* ============================================================
   SECTION LAYOUT
   Full-viewport sections with fluid padding.
   ============================================================ */
.section {
  min-height: 100vh;
  padding: clamp(6rem, 12vh, 10rem) clamp(1.5rem, 5vw, 4rem) clamp(4rem, 8vh, 6rem);
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Section Titles ───────────────────────────────────────── */
.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-text);
  margin-bottom: 3rem;
}

/* ============================================================
   HERO SECTION (#inicio)
   Centered quote + 3D model viewer with staggered entrance.
   ============================================================ */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: calc(100vh - 64px);
}

.hero-quote {
  font-size: clamp(1.8rem, 4.5vw, 3.2rem);
  font-family: 'Lora', serif;
  font-weight: 400;
  font-style: italic;
  line-height: 1.4;
  max-width: 800px;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeInUp 1.2s ease forwards;
}

.hero-author {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-text);
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeInUp 1.2s ease 0.3s forwards;
}

.hero-model-viewer {
  width: min(600px, 90vw);
  height: min(500px, 60vh);
  margin: 0 auto;
  opacity: 0;
  animation: fadeInUp 1.2s ease 0.6s forwards;
}

.hero-model-viewer model-viewer {
  width: 100%;
  height: 100%;
  outline: none;
  --poster-color: transparent;
}

/* ============================================================
   LAB SECTION (#lab)
   Auto-fit project cards with glassmorphism surfaces.
   ============================================================ */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: 2rem;
}

.lab-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.lab-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px var(--shadow-color);
}

/* Badge / category label */
.lab-card-badge {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  background: var(--tag-bg);
  color: var(--tag-color);
  margin-bottom: 1.2rem;
}

.lab-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
}

.lab-card p {
  color: var(--muted-text);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* Project image / thumbnail */
.lab-card-image {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
}

/* Action buttons row */
.lab-card-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  background: var(--text-color);
  color: var(--bg-color);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.btn-secondary {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-color);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  border-color: var(--text-color);
  background: var(--card-bg);
}

/* ============================================================
   BIBLIOTECA SECTION (#biblioteca)
   Searchable & filterable reading list with tag pills.
   ============================================================ */
.biblioteca-container {
  max-width: 750px;
  margin: 0 auto;
}

/* Search field */
.search-wrapper {
  position: relative;
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  font-family: 'Lora', serif;
  font-size: 1rem;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-color);
  outline: none;
  transition: border-color 0.3s;
}

.search-input:focus {
  border-color: var(--accent-color);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-text);
  font-size: 1.1rem;
}

/* Filter tags row */
.tags-wrapper {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.tag-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.45rem 1rem;
  border-radius: 100px;
  background: var(--tag-bg);
  color: var(--tag-color);
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.tag-btn:hover,
.tag-btn.active {
  background: var(--accent-color);
  color: #fff;
}

/* Bibliography list */
.bib-list {
  list-style: none;
}

.bib-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--card-border);
  transition: opacity 0.3s;
}

.bib-item.hidden {
  display: none;
}

.bib-item-type {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  margin-bottom: 0.3rem;
}

.bib-item-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.bib-item-title a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s;
}

.bib-item-title a:hover {
  color: var(--accent-color);
}

.bib-item-authors {
  font-size: 0.9rem;
  color: var(--muted-text);
  font-style: italic;
}

.bib-item-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.bib-item-tag {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--tag-bg);
  color: var(--tag-color);
}

/* ============================================================
   TRAJETÓRIA SECTION (#trajetoria)
   Vertical timeline with scroll-triggered entrance animations.
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 3rem;
  max-width: 750px;
  margin: 0 auto;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--timeline-line);
}

/* Individual timeline entry */
.timeline-item {
  position: relative;
  padding-bottom: 3rem;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Timeline dot */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -3rem;
  top: 0.4rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-color);
  transform: translateX(-50%) translateX(0.5px);
}

.timeline-year {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timeline-desc {
  font-size: 0.95rem;
  color: var(--muted-text);
  line-height: 1.7;
}

/* ============================================================
   TERMINAL EASTER EGG (#terminal-overlay)
   Full-screen retro-green terminal overlay.
   ============================================================ */
.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.97);
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.terminal-overlay.open {
  transform: translateY(0);
}

.terminal-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #00ff41;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #00ff41;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Terminal scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 4px;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 65, 0.3);
  border-radius: 2px;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #00ff41;
}

.terminal-input-line span {
  opacity: 0.6;
}

.terminal-input {
  background: none;
  border: none;
  outline: none;
  color: #00ff41;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  flex: 1;
  caret-color: #00ff41;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: 3rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: var(--muted-text);
  letter-spacing: 0.05em;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section entrance — starts hidden, revealed by IntersectionObserver */
.section-inner {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

.section-inner.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   RESPONSIVE — Mobile adjustments (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  .hero-quote {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  .lab-card {
    padding: 1.8rem;
  }

  .timeline {
    padding-left: 2rem;
  }

  .timeline-item::before {
    left: -2rem;
  }

  .timeline::before {
    left: 0;
  }

  .section {
    padding: clamp(5rem, 10vh, 8rem) 1.2rem clamp(3rem, 6vh, 5rem);
  }
}

/* ============================================================
   NOVOS COMPONENTES — Estrutura de várias páginas
   Acrescentado à folha original. Usa as mesmas variáveis de cor
   da "luz dinâmica", então acompanha o tema por horário.
   ============================================================ */

/* ── Cabeçalho das páginas de acervo ──────────────────────── */
/* Reaproveita .section / .section-inner. Este bloco só adiciona
   um respiro extra no topo e centraliza o texto introdutório.   */
.pagina-acervo .section {
  min-height: auto;
}

.acervo-intro {
  max-width: 680px;
  margin: 0 0 2.5rem;
  color: var(--muted-text);
  font-size: 1rem;
  line-height: 1.7;
}

/* ── Blocos de destaque na página inicial ─────────────────── */
.destaque-bloco {
  padding: clamp(4rem, 9vh, 7rem) clamp(1.5rem, 5vw, 4rem);
}

.destaque-bloco:first-of-type {
  padding-top: clamp(2rem, 5vh, 4rem);
}

/* Cabeçalho do bloco: título à esquerda, "Ver todos" à direita */
.destaque-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.destaque-header .section-subtitle,
.destaque-header .section-title {
  margin-bottom: 0;
}

/* ── Botão "Ver todos" ────────────────────────────────────── */
.btn-ver-todos {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-ver-todos:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateX(2px);
}

/* Versão centralizada, usada abaixo das listas de destaque */
.ver-todos-centro {
  text-align: center;
  margin-top: 2.5rem;
}

/* ── Estado vazio (busca/filtro sem resultado) ────────────── */
.acervo-vazio {
  padding: 2.5rem 0;
  color: var(--muted-text);
  font-style: italic;
  text-align: center;
}

/* ── Grade de apps reaproveita .lab-grid. Na home, deixamos os
   cards um pouco mais estreitos para caberem lado a lado.       */
.destaque-bloco .lab-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

/* ── Ajuste responsivo dos novos blocos ───────────────────── */
@media (max-width: 768px) {
  .destaque-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }
}
