/* Base styles for all pages */

:root {
  --background-color: #faefd8;
  --text-color: black;
  --link-color: black;
  --hover-color: rgb(255, 111, 0);
  --footer-text-color: #232323;
  --border-color: rgba(0, 0, 0, 0.1);
  --dark-mode-toggle-hover: #726dfc;
}

[data-theme="dark"] {
  --background-color: #0d1117;
  --text-color: #f0f0f0;
  --link-color: #f0f0f0;
  --footer-text-color: #b0b0b0;
  --border-color: rgba(255, 255, 255, 0.1);
}

html {
  font-family: 'Inter', sans-serif;
  /* Smooth transition for dark mode toggle */
  transition: background-color 0.3s, color 0.3s;
}

body {
  margin: 0;
  padding: 90px 0 0;
  /* Space for fixed header */
  box-sizing: border-box;
  font-weight: 300;
  background: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

/* Header */
.site-header {
  width: 100%;
  padding: 0.5rem 0 0;
  /* Further reduced to decrease height */
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(250, 239, 216, 0.8);
  /* Semi-transparent light background */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* For Safari support */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode header styles */
[data-theme="dark"] .site-header {
  background-color: rgba(13, 17, 23, 0.8);
  /* Semi-transparent dark background */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

.header-nav {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}

.header-nav a {
  font-weight: 300;
  color: var(--link-color);
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.10em;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
}

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

[data-theme="dark"] .header-nav a:hover {
  text-decoration-color: var(--dark-mode-toggle-hover);
}

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

.header-left {
  margin: 0;
}

.header-name.fw-medium {
  font-size: 1.4rem;
  margin: 0;
  letter-spacing: 0em;
  display: flex;
  align-items: center;
}

/* Portfolio icon styles */
.portfolio-icon-link {
  display: inline-block;
}

.portfolio-icon {
  width: 40px;
  height: auto;
  vertical-align: middle;
  border-radius: 4px;
  display: none;
  /* Initially hide both */
}

.portfolio-icon-light {
  display: inline;
  /* Show light icon by default */
}

[data-theme="dark"] .portfolio-icon-light {
  display: none;
  /* Hide light icon in dark mode */
}

[data-theme="dark"] .portfolio-icon-dark {
  display: inline;
  /* Show dark icon in dark mode */
}

/* Remove text underline on hover for portfolio icon */
.header-left a:hover {
  text-decoration: none;
}

[data-theme="dark"] .header-left a:hover {
  text-decoration: none;
}

.portfolio-icon-link:hover .portfolio-icon {
  opacity: 0.8;
}

.dark-mode-toggle {
  background: none;
  border: 2px solid var(--dark-mode-toggle-hover);
  border-radius: 50%;
  color: var(--dark-mode-toggle-hover);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  width: 1.7rem;
  height: 1.7rem;
  transition: color 0.3s, border-color 0.3s;
  vertical-align: middle;
}

/* Desktop-specific styles for moon icon */
@media (min-width: 901px) {
  .dark-mode-toggle {
    color: var(--link-color);
    border-color: var(--link-color);
  }
}

[data-theme="dark"] .dark-mode-toggle {
  color: var(--hover-color);
  border-color: var(--hover-color);
}

/* Desktop-specific styles for sun icon */
@media (min-width: 901px) {
  [data-theme="dark"] .dark-mode-toggle {
    color: white;
    border-color: white;
  }
}

/* Hover states for devices that support hover */
@media (hover: hover) {
  .dark-mode-toggle:hover {
    color: var(--dark-mode-toggle-hover);
    border-color: var(--dark-mode-toggle-hover);
  }

  [data-theme="dark"] .dark-mode-toggle:hover {
    color: var(--hover-color);
    border-color: var(--hover-color);
  }
}

.dark-mode-toggle:active {
  color: var(--dark-mode-toggle-hover);
  border-color: var(--dark-mode-toggle-hover);
}

[data-theme="dark"] .dark-mode-toggle:active {
  color: var(--hover-color);
  border-color: var(--hover-color);
}

.dark-mode-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--dark-mode-toggle-hover);
}

[data-theme="dark"] .dark-mode-toggle:focus {
  box-shadow: 0 0 0 2px var(--hover-color);
}

.description-container {
  flex: 1;
  padding-top: 15vh;
}

.intro {
  /* Base styles will be overridden by index.css for specific layout */
  width: 100%;
  gap: 3rem;
}

.intro-text {
  padding: 2rem;
  margin: 4rem 2rem 0 6rem;
  max-width: 480px;
  border-radius: 4px;
  font-weight: 300;
  color: var(--text-color);
}

/* Ensure text in white cards is black in dark mode */
div[style*="background: #ffffff"],
div[style*="background:#ffffff"],
div[style*="background: white"],
div[style*="background:white"],
div[style*="box-shadow: 0 0 8px rgba(0, 0, 0, 0.1)"],
div[style*="box-shadow:0 0 8px rgba(0,0,0,0.1)"] {
  color: black;
  background-color: white;
}

[data-theme="dark"] div[style*="background: #ffffff"],
[data-theme="dark"] div[style*="background:#ffffff"],
[data-theme="dark"] div[style*="background: white"],
[data-theme="dark"] div[style*="background:white"],
[data-theme="dark"] div[style*="box-shadow: 0 0 8px rgba(0, 0, 0, 0.1)"],
[data-theme="dark"] div[style*="box-shadow:0 0 8px rgba(0,0,0,0.1)"] {
  color: black;
  background-color: white;
}

[data-theme="dark"] .intro-text *,
[data-theme="dark"] div[style*="background: #ffffff"] *,
[data-theme="dark"] div[style*="background:#ffffff"] *,
[data-theme="dark"] div[style*="background: white"] *,
[data-theme="dark"] div[style*="background:white"] *,
[data-theme="dark"] div[style*="box-shadow: 0 0 8px rgba(0, 0, 0, 0.1)"] *,
[data-theme="dark"] div[style*="box-shadow:0 0 8px rgba(0,0,0,0.1)"] * {
  color: black;
}

/* Exclude our new intro classes from the above rule */
[data-theme="dark"] .intro-text .intro-heading,
[data-theme="dark"] .intro-text .intro-paragraph {
  color: var(--text-color);
}

/* Ensure list items and their markers in intro-text also follow dark mode */
[data-theme="dark"] .intro-text ul,
[data-theme="dark"] .intro-text ol {
  color: var(--text-color);
}

[data-theme="dark"] .intro-text ul li::marker,
[data-theme="dark"] .intro-text ol li::marker {
  color: var(--text-color);
}

/* Project info meta sections */
.info-meta {
  padding: 1rem;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 0.9rem;
  text-align: left;
  line-height: 1.8;
}

p {
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

/* Work page main content layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 1200px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 3.5rem 2rem 2rem 2rem;
  gap: 4rem;
  align-items: flex-start;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 2rem 0 1rem;
  width: 100%;
  text-align: center;
}

.site-footer nav a {
  color: var(--link-color);
  text-decoration: none;
}

.site-footer nav a:hover {
  text-decoration: underline;
  text-decoration-color: var(--hover-color);
  color: var(--link-color);
}

[data-theme="dark"] .site-footer nav a:hover {
  text-decoration-color: var(--dark-mode-toggle-hover);
}

.site-footer nav {
  display: flex;
  justify-content: center;
  align-items: center;
}

.site-footer nav span {
  margin: 0 0.4rem;
  color: var(--link-color);
}

/* Tighten footer link spacing */
.site-footer nav a,
.site-footer nav .link-text {
  margin-right: 0;
  padding-right: 0;
}

.site-footer p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--footer-text-color);
}

