/* ===================================================================
   Jonathan Barboza Portfolio — Style
   Inspired by bencodes.de
   =================================================================== */

/* --- CSS Variables --- */
:root {
  --dark: #000000;
  --light: #ffffff;
  --gray-4: #1c1c1c;
  --gray-3: #666666;
  --gray-2: #888888;
  --gray-1: #b0b0b0;
  --svg-line: rgba(255,255,255,0.06);
  --svg-line-light: rgba(0,0,0,0.06);
  --accent-1: #b1afff;
  --accent-2: #bbe9ff;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
  scroll-behavior: auto; /* We handle smooth scroll in JS */
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--dark);
  color: var(--light);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}

ul, ol { list-style: none; }

/* --- Grid Overlay --- */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 0 8%;
}

.grid-line {
  width: 1px;
  height: 100%;
  background: var(--svg-line);
  transition: background 0.6s ease;
}

body.theme-light .grid-line {
  background: var(--svg-line-light);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 5%;
}

/* --- Section Base --- */
.section {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px 0;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 5%;
  transition: color 0.4s ease;
}

.site-header.light-mode {
  color: var(--dark);
}

.header-logo {
  display: flex;
  align-items: center;
  transition: color 0.4s ease;
}

/* SVG Logo draw animation */
.logo-svg {
  overflow: visible;
}

.logo-path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: logoDraw 2s ease forwards 0.3s;
}

@keyframes logoDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.header-menu-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  padding: 8px 20px;
  border-radius: 9999px;
  border: 1px solid currentColor;
  transition: all 0.3s ease;
}

.header-menu-btn:hover {
  background: var(--light);
  color: var(--dark);
}

.site-header.light-mode .header-menu-btn:hover {
  background: var(--dark);
  color: var(--light);
}

/* --- Side Drawer --- */
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 85vw;
  height: 100vh;
  background: var(--dark);
  color: var(--light);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.5s var(--transition-smooth);
  display: flex;
  flex-direction: column;
  padding: 80px 40px 40px;
  overflow-y: auto;
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 28px;
  right: 28px;
  font-size: 1.5rem;
  padding: 8px;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.drawer-close:hover {
  opacity: 0.6;
}

.drawer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.drawer-link {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 600;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-4);
  transition: all 0.3s ease;
  position: relative;
  display: block;
}

.drawer-link:hover {
  padding-left: 16px;
  color: var(--gray-1);
}

.drawer-social {
  display: flex;
  gap: 24px;
  padding-top: 32px;
  border-top: 1px solid var(--gray-4);
  margin-top: auto;
}

.drawer-social-link {
  font-size: 0.875rem;
  color: var(--gray-2);
  transition: color 0.3s ease;
}

.drawer-social-link:hover {
  color: var(--light);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* --- Hero --- */
.section-hero {
  background: radial-gradient(circle at 50% 50%, #111111 0%, #000000 65%);
  align-items: center;
  text-align: center;
  padding-bottom: 60px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-label {
  margin-bottom: 4vh;
}

.hero-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(3rem, 12vw, 7.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(0.8rem, 2vw, 1.125rem);
  color: var(--gray-1);
  margin-top: 3vh;
  max-width: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.subtitle-role {
  display: inline-block;
  opacity: 0.4;
  transition: opacity 0.5s ease;
}

.subtitle-role.sweep-active {
  opacity: 1;
}

.subtitle-dot {
  color: var(--gray-3);
  user-select: none;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--gray-2);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: var(--gray-3);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.5); opacity: 0.3; }
}

/* --- Pills --- */
.pill {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  background: var(--gray-4);
  color: var(--gray-1);
  border: 1px solid transparent;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  white-space: nowrap;
  cursor: default;
}

.skill-pills .pill:hover {
  transform: translateY(-2px) scale(1.04);
  background: #2a2a2a;
  color: var(--light);
  box-shadow: 0 4px 20px rgba(177, 175, 255, 0.15);
  border-color: rgba(177, 175, 255, 0.25);
}

body.theme-light .skill-pills .pill:hover {
  transform: translateY(-2px) scale(1.04);
  background: #e0e0ff;
  color: var(--dark);
  box-shadow: 0 4px 20px rgba(177, 175, 255, 0.25);
  border-color: rgba(177, 175, 255, 0.4);
}

.pill-outline {
  background: transparent;
  border-color: var(--gray-2);
  color: var(--gray-1);
}

body.theme-light .pill {
  background: #f0f0f0;
  color: var(--gray-3);
}

body.theme-light .pill-outline {
  background: transparent;
  border-color: var(--gray-3);
  color: var(--gray-3);
}

/* --- About --- */
.section-about {
  min-height: auto;
  padding: 15vh 0;
}

.about-label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--gray-2);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 40px;
}

.about-text {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  line-height: 1.3;
  color: var(--light);
  max-width: 850px;
}

.about-text em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-body {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--gray-1);
  max-width: 700px;
  margin-top: 32px;
  line-height: 1.7;
}

/* --- Skills --- */
.section-skills {
  min-height: auto;
  padding: 12vh 0;
  transition: background-color 0.6s ease, color 0.6s ease;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--gray-2);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 48px;
}

.section-label-dark {
  color: var(--gray-3);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px 64px;
}

