/* ===== Unified Color + Design System ===== */
:root {
  --accent: #004aad;
  --bg-color: #f9f9f9;
  --text-color: #222;
  --panel-bg: rgba(255,255,255,0.95);
  --card-bg: #fff;
  --card-border: #ddd;
  --header-bg: rgba(255,255,255,0.85);
  --footer-border: #ddd;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #eaeaea;
    --panel-bg: rgba(24,24,24,0.95);
    --card-bg: #1c1c1c;
    --card-border: #333;
    --header-bg: rgba(18,18,18,0.9);
    --footer-border: #333;
    --shadow: 0 4px 12px rgba(0,0,0,0.6);
  }
}

/* ===== Global Layout ===== */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  font-size: 1.05rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Header / Navbar ===== */
header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 2rem;
  background-color: var(--header-bg);
  box-shadow: var(--shadow);
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links li {
  list-style: none;
  border: none;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-color);
}

/* ===== Mobile Menu (Fixed) ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--panel-bg);
    backdrop-filter: blur(8px);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0; /* Use right: 0 instead of width: 100% */
    width: auto; /* Let it fill naturally */
    z-index: 1500;
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: max-height 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 80vh;
    padding: 0.5rem 0;
    box-sizing: border-box; /* Important: include padding in width calculation */
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    font-size: 1.1rem;
    text-align: left; /* Changed from right to left for better readability */
    display: block;
    padding: 0.8rem 1.25rem;
    white-space: normal;
    word-wrap: break-word;
    box-sizing: border-box; /* Include padding in width */
    overflow-wrap: break-word; /* Better text wrapping support */
    min-width: 0; /* Allows flex children to shrink below content size */
  }

  .nav-links .dropbtn {
    padding: 0.8rem 1.25rem;
    box-sizing: border-box;
    min-width: 0;
  }

  #home {
    border-radius: 0 0 20px 20px;
    padding: 2rem 1rem;
    min-height: 70vh;
  }

  #home h1 {
    font-size: 1.9rem;
  }
}

/* ===== Dropdown Menu (Click + Hover compatible) ===== */
.dropdown {
  position: relative;
}

.dropbtn {
  cursor: pointer;
  display: inline-block;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--card-bg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  min-width: 200px;
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dropdown-content a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-content a:hover {
  background-color: var(--accent);
  color: white;
}

/* Show dropdown (for hover or JS toggle) */
.dropdown.open .dropdown-content,
.dropdown:hover .dropdown-content {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== Dropdown Arrow Animation ===== */
.arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}

.dropdown.open .arrow,
.dropdown:hover .arrow {
  transform: rotate(180deg);
}

/* ===== Mobile Dropdown Final (Clean and Stable) ===== */
@media (max-width: 768px) {
  .dropdown {
    width: 100%;
  }

  .dropbtn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.05rem;
  }

  .arrow {
    transition: transform 0.25s ease;
  }

  .dropdown-content {
    background-color: var(--card-bg);
    border-top: 1px solid var(--card-border);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }

  .dropdown.open .dropdown-content {
    max-height: 400px;
    opacity: 1;
  }

  .dropdown-content a {
    display: block;
    padding: 0.75rem 2rem;
    text-decoration: none;
    color: var(--text-color);
    background: transparent;
    font-size: 0.95rem;
  }

  .dropdown-content a:hover {
    background-color: var(--accent);
    color: white;
  }

  /* Arrow rotation when open */
  .dropdown.open .arrow {
    transform: rotate(180deg);
  }
}

/* ===== Home Section (Circular Headshot + Animation) ===== */
.home {
  background: none; /* removes gradient background */
  padding-top: 3rem; /* reduce top space */
}

.home-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  text-align: left;
  min-height: 70vh; /* slightly shorter */
  animation: fadeIn 1.2s ease-in forwards;
  opacity: 0; /* start transparent, fade in */
}

.headshot {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(20px);
  opacity: 0;
  animation: fadeUp 1.4s ease forwards;
  animation-delay: 0.2s;
}

.intro-text {
  max-width: 500px;
  transform: translateY(20px);
  opacity: 0;
  animation: fadeUp 1.4s ease forwards;
  animation-delay: 0.4s;
}

.intro-text h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.intro-text p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Mobile Layout */
@media (max-width: 768px) {
  .home-container {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
    padding-top: 2rem;
  }

  .headshot {
    width: 180px;
    height: 180px;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Scroll Reveal Animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Section Layout ===== */
.section {
  padding: 5rem 2rem;
  max-width: 900px;
  margin: auto;
}

.section h2 {
  border-bottom: 3px solid var(--accent);
  display: inline-block;
  padding-bottom: 0.3rem;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.section p {
  font-size: 1.05rem;
  color: var(--text-color);
}

/* ===== Projects ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.project-card {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.project-card img,
.project-card iframe {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.project-card h3 {
  margin-top: 0.5rem;
  font-size: 1.2rem;
}

.project-link {
  text-decoration: none !important;
  color: inherit;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-link:hover {
  text-decoration: none;
}

.project-link:hover .project-card {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.project-detail-img {
  width: 100%;
  max-width: 700px;
  border-radius: 8px;
  margin: 1.5rem 0;
  display: block;
}

/* ===== Project Gallery (2 images wide) ===== */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

/* For smaller screens, make it 1 image wide */
@media (max-width: 768px) {
  .project-gallery {
    grid-template-columns: 1fr;
  }
}

.project-gallery img {
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ===== Hobbies Section (Stacked Layout) ===== */
.hobby-grid {
  display: flex !important;
  flex-direction: column;
  gap: 2rem;
  margin-top: 2rem;
}

.hobby-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hobby-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}

.hobby-card h3 {
  margin-top: 0;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

/* ===== Hobbies Divider ===== */
.hobby-divider {
  border: none;
  border-top: 2px solid var(--accent);
  width: 60%;
  margin: 1rem auto 1rem auto;
  opacity: 0.5;
}

.hobby-divider.reveal {
  transform: none;
  transition: opacity 1s ease;
}

/* ===== Video Gallery (2-wide layout) ===== */
.video-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.video-gallery iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* Make it single-column on smaller screens */
@media (max-width: 768px) {
  .video-gallery {
    grid-template-columns: 1fr;
  }
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: start;
}

.photo-grid img {
  width: 100%;
  height: auto; /* keep natural proportions */
  object-fit: contain; /* ensures no cropping */
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-grid img:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

.instagram-media {
  margin: 1rem auto !important;
  max-width: 100% !important;
  border-radius: 8px !important;
  display: block;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.7rem 1.5rem;
  background-color: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background-color: #003b88;
  transform: translateY(-2px);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--footer-border);
  margin-top: 3rem;
  opacity: 0.9;
}

/* ===== Lightbox Image Viewer ===== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2000;
}

.lightbox.visible {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  object-fit: contain;
  cursor: zoom-out;
}

/* ===== Contact Section (Hyperlinks + SVG Icons) ===== */
.contact-list {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.contact-list a:hover {
  text-decoration: underline;
  color: var(--text-color);
}

.icon {
  width: 1.3rem;
  height: 1.3rem;
  flex-shrink: 0;
  color: var(--text-color);
  opacity: 0.9;
  transition: color 0.2s ease;
}