/* Mobile scroll chaining fix */
@media (max-width: 1440px) {
  .container {
    height: auto;
    min-height: 100vh;
  }

  body {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding-top: 90px;
    /* Ensure mobile also has space for fixed header */
  }

  .site-header,
  .site-footer {
    overscroll-behavior: contain;
  }

  .main-content,
  .description-container {
    flex: none;
    min-height: auto;
  }
}

/* Mobile header styles */
@media (max-width: 768px) {
  .header-nav {
    gap: 1.5rem;
  }

  .resume-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .download-icon {
    font-size: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
  }

  .portfolio-icon {
    width: 32px;
    height: auto;
  }
}

/* Font-weight utility classes */
.fw-light {
  font-weight: 300;
}

.fw-regular {
  font-weight: 400;
}

.fw-medium {
  font-weight: 500;
}

.fw-semibold {
  font-weight: 600;
}

.fw-bold {
  font-weight: 700;
}

/* Utility classes */
.center-flex {
  display: flex;
  justify-content: center;
  align-items: center;
}

.scroll-top-btn,
.scroll-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1000;
}

/* Scroll arrow colors - orange in light mode, purple in dark mode */
.scroll-top-btn svg,
.scroll-btn svg {
  stroke: var(--hover-color);
}

[data-theme="dark"] .scroll-top-btn svg,
[data-theme="dark"] .scroll-btn svg {
  stroke: var(--dark-mode-toggle-hover);
}

