@font-face {
  font-family: 'Arial Rounded';
  src: url('../../media/fonts/arial-rounded-bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Light Mode Palette (current colors as defaults) */
  --bg-color: #f0f2f5;
  --text-color: #333;
  --font-heading: 'Arial Rounded', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --header-bg: #2c3e50;
  --header-text: #ecf0f1;
  --header-link-hover: #1abc9c;
  --main-bg: #ffffff;
  --main-shadow: rgba(0,0,0,0.08);
  --card-bg: #fff;
  --card-shadow: rgba(0,0,0,0.1);
  --card-hover-shadow: rgba(0,0,0,0.15);
  --section-title-color: #34495e;
  --link-color: #0063a8;
  --link-hover-color: #0056b3;
  --border-color: #e0e0e0;
  --contact-info-bg: #f9f9f9;
  --image-border-color: #ddd;
}

.dark-mode {
  /* Dark Mode Palette */
  --bg-color: #1a1a1a; /* Very dark grey, almost black */
  --text-color: #e0e0e0; /* Light grey for text */
  --header-bg: #1f1f1f; /* Slightly lighter than body bg */
  --header-text: #d0d0d0;
  --header-link-hover: #2ecc71; /* Brighter green for hover */
  --main-bg: #2c2c2c; /* Dark grey for main content blocks */
  --main-shadow: rgba(0,0,0,0.4);
  --card-bg: #333333; /* Darker grey for cards */
  --card-shadow: rgba(0,0,0,0.3);
  --card-hover-shadow: rgba(0,0,0,0.5);
  --section-title-color: #b0b0b0; /* Lighter grey for section titles */
  --link-color: #5dade2; /* Brighter blue for links (5.7:1 on the dark panel) */
  --link-hover-color: #85c1e9;
  --border-color: #444444; /* Darker borders */
  --contact-info-bg: #252525; /* Dark background for contact info box */
  --image-border-color: #555555;
}

address {
  font-style: normal;
}

body {
  font-family: var(--font-body);
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  text-align: center;
  padding: 50px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
}

h1, h2 {
  color: #0063a8;
  margin-bottom: 20px;
}

.image-grid {
  column-count: 4;
  column-gap: 15px;
  max-width: 1200px;
  margin: 0 auto 30px auto;
}

.image-grid img {
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto 15px auto;
  display: block;
  border: 1px solid var(--image-border-color);
  border-radius: 6px;
  break-inside: avoid;
  box-shadow: 0 2px 5px var(--card-shadow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  cursor: pointer;
}

.image-grid img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 8px var(--card-shadow);
}

@media (max-width: 900px) {
  .image-grid {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .image-grid {
    column-count: 1;
  }
}

/* Star Projects Grid */
.projects-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  margin-bottom: 40px;
}

.project-item {
  width: clamp(280px, 30%, 350px);
  margin-bottom: 20px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 4px 8px var(--card-shadow);
  padding: 15px;
  background-color: var(--card-bg);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.project-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px var(--card-hover-shadow);
}

.project-item a {
  text-decoration: none;
  color: inherit;
}

.project-item img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: none;
  border-radius: 6px;
  margin-bottom: 10px;
  object-fit: contain; /* Ensure image scales down within bounds */
  max-height: 200px; /* Optional: constrain image height if needed, adjust value */
}

.project-item p {
  margin-top: 8px;
  font-size: 1.1em;
  font-weight: bold;
  text-align: center;
  width: 100%;
}

/* Project Page Layout */
.project-page-layout {
  display: flex;
  flex-wrap: wrap;
  margin-top: 30px;
  gap: 40px;
  align-items: flex-start;
}

