/* Portfolio — David de Paula | Performance + responsive */
:root {
  --c-bg: #0b1120;
  --c-surface: #111827;
  --c-card: #1e293b;
  --c-border: rgba(148, 163, 184, 0.15);
  --c-accent: #22d3ee;
  --c-accent-2: #6366f1;
  --c-text: #f1f5f9;
  --c-muted: #94a3b8;
  --sidebar-w: 300px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font) !important;
  background: #f1f5f9;
  color: #334155;
  -webkit-font-smoothing: antialiased;
}

/* —— Sidebar —— */
#header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 9997;
  overflow-y: auto;
  padding: 0 15px;
  background: linear-gradient(180deg, var(--c-bg) 0%, var(--c-surface) 100%) !important;
  border-right: 1px solid var(--c-border);
  width: var(--sidebar-w);
  box-shadow: var(--shadow);
}

#header .profile img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 3px solid var(--c-accent) !important;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15);
}

#header .profile h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.75rem;
}

#header .profile h1 a {
  color: var(--c-text) !important;
  text-decoration: none;
}

#header .nav-menu a {
  padding: 0.65rem 1rem;
  margin: 2px 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

#header .nav-menu a:hover,
#header .nav-menu a.active {
  background: rgba(34, 211, 238, 0.1) !important;
  color: var(--c-accent) !important;
}

#header .nav-menu a i {
  font-size: 1.1rem;
  margin-right: 0.5rem;
}

#header .social-links a {
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  transition: transform 0.2s, background 0.2s;
}

#header .social-links a:hover {
  transform: translateY(-2px);
  background: rgba(34, 211, 238, 0.15);
  color: var(--c-accent) !important;
}

/* Main offset (template uses margin-left on #main) */
#main {
  margin-left: var(--sidebar-w);
}

/* —— Hero —— */
#hero.hero-modern {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0 3rem;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 45%, #0e7490 100%) !important;
  overflow: hidden;
}

.hero-lottie-inline {
  width: min(560px, 92vw);
  height: min(400px, 42vh);
  margin: 2rem auto 0;
  pointer-events: none;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-grid-bg {
    animation: gridFade 10s ease-in-out infinite;
  }
}

@keyframes gridFade {
  50% { opacity: 0.55; }
}

#hero .hero-container {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 900px;
}

#hero .hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 1rem;
}

#hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem) !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  color: #fff !important;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

#hero .hero-typed-line {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--c-muted);
  min-height: 2rem;
}

#hero .typed {
  color: var(--c-accent) !important;
  font-weight: 600;
}

.btn-hero-primary,
.btn-hero-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  margin: 0.35rem;
}

.btn-hero-primary {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
  color: #0f172a !important;
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.35);
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  color: #0f172a !important;
}

.btn-hero-ghost {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06);
}

.btn-hero-ghost:hover {
  border-color: var(--c-accent);
  color: var(--c-accent) !important;
}

/* —— Sections —— */
.section-title {
  padding-bottom: 1.5rem;
}

.section-title h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: #0f172a;
  position: relative;
  display: inline-block;
}

.section-title h2::after {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  margin-top: 0.5rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
}

.section-title p {
  color: #64748b;
  line-height: 1.7;
  max-width: 720px;
}

.about .content h3 {
  font-weight: 600;
  color: #0f172a;
}

.about .content ul li {
  padding: 0.35rem 0;
}

.link-tech {
  color: var(--c-accent-2) !important;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

/* —— Portfolio —— */
.portfolio .portfolio-wrap {
  overflow: hidden;
  border-radius: var(--radius);
}

.portfolio .custom-div {
  width: 100% !important;
  height: 200px !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  overflow: hidden;
  position: relative;
  background-color: var(--c-card);
  background-size: cover;
  background-position: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio .portfolio-wrap .portfolio-links {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.portfolio .portfolio-wrap:hover .portfolio-links {
  opacity: 1;
  pointer-events: auto;
}

.portfolio .portfolio-wrap .portfolio-links a {
  pointer-events: auto;
}

.portfolio .custom-div:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  border-color: var(--c-accent) !important;
}

.portfolio .div-title {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  font-size: 0.9rem !important;
  font-weight: 600;
  padding: 12px 14px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.92)) !important;
  text-transform: none !important;
  transform: none !important;
}

#portfolio-flters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}

#portfolio-flters li {
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background: #fff;
  transition: all 0.2s;
}

#portfolio-flters li.filter-active,
#portfolio-flters li:hover {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
  color: #0f172a !important;
  border-color: transparent;
}