/* Mobile scroll up arrow positioning */
@media (max-width: 600px) {

  .scroll-top-btn,
  .scroll-btn,
  button[onclick*="scrollTo"] {
    right: 0rem;
    bottom: 1rem;
  }
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
}

.caption {
  font-size: 0.85rem;
  color: #555;
  text-align: center;
  margin: 0.5rem 0 1rem;
}

[data-theme="dark"] .caption {
  color: #f0f0f0;
}

.full-image {
  width: 100%;
  height: auto;
}

.screenshot-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

/* Fancybox image link styles */
.image-link {
  display: inline-block;
  width: fit-content;
  height: fit-content;
  line-height: 0;
  padding: 0;
  margin: 0;
  font-size: 0;
  overflow: hidden;
  position: relative;
  box-sizing: content-box;
}

.image-link img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: none;
}

/* Offset for anchor links to account for fixed header */
#selected-work {
  scroll-margin-top: 50px;
  /* Adjust for fixed header height */
}

/* ===== Hamburger Menu Styles ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  position: fixed;
  top: 14px;
  /* Align with header padding and icon */
  right: 20px;
  left: auto;
  z-index: 1001;
}

/* Mobile specific styles */
.mobile-dark-mode-toggle {
  display: none;
  /* Hidden by default on desktop */
}

@media (max-width: 768px) {
  .mobile-dark-mode-toggle {
    position: fixed;
    top: 10px;
    right: 60px;
    /* Position to the left of the hamburger menu in the top right */
    z-index: 1002;
    /* Higher than hamburger but below sidebar */
    background: none;
    border: 2px solid var(--dark-mode-toggle-hover);
    /* Purple in light mode */
    border-radius: 50%;
    color: var(--dark-mode-toggle-hover);
    /* Purple in light mode */
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    width: 1.7rem;
    height: 1.7rem;
    transition: color 0.3s, border-color 0.3s;
  }

  [data-theme="dark"] .mobile-dark-mode-toggle {
    color: var(--hover-color);
    /* Orange in dark mode */
    border-color: var(--hover-color);
    /* Orange in dark mode */
  }

  .hamburger {
    position: fixed;
    top: 10px;
    right: 20px;
    /* Position in the top right corner */
    z-index: 1001;
    /* Adjust for mobile header padding */
  }

  /* Hide desktop navigation on mobile */
  .header-nav {
    display: none;
  }
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

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

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

/* ===== Sidebar Styles ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(250, 239, 216, 0.9);
  /* Light transparent background */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* For Safari support */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  /* Reset to 0 to control layout with content */
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--text-color);
  visibility: hidden;
  opacity: 0;
  /* Initially hidden */
}