.project-images {
  flex: 1 1 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-description {
  flex: 1 1 500px;
  line-height: 1.6;
  text-align: left;
}

.project-description h2 {
  margin-top: 0;
  color: var(--link-color);
  text-align: left;
}

.project-description p {
  text-align: left;
}

header {
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 1.2em 0;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease, color 0.3s ease;
}

header h1 {
  margin: 0;
  font-size: 2em;
}

header nav a {
  color: var(--header-text);
  margin: 0 15px;
  text-decoration: none;
  font-size: 1.1em;
  transition: color 0.3s ease;
}

header nav a:hover {
  color: var(--header-link-hover);
}

main {
  padding: 20px;
  max-width: 1200px;
  margin: 30px auto;
  background-color: var(--main-bg);
  box-shadow: 0 4px 12px var(--main-shadow);
  border-radius: 8px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

footer {
  text-align: center;
  padding: 25px;
  background-color: var(--header-bg);
  color: var(--header-text);
  margin-top: 40px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Add a general container for sections if needed for consistent padding/margin */
.content-section {
  padding: 20px 0;
  text-align: center;
}

.content-section h1,
.content-section h2 {
  margin-bottom: 25px;
  color: var(--section-title-color);
  transition: color 0.3s ease;
}

/* Contact Info Styling */
.contact-info-header {
  margin: 20px auto 30px auto; /* Centered with auto margins */
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--contact-info-bg);
  max-width: 500px; /* Limit width */
  text-align: center; /* Center text inside the box */
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.contact-info-header p {
  margin: 8px 0;
  font-size: 1.1em;
  color: var(--text-color);
}

.contact-info-header p a {
  color: var(--link-color);
  text-decoration: none;
}

.contact-info-header p a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

.contact-info-footer {
  margin-bottom: 15px; /* Space above the copyright */
}

.contact-info-footer p {
  margin: 5px 0;
  font-size: 0.95em;
}

footer a,
.contact-info-footer a {
  color: var(--header-text); /* To match footer text color */
  text-decoration: none;
}

.contact-info-footer a:hover {
  text-decoration: underline;
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000; /* Ensure lightbox is above everything */
}

.lightbox.visible {
  visibility: visible;
  opacity: 1;
}

.dark-mode .lightbox {
  background: rgba(0, 0, 0, 0.95); /* Even darker in dark mode */
}

.lightbox-stage {
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-stage img,
.lightbox-stage video {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 1002;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-close {
  top: 24px;
  right: 28px;
  width: 46px;
  height: 46px;
  font-size: 28px;
  line-height: 1;
}

.lightbox-close:active {
  transform: scale(0.9);
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.9);
}

.lightbox-nav[hidden] {
  display: none;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-nav svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 600px) {
  .lightbox-nav {
    width: 44px;
    height: 44px;
  }
  .lightbox-prev {
    left: 10px;
  }
  .lightbox-next {
    right: 10px;
  }
  .lightbox-close {
    top: 14px;
    right: 14px;
  }
}

/* Theme toggle button (sun/moon) */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background-color: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--header-link-hover);
  transform: scale(1.08);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--header-link-hover);
  outline-offset: 2px;
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Light mode shows the sun, dark mode shows the moon */
.theme-toggle .icon-moon,
html.dark-mode .theme-toggle .icon-sun {
  display: none;
}

html.dark-mode .theme-toggle .icon-moon {
  display: block;
}

/* Responsive YouTube Embed */
.video-container {
  position: relative;
  width: 100%; /* Make it responsive to its parent */
  max-width: 780px; /* A slightly larger max-width, adjust as needed */
  margin: 30px auto; /* Center the container */
  overflow: hidden;
  background-color: #000; /* Background for letterboxing */
  border-radius: 8px;
  box-shadow: 0 4px 10px var(--card-shadow);
}

.video-container::before {
  content: "";
  display: block;
  padding-top: 56.25%; /* 16:9 Aspect Ratio (9 / 16 = 0.5625) */
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0; /* Ensure no iframe border */
  border-radius: 8px; /* Match container rounding */
}

video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--card-shadow);
  break-inside: avoid;
}

.cv-download-button {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 20px;
  background-color: var(--link-color);
  color: var(--main-bg); /* Text color that contrasts with button background */
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.cv-download-button:hover {
  background-color: var(--link-hover-color);
  transform: translateY(-2px);
}

.dark-mode .cv-download-button,
.dark-mode .cv-download-button:hover {
  color: var(--bg-color);
}

#my-work-section h2 {
  margin-bottom: 30px; /* More space after the main "My Work" title */
}

#my-work-section h3 {
  color: var(--section-title-color);
  text-align: center; /* Or left, depending on preference */
  margin-top: 40px; /* Space above each category title */
  margin-bottom: 20px; /* Space below each category title and before its grid */
  font-size: 1.8em; /* Slightly larger for category titles */
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
  display: inline-block; /* To make border-bottom only span the text width if centered */
}

/* Smooth jumping for the in-page nav links */
html {
  scroll-behavior: smooth;
}

/* Sticky site navigation (homepage) */
.site-nav {
  position: sticky;
  top: 12px;
  z-index: 998;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 30px;
  padding: 12px 24px;
  background-color: var(--header-bg);
  color: var(--header-text);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: background-color 0.3s ease;
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2em;
  color: var(--header-text);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}

.site-nav a {
  color: var(--header-text);
  text-decoration: none;
  font-size: 1.05em;
  transition: color 0.3s ease;
}

.site-nav a:hover {
  color: var(--header-link-hover);
}

/* Offset anchor jumps so the target heading clears the sticky bar */
#reel, #projects, #my-work-section, #contact {
  scroll-margin-top: 80px;
}

/* Hero */
.hero {
  margin-bottom: 30px;
}

.hero .tagline {
  font-size: 1.25em;
  max-width: 640px;
  margin: 0 auto;
  color: var(--text-color);
}

/* Contact section (now near the bottom) */
.contact-section {
  margin-top: 40px;
}

/* Tighter spacing on smaller screens */
@media (max-width: 900px) {
  body {
    padding: 30px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 18px;
  }
  .site-nav {
    top: 8px;
  }
}

/* Skip link: hidden until it gets keyboard focus */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--main-bg);
  color: var(--link-color);
  border-radius: 6px;
}

.skip-link:focus {
  top: 8px;
}

/* Keyboard focus ring for thumbnails that open the lightbox */
.carousel-item img:focus-visible,
.carousel-item video:focus-visible,
.image-grid img:focus-visible,
.image-grid video:focus-visible,
.lightbox button:focus-visible {
  outline: 3px solid var(--link-color);
  outline-offset: 3px;
}
