/* =============================================
   TOKENS
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0A192F;
  --bg-sidebar:   #0A192F;
  --surface:      #112240;
  --border:       #1E3A5F;

  --text:         #CCD6F6;
  --text-2:       #8892B0;
  --text-3:       #5A6480;
  --text-bright:  #E6F1FF;

  --accent:       #F1F5F9;
  --accent-dim:   rgba(148, 163, 184, 0.14);

  --hover:        #7DD3FC;
  --hover-dim:    rgba(125, 211, 252, 0.16);

  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-2);
  line-height: 1.7;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

/* =============================================
   SPOTLIGHT — brilho azul que segue o cursor
   ============================================= */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 0%),
    rgba(29, 78, 216, 0.15),
    transparent 80%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}
.spotlight.is-active { opacity: 1; }

/* =============================================
   LAYOUT GERAL
   ============================================= */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 4rem;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2.5rem;
  min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: 44%;
  max-width: 500px;
  min-width: 340px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

/* seletor de idioma */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  margin-bottom: 1.75rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 34, 64, 0.6);
}
.lang-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: none;
  border: none;
  padding: 0.1rem 0.25rem;
  cursor: pointer;
  transition: color 0.2s ease;
}
.lang-btn:hover { color: var(--hover); }
.lang-btn.is-active { color: var(--text-bright); }
.lang-sep { color: var(--text-3); font-size: 0.72rem; }

.sidebar-top { margin-bottom: 2rem; }

.sidebar-name {
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 0.9rem;
}

.sidebar-role {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.sidebar-desc {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 340px;
}

/* NAV */
.sidebar-nav ul { display: flex; flex-direction: column; gap: 1.25rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0;
  group: nav;
}

.nav-line {
  height: 1px;
  width: 24px;
  background: var(--text-3);
  margin-right: 0.9rem;
  transition: width 0.25s ease, background 0.25s ease;
}

.nav-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  transition: color 0.25s ease;
}

.nav-link:hover .nav-line,
.nav-link.active .nav-line {
  width: 48px;
  background: var(--accent);
}
.nav-link:hover .nav-text,
.nav-link.active .nav-text {
  color: var(--text-bright);
}
.nav-link:hover .nav-line { background: var(--hover); }
.nav-link:hover .nav-text { color: var(--hover); }

/* BOTTOM: socials fixadas no rodapé da sidebar */
.sidebar-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.sidebar-nav { margin-top: 3rem; }
.sidebar-bottom { margin-top: auto; padding-top: 3rem; }

.sidebar-socials { display: flex; gap: 1.4rem; align-items: center; }
.sidebar-socials a { color: var(--text-2); transition: color 0.2s ease, transform 0.2s ease; display: flex; }
.sidebar-socials a:hover { color: var(--hover); transform: translateY(-3px); }

/* icones com desenho mais baixo (YouTube, envelope): escala optica p/ igualar aos demais */
.sidebar-socials .icon-wide svg { transform: scale(1.2); transform-origin: center; }
.sidebar-socials .icon-mail svg { transform: scale(1.28); }

/* =============================================
   MOBILE MENU BUTTON (escondido no desktop)
   ============================================= */
.mobile-menu-btn { display: none; }

/* =============================================
   CONTEÚDO
   ============================================= */
.content {
  flex: 1;
  min-width: 0;
  padding: 5rem 0 8rem;
  max-width: 620px;
}

.mobile-label { display: none; }

.content-section {
  padding-bottom: 6rem;
  scroll-margin-top: 2rem;
}
.content-section:last-of-type { padding-bottom: 3rem; }

.prose p {
  color: var(--text-2);
  font-size: 1rem;
  margin-bottom: 1.15rem;
}
.prose strong { color: var(--text-bright); font-weight: 600; }
.prose p:last-child { margin-bottom: 0; }

/* =============================================
   EXPERIÊNCIA (Timeline)
   ============================================= */