.portfolio-item {
  margin-bottom: 1.5rem;
}

/* —— Skills —— */
.skills .progress {
  margin-bottom: 1.25rem;
}

.skills .progress-bar-wrap {
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.skills .progress-bar {
  width: 0;
  height: 10px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2)) !important;
  transition: width 1s ease;
}

.skills-details-list {
  list-style: none;
  padding: 1.5rem 0 0;
  margin: 0;
}

.skills-details-list li {
  padding: 0.65rem 0 0.65rem 1rem;
  border-left: 3px solid var(--c-accent);
  margin-bottom: 0.75rem;
}

.skills-details-list p {
  margin: 0;
  color: #334155;
  line-height: 1.6;
}

.skills-details-list strong {
  color: #0f172a;
}

.skills .skill {
  font-weight: 500;
  text-transform: none;
}

/* —— Facts —— */
.facts .count-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.facts .count-box:hover {
  transform: translateY(-4px);
}

.facts .count-box i {
  color: var(--c-accent-2) !important;
  font-size: 2rem;
}

.facts .count-box span {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
}

/* —— Contact —— */
.contact .info,
#myForm {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.contact .info i {
  color: var(--c-accent-2);
}

#myForm button[type="submit"] {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2)) !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 12px 32px !important;
  font-weight: 600;
  color: #0f172a !important;
}

.form-feedback {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 500;
  margin-top: 0.75rem;
}

.form-feedback.is-success {
  background: #dcfce7;
  color: #166534;
}

.form-feedback.is-error {
  background: #fee2e2;
  color: #991b1b;
}

.contact iframe[data-lazy-src],
.contact iframe[title="Mapa"] {
  display: block;
  width: 100%;
  height: 290px;
  min-height: 290px;
  max-height: 290px;
  background: #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
}

/* —— Footer —— */
.footer-bottom .developer-info {
  display: none;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--c-muted);
}

.footer-bottom .developer-info.active {
  display: block;
}

.texto-3d {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--c-accent) !important;
  text-shadow: none !important;
  background: rgba(34, 211, 238, 0.1);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  display: inline-block;
}

/* WhatsApp FAB */
.wa-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45);
  transition: transform 0.2s;
}

.wa-fab:hover {
  transform: scale(1.08);
  color: #fff !important;
}

.back-to-top {
  background: var(--c-accent-2) !important;
  border-radius: 10px !important;
}

/* —— Responsive —— */
@media (max-width: 1199px) {
  :root { --sidebar-w: 0px; }

  #header {
    left: -300px;
    width: 300px;
    transition: left 0.3s ease;
    z-index: 9997;
  }

  #header.header-show {
    left: 0;
  }

  #main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .mobile-nav-toggle {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 9998;
    background: var(--c-surface);
    color: var(--c-accent);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
  }

  #hero.hero-modern {
    min-height: 85vh;
    min-height: 85dvh;
  }

  .hero-lottie-inline {
    width: min(420px, 96vw);
    height: min(300px, 36vh);
    margin-top: 1.5rem;
  }

  .portfolio .custom-div {
    height: 180px !important;
  }

  .about .row {
    flex-direction: column-reverse;
  }

  .about img {
    max-width: 280px;
    margin: 0 auto 1.5rem;
    display: block;
  }
}

@media (max-width: 767px) {
  #hero h1 {
    font-size: 1.85rem !important;
  }

  .hero-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .btn-hero-primary,
  .btn-hero-ghost {
    width: 100%;
    justify-content: center;
  }

  #portfolio-flters li {
    font-size: 0.8rem;
    padding: 0.4rem 0.85rem;
  }

  .facts .count-box {
    margin-bottom: 1rem;
  }

  .contact .row > [class*="col-"] {
    margin-bottom: 1rem;
  }

  .wa-fab {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 480px) {
  .portfolio .custom-div {
    height: 160px !important;
  }

  .section-title h2 {
    font-size: 1.5rem;
  }
}

/* Performance: menos animação em mobile / reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

@media (max-width: 768px) {
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Desktop: sidebar sempre aberta (sobrescreve cache/CDN desatualizado) */
@media (min-width: 1200px) {
  :root { --sidebar-w: 300px; }

  #header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 300px !important;
    visibility: visible !important;
    transform: none !important;
  }

  #main {
    margin-left: 300px !important;
    width: auto !important;
  }

  .mobile-nav-toggle {
    display: none !important;
  }

  body.mobile-nav-active #header {
    left: 0 !important;
  }
}
