:root {
  --bg: #050a14;
  --indigo: #1e3a8a;
  --sky: #3b82f6;
  --text: #F4F4F8;
  --muted: #CBD5E1;
  --muted-dim: #94A3B8;
  --glass-bg: rgba(10, 20, 35, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.12);
  --shadow-glow: rgba(59, 130, 246, 0.25);
  
  /* Animações */
  --transition-smooth: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(ellipse at 30% 10%, #0d1b2e 0%, var(--bg) 55%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}

/* =====================================================
   FUNDO WEBGL
   ===================================================== */
#bg-mesh {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  display: block;
  pointer-events: none;
  will-change: transform;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(5, 10, 20, 0.15) 0%,
    rgba(5, 10, 20, 0.55) 55%,
    rgba(5, 10, 20, 0.92) 100%);
}

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */
main {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 0;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sky);
  margin-bottom: 0.9rem;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
}

/* =====================================================
   HERO
   ===================================================== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
}

.hero h1 {
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
  background: linear-gradient(120deg, #ffffff 30%, var(--sky) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .tagline {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 460px;
  margin-bottom: 2.1rem;
}

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn:hover::after {
  transform: translateX(100%);
}

.btn-primary {
  background: linear-gradient(120deg, var(--indigo), var(--sky));
  color: #fff;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(59, 130, 246, 0.45);
}

.btn-primary:active {
  transform: translateY(0px) scale(0.98);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--glass-hover);
}

.btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

/* =====================================================
   TILE ELÁSTICO
   ===================================================== */
.hero-visual {
  display: flex;
  justify-content: center;
}

.elastic-tile {
  position: relative;
  width: min(420px, 90vw);
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  cursor: grab;
  touch-action: none;
  background: linear-gradient(140deg, rgba(30, 58, 138, 0.25), rgba(59, 130, 246, 0.2));
  will-change: transform;
}

.elastic-tile:active {
  cursor: grabbing;
}

.elastic-tile canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.elastic-tile-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 20, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1;
  transition: opacity 0.5s ease;
}

.elastic-tile-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================
   PROJECTS
   ===================================================== */
h2 {
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.01em;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.project-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.85rem;
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  transition: transform 0.25s var(--transition-bounce), 
              border-color 0.25s ease,
              box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.project-card:active {
  transform: translateY(-2px) scale(0.98);
}

.project-card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.project-card h3 {
  font-size: 1.2rem;
}

.status {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sky);
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.project-card p {
  color: var(--muted-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.1rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: 'Space Mono', monospace;
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text);
  transition: all 0.2s ease;
}

.tag:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-hover);
}

/* =====================================================
   ABOUT
   ===================================================== */
.about-text {
  max-width: 640px;
  color: var(--muted-dim);
  font-size: 1.02rem;
  line-height: 1.75;
  margin: 1.5rem 0 2rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.skill-tags .tag {
  font-size: 0.7rem;
  padding: 0.4rem 0.85rem;
}

/* =====================================================
   TECH GRID
   ===================================================== */
.tech-section-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sky);
  margin-top: 3rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.tech-section-title::before {
  content: '';
  display: inline-block;
  width: 30px;
  height: 2px;
  background: var(--sky);
  flex-shrink: 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.skill-item {
  background: rgba(10, 20, 35, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0.8rem;
  transition: all 0.3s var(--transition-bounce);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.skill-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(59, 130, 246, 0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.skill-item:hover::before {
  transform: translateX(100%);
}

.skill-item:hover {
  background: rgba(30, 58, 138, 0.3);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.skill-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.8rem;
  object-fit: contain;
}

.skill-name {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted-dim);
  text-align: center;
  letter-spacing: 0.03em;
}

/* =====================================================
   CONTACT
   ===================================================== */
#contact {
  align-items: flex-start;
  text-align: left;
}

#contact .tagline {
  color: var(--muted-dim);
  max-width: 460px;
  margin: 1rem 0 1.8rem;
  line-height: 1.6;
}

.social-row {
  display: flex;
  gap: 1.4rem;
  margin-top: 1.6rem;
  flex-wrap: wrap;
}

.social-row a {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  padding-bottom: 2px;
}

.social-row a:hover {
  color: var(--text);
  border-color: var(--sky);
  transform: translateY(-1px);
}

/* =====================================================
   FOOTER
   ===================================================== */
footer {
  text-align: center;
  padding: 2rem 0 160px;
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: rgba(156, 163, 175, 0.6);
}

/* =====================================================
   TOAST
   ===================================================== */
.dock-toast {
  position: fixed;
  bottom: 122px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 18, 30, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2000;
  white-space: nowrap;
  user-select: none;
}

.dock-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================
   DOCK
   ===================================================== */
.dock-wrapper {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 1000;
}

.dock-outer {
  display: flex;
  max-width: 100%;
  align-items: flex-end;
  pointer-events: auto;
  transition: height 0.2s var(--transition-bounce);
  height: 80px;
  padding: 0 12px;
}

.dock-panel {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: fit-content;
  gap: 0.5rem;
  border-radius: 24px;
  background: rgba(8, 15, 30, 0.85);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 1rem 0.6rem;
  height: 80px;
  transition: height 0.25s var(--transition-bounce),
              padding 0.25s var(--transition-bounce);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5),
              0 0 60px rgba(30, 58, 138, 0.05),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  min-width: 180px;
}