.timeline { display: flex; flex-direction: column; }

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  margin: 0 -1.5rem;
  border-radius: 8px;
  transition: background 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
  cursor: default;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  padding-top: 0.2rem;
  white-space: nowrap;
}

.timeline-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.6rem;
}

.timeline-desc { font-size: 0.92rem; color: var(--text-2); margin-bottom: 0.9rem; }

.timeline-tags { display: flex; flex-wrap: wrap; }
.timeline-tags li {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin: 0 0.5rem 0.5rem 0;
  transition: color 0.25s ease, background 0.25s ease;
}

/* =============================================
   PROJETOS
   ============================================= */
.projects { display: flex; flex-direction: column; }

.project-row {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1.25rem;
  padding: 1.5rem;
  margin: 0 -1.5rem;
  border-radius: 8px;
  transition: background 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.project-icon {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.project-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
  transition: color 0.2s ease;
}
.project-arrow { color: var(--text-2); transition: transform 0.25s ease, color 0.25s ease; }

.project-desc { font-size: 0.92rem; color: var(--text-2); margin-bottom: 0.9rem; }

.project-tags { display: flex; flex-wrap: wrap; }
.project-tags li {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin: 0 0.5rem 0.5rem 0;
  transition: color 0.25s ease, background 0.25s ease;
}

/* =============================================
   HOVER DAS LISTAS (card em destaque, irmãos esmaecidos)
   ============================================= */
@media (hover: hover) and (pointer: fine) and (min-width: 861px) {
  .timeline:hover .timeline-row,
  .projects:hover .project-row { opacity: 0.5; }

  .timeline .timeline-row:hover,
  .projects .project-row:hover,
  .timeline .timeline-row:focus-within,
  .projects .project-row:focus-within {
    opacity: 1;
    background: rgba(17, 34, 64, 0.65);
    box-shadow:
      inset 0 1px 0 0 rgba(148, 163, 184, 0.12),
      0 10px 24px -12px rgba(2, 12, 27, 0.9);
  }

  .timeline .timeline-row:hover .timeline-title,
  .projects .project-row:hover .project-title { color: var(--hover); }

  .timeline .timeline-row:hover .timeline-tags li,
  .projects .project-row:hover .project-tags li {
    color: var(--hover);
    background: var(--hover-dim);
  }

  .projects .project-row:hover .project-icon {
    color: var(--hover);
    border-color: rgba(125, 211, 252, 0.4);
    background: var(--hover-dim);
  }

  .projects .project-row:hover .project-arrow {
    color: var(--hover);
    transform: translate(3px, -3px);
  }
}

/* fallback: telas menores / sem hover fino */
@media not all and (hover: hover) {
  .timeline-row:hover, .project-row:hover { background: var(--surface); }
}

/* =============================================
   STACK
   ============================================= */
.stack-groups { display: flex; flex-direction: column; gap: 1.5rem; }

.stack-group {
  padding: 1.1rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.stack-group h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.stack-group p { font-size: 0.9rem; color: var(--text-2); }

/* =============================================
   CONTATO
   ============================================= */
.contact-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin-bottom: 0.9rem;
}
.contact-desc {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 1.75rem;
  max-width: 30rem;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: rgba(17, 34, 64, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1.15rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.contact-btn:hover {
  color: var(--hover);
  border-color: rgba(125, 211, 252, 0.45);
  background: var(--hover-dim);
  transform: translateY(-2px);
}

/* =============================================
   FOOTER
   ============================================= */
.content-footer {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-3);
  padding-top: 1rem;
  max-width: 34rem;
}
.content-footer strong {
  font-weight: 600;
  color: var(--text);
}
.content-footer a {
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}
.content-footer a:hover { color: var(--hover); }

/* =============================================
   FORM (contato — se necessário no futuro) placeholder
   ============================================= */

/* =============================================
   PORTAL (easter egg)
   ============================================= */
.portal-trigger {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(17, 34, 64, 0.75);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}
.portal-trigger:hover {
  border-color: rgba(125, 211, 252, 0.5);
  background: rgba(17, 34, 64, 0.95);
  transform: translateY(-2px);
}
/* miniatura do portal dentro do botao flutuante */
.portal-trigger .portal-mini {
  position: relative;
  inset: auto;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #020c1b;
  font-size: 8.5px;           /* blob = 3em = 25px, menor que o disco: da pra ver girar */
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.35), 0 0 12px rgba(56, 189, 248, 0.35);
  animation: mini-pulse 2.8s ease-out infinite;
}
.portal-trigger .portal-mini .portal-blob { box-shadow: 0 0 .35em .12em #000 inset, 0 0 .1em 0 #fff; }

@keyframes mini-pulse {
  0%   { box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.35), 0 0 0 0 rgba(125, 211, 252, 0.45); }
  70%  { box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.35), 0 0 0 11px rgba(125, 211, 252, 0); }
  100% { box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.35), 0 0 0 0 rgba(125, 211, 252, 0); }
}

