/* === GLOBAL STYLES & VARIABLES === */
:root {
  --bg-body: #f4f4f4;
  --bg-card: #ffffff;
  --bg-navbar: #b71c1c;
  --text-main: #212121;
  --text-secondary: #555;
  --text-nav: #ffffff;
  --primary-color: #b71c1c;
  --primary-hover: #8e0000;
  --border-color: #ddd;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(0, 0, 0, 0.1);
  --hero-bg-gradient: linear-gradient(to bottom right, #ffffff, #e0e0e0);
}

[data-theme="dark"] {
  --bg-body: #121212;
  --bg-card: #1e1e1e;
  --bg-navbar: #1a1a1a;
  --text-main: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-nav: #e0e0e0;
  --primary-color: #ff5f5f;
  --primary-hover: #ff8a80;
  --border-color: #333;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --shadow-hover: rgba(0, 0, 0, 0.7);
  --hero-bg-gradient: linear-gradient(to bottom right, #121212, #2c2c2c);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* === NAVBAR === */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--bg-navbar);
  color: var(--text-nav);
  position: sticky;
  top: 0;
  z-index: 999;
  transition: background-color 0.3s ease;
}

.navbar .logo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
}

.navbar nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-right: auto;
  /* Push nav to left/center if needed, or keeping it default */
  margin-left: 2rem;
}

.navbar ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.navbar a {
  text-decoration: none;
  color: var(--text-nav);
  font-weight: 500;
  transition: color 0.2s;
}

.navbar a:hover {
  color: #ffcccb;
}

/* Nav Controls (Theme Toggle + Hamburger) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Theme Toggle Button */
#theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

#theme-toggle:hover {
  transform: scale(1.1);
}

/* Hamburger Menu (Mobile) */
.hamburger {
  display: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--text-nav);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* === HERO SECTION === */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--hero-bg-gradient);
  min-height: 80vh;
  transition: background 0.3s ease;
}

.hero h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.8rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  max-width: 600px;
  color: var(--text-secondary);
}