/* Animation for menu items */
.sidebar.animated .nav-item {
  opacity: 0;
  transform: translateY(-10px);
  animation: slideIn 0.4s forwards;
}

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

.sidebar.animated .nav-item:nth-child(1) {
  animation-delay: 0.1s;
}

.sidebar.animated .nav-item:nth-child(2) {
  animation-delay: 0.2s;
}

.sidebar.animated .nav-item:nth-child(3) {
  animation-delay: 0.3s;
}

.sidebar.animated .nav-item:nth-child(4) {
  animation-delay: 0.4s;
}

.sidebar.animated .nav-item:nth-child(5) {
  animation-delay: 0.5s;
}

/* Vertically center the content using a flexible spacer */
.sidebar::before {
  content: '';
  flex: 1;
}

.sidebar::after {
  content: '';
  flex: 1;
}

/* Add padding to the actual content */
.sidebar> :not(.sidebar-footer) {
  margin-top: 0;
  margin-bottom: 0;
}

/* Ensure footer is positioned at the bottom */
.sidebar .sidebar-footer {
  margin-top: auto;
  margin-bottom: 2rem;
}

[data-theme="dark"] .sidebar {
  background-color: rgba(13, 17, 23, 0.9);
  /* Dark transparent background */
}

.sidebar.active {
  visibility: visible;
  opacity: 1;
  /* Only visible when active - now appears instantly as overlay */
}

/* Desktop styles - hide sidebar completely */
@media (min-width: 769px) {
  .sidebar {
    display: none;
  }
}

.sidebar-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.5rem;
  margin-bottom: 2.5rem;
  color: var(--text-color);
  gap: 0.5rem;
  text-align: center;
}

.sidebar-title .portfolio-icon {
  width: 24px;
  height: 24px;
}

.nav-item {
  padding: 0;
  margin-bottom: 2.5rem;
  /* Increased spacing between links */
  width: 100%;
  text-align: center;
}

.nav-link {
  display: block;
  text-align: center;
  padding: 1.5rem 0;
  /* Increased vertical padding for more spacing */
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
  width: 100%;
  max-width: 100vw;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.3rem;
  /* Increased font size for mobile */
  position: relative;
  box-sizing: border-box;
  margin: 0;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Active/inactive link styles for mobile menu */
.nav-link:not(.active) {
  opacity: 0.6;
  /* Grayed out inactive links */
  color: inherit;
}

.nav-link.active {
  opacity: 1;
  /* White/normal color for active link */
  color: inherit;
  /* Use inherited color from theme */
}

.nav-text {
  font-size: 1.3rem;
  /* Increased font size for mobile */
  font-weight: 500;
  display: block;
  width: 100%;
  text-align: center;
}

/* Download link styling for mobile menu - specifically for the resume section */
.resume-flex-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  /* Center content */
  gap: 0.5rem;
  width: 100%;
  text-align: center;
  padding: 0 1rem;
}

.resume-flex-container .resume-text-link {
  display: flex;
  align-items: center;
  width: auto;
  text-align: center;
  padding: 1rem 0;
  margin: 0;
  flex: none;
  /* Don't grow */
}

.resume-flex-container .download-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0.5rem;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
  align-self: center;
  margin: 0;
}

.nav-icon {
  font-size: 1rem;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.sidebar-backdrop.active {
  display: block;
}

.sidebar-footer {
  color: #A6A6A6;
  font-size: 0.8rem;
  text-align: center;
  margin-top: auto;
  margin-bottom: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .sidebar-footer {
  border-top: 1px solid #374151;
}

/* Mobile responsive styles for hamburger menu */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .header-nav {
    display: none;
  }

  .site-header {
    padding: 0;
  }
}