.dock-panel.expanded {
  height: 130px;
  padding-bottom: 0.8rem;
}

.dock-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  width: 58px;
  height: 58px;
  transition: width 0.08s var(--transition-bounce),
              height 0.08s var(--transition-bounce);
  flex-shrink: 0;
  padding: 0;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.dock-item::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.25s ease;
}

.dock-item:hover::before {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.dock-item:focus-visible::before {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.85);
}

.dock-item:active {
  transform: scale(0.92);
  transition-duration: 0.05s;
}

.dock-item.magnified {
  z-index: 10;
}

.dock-item.magnified::before {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.dock-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: width 0.08s var(--transition-bounce),
              height 0.08s var(--transition-bounce);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.dock-item.magnified .dock-icon svg {
  width: 36px;
  height: 36px;
}

.dock-label {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) scale(0.9) translateY(8px);
  white-space: nowrap;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.35rem 0.9rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.2px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--transition-bounce);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dock-item:hover .dock-label,
.dock-item:focus-visible .dock-label {
  opacity: 1;
  transform: translateX(-50%) scale(1) translateY(0);
}

.dock-separator {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  align-self: center;
  flex-shrink: 0;
  margin: 0 2px;
}

.dock-item .active-dot {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transition: all 0.3s var(--transition-bounce);
}

.dock-item.active .active-dot {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.dock-item::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 30%;
  right: 30%;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dock-item.active::after {
  opacity: 1;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero .tagline {
    margin-left: auto;
    margin-right: auto;
  }
  
  .cta-row {
    justify-content: center;
  }
  
  #contact {
    align-items: center;
    text-align: center;
  }
  
  #contact .tagline {
    margin-left: auto;
    margin-right: auto;
  }
  
  .social-row {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .dock-wrapper {
    bottom: 16px;
  }
  
  .dock-panel {
    gap: 0.3rem;
    padding: 0 0.5rem 0.5rem;
    min-width: 140px;
    border-radius: 18px;
    height: 68px;
  }
  
  .dock-item {
    width: 48px;
    height: 48px;
  }
  
  .dock-item .dock-icon svg {
    width: 22px;
    height: 22px;
  }
  
  .dock-item.magnified .dock-icon svg {
    width: 30px;
    height: 30px;
  }
  
  .dock-panel.expanded {
    height: 110px;
    padding-bottom: 0.6rem;
  }
  
  .dock-label {
    font-size: 0.6rem;
    padding: 0.2rem 0.6rem;
    bottom: calc(100% + 12px);
  }
  
  .dock-separator {
    height: 28px;
  }
  
  .dock-outer {
    height: 68px;
  }
  
  .section {
    padding: 5rem 0;
  }
  
  .project-grid {
    grid-template-columns: 1fr;
  }
  
  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
  }
  
  .elastic-tile {
    width: 85vw;
  }
}

/* =====================================================
   UTILITÁRIOS
   ===================================================== */
.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;
}

/* =====================================================
   ANIMAÇÕES DE ENTRADA
   ===================================================== */
.reveal-left,
.reveal-right {
  opacity: 0;
  transform: translateY(20px);
  animation: reveal 0.6s ease forwards;
}

.reveal-left {
  animation-delay: 0.1s;
}

.reveal-right {
  animation-delay: 0.2s;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   REDUZIDO
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation: none !important;
    transition: none !important;
  }
  
  .section {
    opacity: 1;
    transform: none;
  }
  
  .reveal-left,
  .reveal-right {
    opacity: 1;
    transform: none;
    animation: none;
  }
  
  .btn::after {
    display: none;
  }
  
  .skill-item::before {
    display: none;
  }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar {
  display: none;
}

* {
  scrollbar-width: none;
}