.cta-buttons .btn,
.cta-buttons .btn-outline {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  margin: 0 0.5rem;
  transition: all 0.3s ease;
  display: inline-block;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn {
  background-color: var(--primary-color);
  color: white;
  /* Always white text on primary button */
}

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

.btn-outline {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: transparent;
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: white;
}

/* === PROJECTS === */
.projects {
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  align-items: stretch;
}

.project-card {
  background-color: var(--bg-card);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 300px;
  height: auto;
  position: relative;
  flex-grow: 1;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px var(--shadow-hover);
  z-index: 1;
}

.project-card h2 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.project-card p {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.project-card .tags {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.25rem;
}

.project-card .cta-buttons {
  margin-top: auto;
  text-align: center;
}

@media (max-width: 768px) {
  .project-card {
    height: auto;
  }
}

.project-header {
  flex: 0 0 auto;
}

.project-description {
  flex: 1 1 auto;
  overflow: auto;
  margin-bottom: 1rem;
}

.project-meta {
  flex: 0 0 auto;
  margin-top: 0.5rem;
}

.project-footer {
  flex: 0 0 auto;
  margin-top: auto;
  text-align: center;
}

.project-description p {
  display: block;
  overflow: visible;
  margin: 0 0 1rem;
}

.clamp-8 {
  display: -webkit-box;
  line-clamp: 0;
  /* Placeholder */
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === CHIPS & TAGS === */
.tag-chip,
.tag-inline {
  display: inline-block;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}

.tag-chip:hover,
.tag-inline:hover {
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.tag-chip.active,
.tag-inline.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.tag-chip:focus-visible,
.tag-inline:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.25rem 0 1.5rem;
}

/* === FOOTER === */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background-color: var(--bg-body);
  transition: background-color 0.3s ease;
}

.footer-socials {
  margin-bottom: 1rem;
}

.footer-socials a {
  display: inline-block;
  margin: 0 0.5rem;
}

.footer-socials img {
  width: 36px;
  height: 36px;
  filter: grayscale(100%);
  transition: filter 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .footer-socials img {
  filter: grayscale(100%) invert(1);
  /* Invert for dark mode so icons are visible */
}

.footer-socials img:hover {
  filter: grayscale(0%);
  transform: scale(1.1);
}

[data-theme="dark"] .footer-socials img:hover {
  filter: invert(0) grayscale(0);
  /* Reset on hover */
}


/* === ABOUT === */
.about {
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.about-container {
  margin-top: 2rem;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 0 10px var(--shadow-color);
  text-align: left;
  transition: background-color 0.3s ease;
}

.about-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.profile-pic {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: center;
}

.about-text {
  flex: 1;
}

.about-text p {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.timeline,
.fun-facts {
  margin-top: 2.5rem;
}

.timeline ul,
.fun-facts ul {
  padding-left: 1rem;
}

.timeline li,
.fun-facts li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* === RESUME === */
.resume {
  padding: 4rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.resume-section {
  margin-top: 2rem;
}

.resume-section h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.resume h2.left-aligned {
  text-align: left;
  margin-left: 0;
  font-size: 2rem;
  font-family: 'Montserrat', sans-serif;
  color: var(--primary-color);
}

.resume-section ul {
  padding-left: 1.5rem;
  list-style: disc;
}

.resume-section li {
  margin-bottom: 0.5rem;
}

.resume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.resume-card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  box-shadow: 0 2px 12px var(--shadow-color);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.resume-card img {
  max-width: 100%;
  height: 60px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

/* Invert generic logos in dark mode if needed, but usually keep logos as is. 
   If logos are black PNGs with transp backgrounds, they might disappear on dark. 
   Assuming logos have background or are colored. If they are black text logos, might need a background.
   Let's add a light background to logo container to be safe. */
.resume-card img {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 4px;
}

.resume-card-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.resume-card .role,
.resume-card .date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.resume-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-top: 0.75rem;
}

.resume-card.open .resume-card-body {
  max-height: 1200px;
}

/* === PHOTOGRAPHY GALLERY === */
.photography {
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.photo-intro {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.6;
  max-width: 800px;
  margin: 2rem auto 3rem;
  text-align: left;
}

.photo-intro a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: underline;
}

.photo-intro a:hover {
  color: var(--primary-hover);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.gallery-item {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  object-fit: cover;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.03);
}

/* === LIGHTBOX === */
#lightbox {
  position: fixed;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 1000;
  text-align: center;
}

#lightbox-img {
  max-width: 90%;
  max-height: 80vh;
  border-radius: 0.5rem;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.caption {
  margin-top: 1rem;
  color: #fff;
  font-size: 1rem;
}

.nav {
  position: absolute;
  top: 50%;
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  user-select: none;
  padding: 0 1rem;
}

.prev {
  left: 2%;
  transform: translateY(-50%);
}

.next {
  right: 2%;
  transform: translateY(-50%);
}

/* === CONTACT === */
.contact {
  padding: 4rem 2rem;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
  text-align: left;
}

.contact-form label {
  font-weight: 600;
  color: var(--text-main);
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  resize: vertical;
  background-color: var(--bg-card);
  color: var(--text-main);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.1);
}

/* === MOBILE RESPONSIVENESS & HAMBURGER === */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
    /* Show Hamburger */
  }

  .navbar {
    padding: 1rem 1.5rem;
  }

  .navbar nav {
    margin-left: auto;
  }

  .navbar nav ul {
    position: fixed;
    top: 70px;
    /* Below navbar */
    left: -100%;
    /* Hidden by default */
    flex-direction: column;
    background-color: var(--bg-navbar);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    padding: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .navbar nav ul.active {
    left: 0;
    /* Slide in */
  }

  .navbar nav ul li {
    margin: 1.5rem 0;
  }

  /* Hamburger Animation */
  .hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }
}

/* === SCROLL ANIMATIONS === */
.hidden-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* === BACK TO TOP BUTTON === */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  /* Moved to left to avoid BuyMeACoffee widget overlap */
  right: auto;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background-color 0.3s, transform 0.3s;
  z-index: 998;
  display: flex;
  justify-content: center;
  align-items: center;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* Override possible transform from hidden state if needed */
}

#back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-3px);
}