/* ========================================
   CSS Variables & Reset
   ======================================== */
:root {
  --color-bg: #fafafa;
  --color-bg-alt: #f0f0f0;
  --color-text: #1a1a1a;
  --color-text-secondary: #666666;
  --color-accent: #2d2d2d;
  --color-accent-light: #444444;
  --color-border: #e0e0e0;
  --color-card: #ffffff;
  --color-tag-bg: #f5f5f5;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --max-width: 1100px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ========================================
   Utility
   ======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 48px;
  letter-spacing: -0.5px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--color-accent);
}

.section-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 1rem;
}

/* ========================================
   Animations
   ======================================== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.slide-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   Navigation
   ======================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.nav.scrolled {
  border-bottom-color: var(--color-border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color 0.3s ease;
  letter-spacing: 0.3px;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ========================================
   Hero
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: var(--nav-height) 24px 0;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 0, 0, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 0, 0, 0.02) 0%, transparent 50%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hero-name {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--color-text-secondary);
  margin-bottom: 40px;
  font-weight: 400;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.btn-outline {
  border: 2px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-indicator span {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  position: relative;
}

.scroll-indicator span::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  animation: scrollDown 2s infinite;
}

@keyframes scrollDown {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

/* ========================================
   About
   ======================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p {
  margin-bottom: 16px;
  color: var(--color-text-secondary);
  font-size: 1.05rem;
}

.about-text strong {
  color: var(--color-text);
}

.about-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.detail-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  font-weight: 600;
}

.detail-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ========================================
   Experience Timeline
   ======================================== */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 11px;
  width: 2px;
  height: 100%;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -40px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  border: 3px solid var(--color-accent);
  z-index: 1;
}

.timeline-content {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-content:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.timeline-content h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.timeline-role {
  display: block;
  font-weight: 500;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.timeline-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  font-family: var(--font-mono);
  opacity: 0.7;
}

.timeline-content p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ========================================
   Projects — Expanding Gallery
   ======================================== */
.expanding-gallery-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  margin-bottom: 60px;
}

.gallery-wrapper {
  display: flex;
  gap: 12px;
  height: 340px;
  overflow: hidden;
}

.gallery-column {
  flex: 1;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  transition: flex 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.gallery-column .gallery-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  text-decoration: none;
  overflow: hidden;
}

.gallery-column img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 24px;
  transition: transform 0.8s ease, filter 0.8s ease;
}

.gallery-column:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 40%, transparent 100%);
  padding: 30px 20px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease;
  border-radius: 0 0 24px 24px;
}

.gallery-overlay h3 {
  margin: 0 0 8px 0;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-overlay p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-wrapper:hover .gallery-column {
  flex: 0.5;
}

.gallery-wrapper .gallery-column:hover {
  flex: 3;
}

.gallery-column:hover .gallery-overlay {
  transform: translateY(0);
  opacity: 1;
}

.gallery-column.expanded {
  flex: 3 !important;
}

.gallery-wrapper.has-expanded .gallery-column:not(.expanded):not(:hover) {
  flex: 0.5;
}

.gallery-column.expanded .gallery-overlay {
  transform: translateY(0);
  opacity: 1;
}

/* Projects List */
.projects-list-title {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  margin-bottom: 24px;
  color: var(--color-text-secondary);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.project-card {
  display: block;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--color-accent);
}

.project-icon {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.project-card h4 {
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 8px;
}

.project-card p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.project-tags {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
}

/* ========================================
   Skills
   ======================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 32px;
}

.skill-category h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 16px;
  font-weight: 600;
}

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

.skill-tag {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.skill-tag:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

/* ========================================
   Education
   ======================================== */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.edu-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.edu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.edu-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.edu-card h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 4px;
}

.edu-card p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.edu-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
}

.cert-title {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  margin-bottom: 24px;
  color: var(--color-text-secondary);
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.cert-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.3s ease;
}

.cert-card:hover {
  transform: translateY(-2px);
}

.cert-issuer {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  font-weight: 600;
}

.cert-card h4 {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ========================================
   Contact
   ======================================== */
.contact-container {
  text-align: center;
}

.contact-text {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  margin-bottom: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

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

.contact-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background: var(--color-card);
}

.contact-link:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.contact-link svg {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.contact-link:hover svg {
  opacity: 1;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 24px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(250, 250, 250, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-details {
    grid-template-columns: 1fr 1fr;
  }

  .section {
    padding: 64px 0;
  }

  .section-title {
    font-size: 1.5rem;
  }

  /* Gallery mobile */
  .gallery-wrapper {
    flex-direction: column;
    height: auto;
  }

  .gallery-wrapper:hover .gallery-column {
    flex: none;
  }

  .gallery-wrapper .gallery-column:hover {
    flex: none;
  }

  .gallery-column {
    height: 120px;
    flex: none !important;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .gallery-column.expanded {
    height: 350px;
    flex: none !important;
  }

  .gallery-column .gallery-overlay {
    transform: translateY(100%);
    opacity: 0;
  }

  .gallery-column.expanded .gallery-overlay {
    transform: translateY(0);
    opacity: 1;
  }

  .gallery-column:hover .gallery-overlay {
    transform: translateY(100%);
    opacity: 0;
  }

  .gallery-column:hover img {
    transform: none;
  }

  .gallery-overlay h3 {
    font-size: 18px;
  }

  .gallery-overlay p {
    font-size: 13px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .edu-grid {
    grid-template-columns: 1fr;
  }

  .cert-grid {
    grid-template-columns: 1fr;
  }

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

  .contact-link {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .about-details {
    grid-template-columns: 1fr;
  }

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

  .btn {
    width: 100%;
    max-width: 240px;
    text-align: center;
  }
}