/* Base Styles */
:root {
  --primary: #4f46e5;
  --text-primary: #000000;
  --text-secondary: #4b5563;
  --text-logo: #000000;
  --bg: #ffffff;
  --bg-theme: rgba(31, 41, 55);

  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-footer: rgba(255, 255, 255, 0.9);
  --shadow-sm: 0 3px 5px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body.dark {
  /* Dark theme overrides */
  --primary: #8b5cf6;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-logo: #000000;
  --bg: rgba(31, 41, 55);
  --bg-theme: #ffffff;
  --bg-header: rgba(31, 41, 55, 0.9);
  --bg-footer: rgba(31, 41, 55, 0.9);
  --shadow-sm: 0 3px 5px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}

body {
  font-family: 'Montserrat', sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Mouse Trail */
.mouse-trail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* Content Container */
.content {
  position: relative;
  z-index: 10;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-header);
  /* background-color: rgba(255, 255, 255, 0.9); */
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  z-index: 40;
}

.header-content {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo img {
  width: 50px;
  height: 50px;
}

.logo h1 {
  margin-left: -19px;
  margin-top: -6px;
  font-size: 2rem;
  font-weight: 700;
}

.logo h1 span {
  color: var(--primary);
}

.logo .text-logo {
  color: var(--text-logo);
}

/* Navigation */
.desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    gap: 3rem;
  }
}

.desktop-nav button {
  position: relative;
  padding: 0.25rem 0.5rem;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s;
}

.desktop-nav button:hover {
  color: var(--text-primary);
}

.desktop-nav button::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease-out;
}

.desktop-nav button:hover::after,
.desktop-nav button.active::after {
  transform: scaleX(1);
}

/* Main Content */
main {
  max-width: 80rem;
  margin: 0 auto;
  padding: 6rem 1rem 3rem;
}

/* About Section */
#about {
  padding-top: 70px;
}

.about-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5rem;
  margin-bottom: 6rem;
}

@media (min-width: 1024px) {
  .about-grid {
    flex-wrap: nowrap;
  }
}

.profile-container {
  position: relative;
  width: 400px;
  max-width: 100%;
  margin: 0 auto;
}

.profile-image {
  position: relative;
  width: inherit;
  height: auto;
  margin: 0 auto;
}

.profile-image img {
  width: inherit;
  height: auto;
  object-fit: cover;
  border-radius: 0 50% 50% 0;
}

.about-content h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.animated-name {
  color: var(--primary);
}

.about-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.skills-grid h3 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.skills-grid ul {
  list-style: none;
}

.skills-grid li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.skills-grid svg {
  color: var(--primary);
}

/* Style the mini-contact box under the photo */
.about-contact-info {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.about-contact-info .contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.about-contact-info .contact-item svg {
  color: var(--primary);
}

/* Showreel Section */
#showreel {
  margin-bottom: 6rem;
  scroll-margin-top: 6rem;
}

#showreel h2 {
  font-size: 1.875rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Portfolio Section */
#work {
  margin-bottom: 6rem;
  scroll-margin-top: 6rem;
}

#work h2 {
  font-size: 1.875rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.categories button {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.categories button:hover {
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.05);
}

.categories button.active {
  background-color: var(--primary);
  color: white;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .gallery {
    grid-template-columns: 1fr;
  }

  .gallery-item {
    grid-column: span 1 !important;
    aspect-ratio: 2/1 !important;
  }
}

.gallery-item {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  aspect-ratio: 1;
}

/* initial state: invisible & slightly shrunken */
.gallery-item {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* final state: visible and full size */
.gallery-item.visible {
  opacity: 1;
  transform: scale(1);
}


.gallery-item.size-2x1 {
  grid-column: span 2;
  aspect-ratio: 2/1;
}

.gallery-item.size-1x2 {
  grid-row: span 2;
  aspect-ratio: 1/2;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  color: white;
}

.gallery-item-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.gallery-item-content p {
  font-size: 0.875rem;
  opacity: 0.8;
}

.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  padding: 2rem;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  width: auto;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background-color 0.3s;
}

.modal-close:hover {
  background-color: rgba(0, 0, 0, 0.25);
}