.skill-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 16px;
  color: var(--light);
  transition: color 0.4s ease;
}

body.theme-light .skill-title {
  color: var(--dark);
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Projects --- */
.section-projects {
  background: var(--light);
  color: var(--dark);
  padding: 14vh 0;
  min-height: auto;
}

.projects-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--dark);
}

.project-item:first-child {
  border-top: 1px solid #e0e0e0;
}

.project-item:hover {
  padding-left: 16px;
  padding-right: 16px;
}

.project-item:hover .project-num {
  color: var(--gray-2);
}

.project-item:hover .project-arrow {
  transform: translate(4px, -4px);
}

.project-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.project-num {
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 0.875rem;
  color: var(--gray-3);
  transition: color 0.3s ease;
}

.project-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-tag {
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 9999px;
  border: 1px solid #d0d0d0;
  color: var(--gray-3);
  transition: border-color 0.3s ease;
}

.project-item:hover .project-tag {
  border-color: var(--gray-2);
}

.project-arrow {
  font-size: 1.25rem;
  margin-left: 8px;
  transition: transform 0.3s ease;
}

/* --- Project Preview (mouse-following) --- */
.project-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 380px;
  height: 220px;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transition: opacity 0.25s ease;
  will-change: transform;
}

.project-preview.visible {
  opacity: 1;
}

.project-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* --- Contact --- */
.section-contact {
  min-height: auto;
  padding: 0;
}

.contact-bg {
  position: relative;
  overflow: hidden;
  background: var(--light);
  padding: 14vh 0;
}

.contact-bg::before {
  content: '';
  position: absolute;
  left: -30%;
  bottom: -40%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, var(--accent-1), transparent 60%);
  filter: blur(120px);
  opacity: 0.5;
}

.contact-bg::after {
  content: '';
  position: absolute;
  right: -20%;
  top: -30%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, var(--accent-2), transparent 60%);
  filter: blur(120px);
  opacity: 0.5;
}

.contact-inner {
  position: relative;
  z-index: 2;
  text-align: center;
}

.contact-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.15;
  color: var(--dark);
  margin-bottom: 48px;
}

.contact-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 9999px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--dark);
  color: var(--light);
}

.btn-primary:hover {
  background: #222;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-arrow {
  transition: transform 0.3s ease;
  font-size: 1.2em;
}

.btn-outline-dark {
  background: transparent;
  color: var(--dark);
  border: 1.5px solid var(--dark);
}

.btn-outline-dark:hover {
  background: var(--dark);
  color: var(--light);
}

/* --- Footer --- */
.site-footer {
  background: var(--light);
  color: var(--dark);
  padding: 40px 0;
  border-top: 1px solid #e0e0e0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--gray-3);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--gray-3);
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--dark);
}

/* ===================================================================
   ANIMATIONS
   =================================================================== */

/* Reveal word (hero name) */
.anim-reveal-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth);
}

.anim-reveal-word.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Generic reveal */
.anim-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--transition-smooth), transform 0.7s var(--transition-smooth);
}

.anim-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Fade up (scroll triggered) */
.anim-fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--transition-smooth), transform 0.7s var(--transition-smooth);
}

.anim-fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.skill-group:nth-child(1) { transition-delay: 0ms; }
.skill-group:nth-child(2) { transition-delay: 80ms; }
.skill-group:nth-child(3) { transition-delay: 160ms; }
.skill-group:nth-child(4) { transition-delay: 240ms; }
.skill-group:nth-child(5) { transition-delay: 320ms; }
.skill-group:nth-child(6) { transition-delay: 400ms; }

.project-item:nth-child(1) { transition-delay: 0ms; }
.project-item:nth-child(2) { transition-delay: 80ms; }
.project-item:nth-child(3) { transition-delay: 160ms; }
.project-item:nth-child(4) { transition-delay: 240ms; }

/* ===================================================================
   THEME TRANSITION (dark → light)
   =================================================================== */
body.theme-light {
  background-color: var(--light);
}

.section-skills {
  transition: background-color 0.8s ease, color 0.8s ease;
}

body.theme-light .section-skills {
  background: var(--light);
  color: var(--dark);
}

body.theme-light .section-label {
  color: var(--gray-3);
}

body.theme-light .about-label {
  color: var(--gray-3);
}

body.theme-light .about-text {
  color: var(--dark);
}

body.theme-light .about-body {
  color: var(--gray-3);
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 768px) {
  .hero-name {
    font-size: clamp(2.5rem, 14vw, 5rem);
  }
  
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .project-meta {
    display: none;
  }
  
  .project-name {
    font-size: 1.25rem;
  }
  
  .contact-heading {
    font-size: 2rem;
  }
  
  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .section {
    padding: 80px 0;
  }

  .project-preview {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-subtitle {
    font-size: 0.82rem;
    padding: 0 16px;
  }

  .contact-actions {
    flex-direction: column;
    align-items: center;
  }

  .drawer-link {
    font-size: 1.5rem;
  }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--dark);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-3);
  border-radius: 3px;
}

body.theme-light::-webkit-scrollbar-track {
  background: var(--light);
}

/* --- Selection --- */
::selection {
  background: var(--accent-1);
  color: var(--dark);
}