/* overlay */
.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(2, 12, 27, 0.82);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.portal-overlay.is-open { opacity: 1; }
.portal-overlay[hidden] { display: none; }

.portal-close {
  position: absolute;
  top: 1.6rem;
  right: 1.8rem;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  transition: color 0.2s ease, transform 0.2s ease;
}
.portal-close:hover { color: var(--hover); transform: rotate(90deg); }

/* aneis */
.portal {
  position: relative;
  width: min(78vmin, 640px);
  height: min(78vmin, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.86);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(.2,.9,.3,1.2), opacity 0.4s ease;
}
.portal-overlay.is-open .portal { transform: scale(1); opacity: 1; }

/* blobs do portal — adaptado do CodePen "A Portal to Tomorrow" (@jasesmith),
   com a matiz presa na faixa azul/ciano da paleta do site */
.portal-blobs {
  position: absolute;
  inset: 0;
  font-size: min(23vmin, 190px);
  isolation: isolate;
  pointer-events: none;
}
.portal-blob {
  --speed: 150ms;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3em;
  height: 3em;
  border-radius: 90% 95% 85% 105%;
  background: #2563EB;
  mix-blend-mode: screen;
  box-shadow: 0 0 .5em .2em #000 inset, 0 0 .15em 0 #fff;
  transform: translate(var(--x), var(--y)) rotate(0deg);
  animation: portal-wobble calc(var(--speed) * var(--t)) linear infinite;
}
.portal-blob:nth-child(1) { --x: -53%; --y: -53%; --t: 37; }
.portal-blob:nth-child(2) { --x: -47%; --y: -52%; --t: 58; }
.portal-blob:nth-child(3) { --x: -45%; --y: -50%; --t: 46; }
.portal-blob:nth-child(4) { --x: -53%; --y: -45%; --t: 72; }
.portal-blob:nth-child(5) { --x: -55%; --y: -45%; --t: 62; }

@keyframes portal-wobble {
  0%   { filter: hue-rotate(-14deg) saturate(1.05); transform: translate(var(--x), var(--y)) rotate(0deg); }
  50%  { filter: hue-rotate(14deg) saturate(1.05); }
  100% { filter: hue-rotate(-14deg) saturate(1.05); transform: translate(var(--x), var(--y)) rotate(360deg); }
}