.modal-media {
  flex: 1;
  background-color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.modal-media img,
.modal-media video,
.modal-media iframe {
  max-width: 100%;
  max-height: calc(90vh - 150px);
  object-fit: contain;
}

.modal-media iframe {
  width: 100%;
  height: calc(90vh - 150px);
  border: none;
}

.modal-info {
  flex-shrink: 0;
  padding: 1.5rem;
  background-color: white;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.modal-info p {
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background-color 0.3s;
}

.modal-nav:hover {
  background-color: rgba(0, 0, 0, 0.25);
}

.modal-prev {
  left: 1rem;
}

.modal-next {
  right: 1rem;
}

/* Tiny Developments Section */
#developments {
  margin-bottom: 6rem;
  scroll-margin-top: 6rem;
  text-align: center;
}

#developments h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

#developments>p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 42rem;
  margin: 0 auto 3rem;
}

/* Contact Section */
#contact {
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-margin-top: 6rem;
}

.contact-content {
  text-align: center;
}

.contact-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.contact-content p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.contact-item svg {
  color: var(--primary);
}

.contact-item a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}

.contact-item a:hover {
  color: var(--primary);
}

.contact-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background-color 0.3s;
}

.contact-button:hover {
  background-color: var(--primary-dark);
}

/* Footer */
footer {
  background-color: var(--bg-footer);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

footer p {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
}

/* Mobile Navigation */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  display: flex;
  justify-content: space-around;
  z-index: 50;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none;
  }
}

.mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.mobile-nav button.active {
  color: var(--primary);
}

.mobile-nav span {
  font-size: 0.75rem;
}

.mobile-nav .nav-icon svg {
  width: 24px;
  height: 24px;
}

.mobile-nav .nav-label {
  font-size: 0.75rem;
}



.download-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 1.5rem;
  transition: background-color 0.2s ease;
}

.download-button:hover {
  background-color: var(--primary-dark);
}

@media (max-width: 640px) {

  #about {
    padding-top: 40px;
  }

  .about-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    margin-bottom: 6rem;
  }

  /* 1) Force the animated name onto its own line under “Hello, I’m” */
  #about .about-content h2 {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  #about .about-content h2 .animated-name {
    display: block;
    margin-top: 0.5rem;
  }

  /* 2) Stack Expertise and Tools blocks vertically */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    /* you can adjust spacing */
  }

  /* 3) Left-align the profile pic */
  #about .profile-container,
  #about .profile-image {
    margin: 0;
    /* remove any centering margins */
    justify-self: start;
    /* for grid layout */
  }

  /* 4) Left-align the contact block */
  #contact .contact-content {
    text-align: left;
    /* move text & inline elements flush left */
    align-items: flex-start;
    /* if you’re using flex in contact-content */
  }

  /* Container fills its grid cell */
  #about .profile-container {
    width: 80vw;
    max-width: none;
  }

  /* Image stretches to full container width */
  #about .profile-image img {
    width: inherit;
    height: auto;
    object-fit: cover;
  }
}


/* Scroll to Top Button */
.scroll-top {
  position: fixed;
  bottom: 6rem !important;
  /* same slot the theme button used to occupy */
  right: 2rem;
  z-index: 60;
  background: var(--primary);
  border: none;
  padding: 0.5rem;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scroll-top svg {
  width: 2rem;
  height: 2rem;
  color: var(--bg);
}

.scroll-top:hover {
  background: var(--bg-theme);
  opacity: 0.9;
}

.scroll-top.hidden {
  display: none;
}

/* MOBILE BUTTON */

/* Theme Toggle Button */
#theme-toggle {
  position: fixed;
  top: 1.55rem !important;
  /* same distance as your scroll-top button */
  right: 2rem;
  /* tweak this so they don’t overlap */
  z-index: 60;
  background: var(--bg-theme);
  border: none;
  padding: 0.5rem;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle img {
  width: 2rem;
  height: 2rem;
}

/* On hover, invert background to give feedback */
#theme-toggle:hover {
  background: var(--bg-theme);
  opacity: 0.9;
}

/* DESKTOP BUTTONS */

@media (min-width: 768px) {
  .scroll-top {
    bottom: 2rem !important;
  }

  #theme-toggle {
    top: 9em !important;
  }
}