.portal-core {
  position: relative;
  z-index: 2;
  width: 74%;
  height: 74%;
  border-radius: 50%;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 2rem;
  text-align: center;
}
.portal-heading {
  font-size: clamp(1rem, 2.1vw, 1.35rem);
  font-weight: 800;
  color: #04203a;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 0.8rem;
  width: min(100%, 360px);
}
.portal-card {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.25);
  background: rgba(10, 25, 47, 0.8);
  transform: perspective(900px) rotateX(6deg) rotateY(var(--tilt, 0deg));
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(.2,.8,.25,1), border-color 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
  filter: brightness(0.8);
}
.portal-card:nth-child(1) { --tilt: 9deg; }
.portal-card:nth-child(2) { --tilt: -9deg; }
.portal-card:nth-child(3) { grid-column: 1 / -1; width: 60%; margin: 0 auto; --tilt: 0deg; }
.portal-card img { display: block; width: 100%; height: auto; }
.portal-card:hover,
.portal-card:focus-visible {
  transform: perspective(900px) rotateX(0deg) rotateY(0deg) translateY(-6px) scale(1.06);
  border-color: rgba(125, 211, 252, 0.7);
  box-shadow: 0 18px 34px -16px rgba(2, 12, 27, 0.95);
  filter: brightness(1);
  z-index: 3;
}

/* sem mouse (toque) ou movimento reduzido: cartoes sempre em pe */
@media (hover: none), (pointer: coarse) {
  .portal-card { --tilt: 0deg; filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-card { transform: none; filter: none; }
}

body.portal-open { overflow: hidden; }

@media (max-width: 860px) {
  .portal-overlay { padding: 1rem; }
  .portal-close { top: 0.9rem; right: 1rem; }
  .portal-trigger { right: 1.1rem; bottom: 1.1rem; }
  .portal { width: 94vmin; height: 94vmin; }
  .portal-core { width: 88%; height: 88%; gap: 0.9rem; padding: 1rem; }
  /* no celular a luz precisa cobrir todo o miolo, senao o conteudo escapa do disco */
  .portal-blobs { font-size: 30vmin; }
}

/* celulares: conteudo compacto para caber dentro do circulo */
@media (max-width: 640px) {
  .portal-heading { font-size: 0.95rem; line-height: 1.3; }
  .portal-grid { width: min(100%, 232px); gap: 0.45rem 0.4rem; }
  .portal-card { border-radius: 6px; }
}

@media (max-width: 400px) {
  .portal-core { gap: 0.6rem; padding: 0.7rem; }
  .portal-heading { font-size: 0.85rem; }
  .portal-grid { width: min(100%, 190px); gap: 0.35rem 0.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-trigger .portal-mini, .portal-blob { animation: none; }
}

/* =============================================
   RESPONSIVO
   ============================================= */
@media (max-width: 1080px) {
  .page { gap: 2.5rem; padding: 0 2rem; }
  .sidebar { width: 42%; min-width: 280px; padding: 4rem 0; }
  .content { padding: 4rem 0 6rem; }
}

@media (max-width: 860px) {
  .page { flex-direction: column; gap: 0; padding: 0; max-width: none; }

  .sidebar {
    position: relative;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: auto;
    padding: 2.5rem 2rem;
  }

  .sidebar-top { padding-right: 3.5rem; }

  .sidebar-nav { display: none; }
  .sidebar-nav.is-open { display: block; margin-top: 2rem; }
  .sidebar-nav.is-open ul { gap: 1rem; }
  .sidebar-nav.is-open .nav-text { font-size: 0.85rem; }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    height: 34px;
    background: none;
    border: none;
    position: absolute;
    top: 2rem;
    right: 2rem;
    cursor: pointer;
    padding: 8px;
    z-index: 5;
  }
  .mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--accent);
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .mobile-menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mobile-menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .mobile-menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .sidebar-inner { flex: none; }
  .sidebar-nav { margin-top: 0; }
  .sidebar-bottom { margin-top: 1.75rem; padding-top: 0; }
  .content { max-width: none; padding: 0 2rem 4rem; }
  .mobile-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent);
    padding-top: 3rem;
    margin-bottom: 1.5rem;
  }

  .timeline-row, .project-row { grid-template-columns: 1fr; margin: 0; }
  .project-row { grid-template-columns: 40px 1fr; }
  .timeline-date { padding-top: 0; margin-bottom: 0.4rem; }
}

/* sem spotlight em telas sem mouse (toque) */
@media (hover: none), (pointer: coarse) {
  .spotlight { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .spotlight { display: none; }
}
