
html {
  -webkit-text-size-adjust: 100%; /* For Safari/WebKit */
  text-size-adjust: 100%;       /* Standard */
}

body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: normal;
  margin: 0;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #fff;
  color: #000;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  width: 100%;
  overflow-x: hidden;
}

/* --- START: UNIVERSAL BODY LOCK --- */
/* This is the new, powerful class that will freeze the background */
body.body-lock {
  overflow: hidden;
}
/* --- END: UNIVERSAL BODY LOCK --- */


/* Keep existing night mode styles */
body.night-mode {
  background-color: #121212;
  color: #f0f0f0;
}

body.night-mode header,
body.night-mode footer {
  background-color: #1e1e1e;
}

body.night-mode nav a,
body.night-mode .info-dropdown a, /* Updated selector */
body.night-mode .footer-content a,
body.night-mode .footer-content p {
  color: #f0f0f0;
}

body.night-mode .info-dropdown {
  background-color: #1e1e1e;
  border-top-color: #333;
}

body.night-mode .info-dropdown a:hover {
  background-color: #333;
}

body.night-mode #about-me-section {
  background-color: rgba(18, 18, 18, 0.95);
}

body.night-mode #about-me-content {
  background-color: #1e1e1e;
}

body.night-mode #contact-section {
  background-color: rgba(18, 18, 18, 0.9);
}

body.night-mode #contact-form-container {
  background-color: #1e1e1e;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

body.night-mode .contact-message,
body.night-mode .required-message,
body.night-mode #contact-form label {
  color: #f0f0f0;
}

body.night-mode #contact-form input[type="text"],
body.night-mode #contact-form input[type="email"], /* <<< ADDED THIS LINE */
body.night-mode #contact-form textarea {
  background-color: #333;
  color: #f0f0f0;
  border-color: #555;
}
body.night-mode #contact-form input[type="text"]:focus,
body.night-mode #contact-form input[type="email"]:focus, /* <<< ADDED THIS LINE */
body.night-mode #contact-form textarea:focus {
    border-color: #5dade2;
    box-shadow: 0 0 0 2px rgba(93, 173, 226, 0.2);
}


body.night-mode #image-slideshow-overlay {
  background-color: rgba(0, 0, 0, 0.9);
}

body.night-mode #image-slideshow-container {
  background-color: #1a1a1a;
}

/* === NIGHT MODE SLIDESHOW ARROWS (Transparency & Hover) === */
body.night-mode #slide-prev,
body.night-mode #slide-next {
  background: rgba(30, 30, 30, 0.15);
  color: #f0f0f0;
}
body.night-mode #slide-prev:hover,
body.night-mode #slide-next:hover {
    background-color: rgba(60, 60, 60, 0.6);
}
/* === END NIGHT MODE SLIDESHOW ARROWS === */


/* --- FIX: Night Mode Prev/Next Project Button Transparency --- */
body.night-mode #prev-project,
body.night-mode #next-project {
  background: transparent; /* Fully transparent background */
  color: #f0f0f0; /* Keep light text */
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8); /* Add shadow for contrast */
  border: none; /* Ensure no border */
}
/* --- END FIX --- */
body.night-mode #prev-project:hover,
body.night-mode #next-project:hover {
    /* background-color: rgba(60, 60, 60, 0.9); */ /* Remove background on hover */
    transform: scale(1.05); /* Example hover effect: slight scale */
}

body.night-mode .slideshow-category-name {
  color: #ccc;
  text-shadow: none;
}

body.night-mode #submission-confirmation {
  background-color: #1e4e34;
  border-color: #2a6847;
  color: #a3d9b1;
}

/* --- START: Night Mode Bio Text Color --- */
body.night-mode .bio-text {
  color: #f0f0f0;
}
/* --- END: Night Mode Bio Text Color --- */

body.night-mode #about-me-content h1, /* Keep if needed, but likely overridden by .bio-text */
body.night-mode #about-me-content p { /* Keep if needed, but likely overridden by .bio-text */
  color: white; /* Fallback, but .bio-text should handle it */
}


body.night-mode .footer-right p {
  opacity: 0.7;
}

body.night-mode #index-section {
  background-color: rgba(18, 18, 18, 0.95);
  color: white;
}

body.night-mode #index-content {
  background-color: transparent;
}

body.night-mode .index-image-container {
  background-color: #444;
  border: 1px solid #555;
}
body.night-mode .index-image-container:hover {
    box-shadow: 0 4px 10px rgba(255,255,255,0.1);
}

/* ======================================== */
/* --- START: WORK IMAGE DIMENSION FIX --- */
/* ======================================== */
/* Remove night mode background from work image container */
body.night-mode .work-image {
    /* background-color: #222; */ /* REMOVED */
}
/* ======================================== */
/* --- END: WORK IMAGE DIMENSION FIX --- */
/* ======================================== */


header {
  padding: 16px;
  text-align: center;
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #fff;
  z-index: 1005;
  box-sizing: border-box;
  cursor: default;
  display: flex;
  justify-content: space-between;
  align-items: center ;
  transition: background-color 0.3s ease;
}
header nav a {
  color: black;
  text-decoration:none;
}
body.night-mode header nav a {
  color: #f0f0f0;
}


nav {
  display: flex;
  justify-content: space-between; /* Keep space-between for overall layout */
  align-items: center;
  width: 100%;
  max-width: 4500px;
  margin:  auto;
  position: relative; /* <<< ADDED for absolute positioning context of .nav-center */
}

.nav-left {
  display: flex;
  align-items: center;
  flex-shrink: 0; /* Prevent left side from shrinking */
}

/* --- MODIFICATION START: Header Centering Fix (Default for smaller screens) --- */
.nav-center {
  flex-grow: 1; /* Allow center to take up available space */
  text-align: center; /* Center the text within its space */
  /* Absolute positioning will be applied via media query for larger screens */
}
/* --- MODIFICATION END: Header Centering Fix --- */


header nav .nav-left {
  margin-left: 10px;
}

.nav-right {
    display: flex; /* Ensure right side is flex */
    align-items: center; /* Align items vertically */
    justify-content: flex-end; /* Align content to the right */
    flex-shrink: 0; /* Prevent right side from shrinking */
}

.nav-right > * {
  margin-left: 20px;
}

.nav-right > :first-child {
  margin-left: 0;
}

.nav-right > div.info-container,
.nav-right > a#index-link,
.nav-right > button#night-mode-toggle {
  display: inline-block;
  vertical-align: middle;
}

/* Corrected Night Mode Toggle Button CSS */
#night-mode-toggle {
  background-color: transparent;
  border: none;
  padding: 0;
  color: black;
  cursor: pointer;
  font-size: 1.5em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

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

body.night-mode #night-mode-toggle {
  color: white;
}

/* Original Info Section Styles */
.info-container {
  position: relative; /* CRUCIAL: Establishes positioning context */
  display: inline-flex;
  align-items: center;
}

.info-dropdown {
  display: none; /* Hidden by default */
  position: absolute; /* Position relative to .info-container */
  top: 100%; /* Position below the parent */
  left: 0; /* Align left edge with parent's left edge (Desktop default) */
  background-color: #fff;
  border-top: 1px solid #ccc;
  padding: 10px 0;
  min-width: 120px; /* Minimum width */
  z-index: 10;
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.3s ease, border-top-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.info-dropdown a {
  color: #000;
  padding: 8px 15px;
  text-decoration: none;
  display: block;
  font-size: 1em;
  font-weight: normal;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.info-dropdown a:hover {
  background-color: #f0f0f0;
}

/* Show on hover (if not using JS for click) */
.info-container:hover .info-dropdown {
  display: block;
}

/* --- FIX: Main Content Flexbox Centering --- */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1; /* This makes <main> fill the space between header and footer */
  padding: 20px;
  padding-top: 100px; /* Updated by JS */
  padding-bottom: 60px; /* Updated by JS */
  box-sizing: border-box;
}
/* --- END FIX --- */

/* --- FIX: Homepage Layout Rework (Flexbox) --- */
#homepage-content {
    display: flex;
    justify-content: center; /* Horizontally center content */
    align-items: center;   /* Vertically center content */
    flex-grow: 1;          /* Make this fill the entire <main> area */
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}
/* --- END FIX --- */

/* --- HOMEPAGE SLIDESHOW (ALL DEVICES) --- */
#homepage-slideshow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    min-width: 550px; /* Reduced from 600px for better large screen feel */
    min-height: 550px; /* Reduced from 600px for better large screen feel */
    overflow: hidden;
    margin: 0;
}

#homepage-slideshow img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    object-fit: contain;
    -webkit-touch-callout: none; /* ADDED: Prevent iOS long-press menu */
}

#homepage-slideshow img.active {
    opacity: 1;
}

#homepage-text-left {
  position: fixed;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

#homepage-text-right {
  position: fixed;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

/* --- Original Work Section Styles --- */
#work-section {
  flex-direction: column;
  align-items: flex-start;
  padding-top: 30px;
  box-sizing: border-box;
  margin-bottom: 80px;
  width: 100%;
  position: relative;
}

#work-section .work-item .work-title:hover,
#work-section .work-item .work-image img:hover {
  cursor: pointer;
}

#work-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

#work-content {
  display: flex;
  flex-direction: column; /* Keeps projects stacked vertically */
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin-bottom: 60px;
  position: relative;
}

.work-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 80px;
  padding: 15px;
  position: relative;
  flex-direction: row; /* Default: Title beside image */
  justify-content: center;
}

.work-item .work-title {
  position: absolute; /* Positioned by JS */
  top: 50%; /* Positioned by JS */
  transform: translateY(-50%); /* Positioned by JS */
  font-size: 0.8em;
  margin-bottom: 0;
  white-space: nowrap;
  font-weight: normal;
  z-index: 2;
}

.work-images-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-left: 0; /* Let JS handle title positioning */
  margin-right: 0;
  box-sizing: border-box;
}

/* ======================================== */
/* --- START: WORK IMAGE DIMENSION FIX --- */
/* ======================================== */

/* Base styles for the image container in the Work section */
.work-image {
  /* REMOVE width, max-width, max-height, background-color */
  /* Keep centering */
  display: flex;
  justify-content: center;
  align-items: center;

  /* Keep other relevant styles */
  box-sizing: border-box;
  margin-bottom: 10px; /* Adjust as needed */
  overflow: hidden; /* Keep if you want to clip absolutely positioned elements inside, otherwise remove */
  flex-shrink: 0;
}

/* Base styles for the image itself */
.work-image img {
  display: block;
  /* REMOVE width: 100%; */

  /* APPLY width/max-width constraints directly to the image */
  width: auto; /* Allow intrinsic width */
  max-width: min(70vw, 650px); /* Adjust values as needed: Limit to 70% viewport OR 650px */

  /* KEEP height: auto and object-fit */
  height: auto; /* CRITICAL: Maintain aspect ratio */
  object-fit: contain; /* Ensures the whole image is visible */

  /* Keep other relevant styles */
  cursor: pointer;
  -webkit-touch-callout: none; /* ADDED: Prevent iOS long-press menu */
}

/* ======================================== */
/* --- END: WORK IMAGE DIMENSION FIX --- */
/* ======================================== */


.work-item .work-images-container .work-image:not(:first-child) {
  display: none;
}
/* --- End Original Work Section Styles --- */

/* Slideshow active header styling */
#image-slideshow-overlay.slideshow-active + header {
    z-index: 1009;
    pointer-events: auto;
}

/* --- Footer (Original) --- */
footer {
  background-color: #fff;
  color: #000;
  padding: 10px;
  border-top: 0px solid #fff;
  width: 100%;
  margin-top: auto;
  box-sizing: border-box;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1003;
  transition: background-color 0.3s ease, color 0.3s ease, border-top-color 0.3s ease, display 0s linear 0.3s;
}

footer.transparent {
  background-color: transparent;
  border-top-color: transparent;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: normal;
  flex-wrap: wrap;
  max-width: 4500px;
  margin: 0 auto;
}

.footer-content a,
.footer-content p {
  margin: 5px 10px;
  white-space: nowrap;
  font-size: 0.8em;
  font-weight: normal;
  color: #000;
  opacity: 0.5;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.footer-content a {
  text-decoration: none;
}
.footer-content a:hover {
  opacity: 1;
}

.footer-right {
  text-align: right;
  flex-basis: auto;
}

/* --- About Me Overlay (Original + Language Toggle Additions) --- */
#about-me-section {
  display: none;
  justify-content: center;
  align-items: flex-start; /* Changed to flex-start for long bios */
  position: fixed;
  top:0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 1004;
  overflow-y: auto; /* Allow scrolling for the whole overlay if content overflows */
  padding: 20px;
  box-sizing: border-box;
  text-align: center;
  transition: background-color 0.3s ease;
}

#about-me-content {
  background-color: white;
  border-radius: 8px;
  padding: 30px; /* Base padding */
  padding-top: 45px; /* Add padding to prevent text overlap with button */
  max-width: 800px;
  width: 80%;
  margin: 100px auto 40px; /* Adjusted margin for scrolling */
  text-align: center;
  transition: background-color 0.3s ease;

  position: relative; /* Needed for absolute positioning of the button */
}

/* --- START: Language Toggle & Bio Text Styles --- */
#language-toggle {
  position: absolute;
  top: 15px; /* Adjust spacing from top */
  right: 15px; /* Adjust spacing from right */
  background: none;
  border: 1px solid transparent; /* Make border transparent by default */
  padding: 3px 8px; /* Add some padding */
  font-size: 0.9em; /* Adjust font size for EN/GR */
  font-weight: bold;
  color: #555; /* Default color */
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

#language-toggle:hover {
  transform: scale(1.05);
  color: #000;
  border-color: #ccc; /* Show border on hover */
  background-color: #f0f0f0;
}

body.night-mode #language-toggle {
    color: #bbb;
}
body.night-mode #language-toggle:hover {
    color: #fff;
    border-color: #555;
    background-color: #333;
}


.bio-text {
  /* Base font size - adjust as needed for desktop visibility */
  font-size: 1.05em; /* Approx 14.7px if body is 14px */
  line-height: 1.6;
  color: #000; /* Default text color */
  text-align: left; /* Align text to the left */
}

.bio-text p {
  margin-bottom: 1em; /* Space between paragraphs */
  font-style: normal; /* Override potential italic from old styles */
  font-weight: normal; /* Override potential bold from old styles */
  /* Inherit font-size and color from .bio-text */
}

/* Reset old h1/p styles if they were specific */
#about-me-content h1 {
    /* Reset or remove styles if h1 is no longer used here */
    font-size: 1em; /* Example reset */
    font-weight: normal;
    margin-bottom: 1em;
    color: inherit; /* Inherit from parent */
}
/* --- END: Language Toggle & Bio Text Styles --- */


/* --- Index Section (Original) --- */
#index-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 1004;
  overflow-y: auto;
  padding: 80px 20px 40px 20px;
  box-sizing: border-box;
  text-align: center;
  display: none;
  transition: background-color 0.3s ease;
}

#index-content {
  max-width: 90%;
  margin: 50px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  justify-items: center;
  background-color: transparent;
}

.index-image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.index-image-container:hover {
  transform: scale(1.03);
}

.index-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-touch-callout: none; /* ADDED: Prevent iOS long-press menu */
}

/* --- Contact Section (Original) --- */
#contact-section {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 1004;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  transition: background-color 0.3s ease;
}

#contact-form-container {
  background-color: #fff;
  padding: 30px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.contact-message {
  margin-bottom: 10px;
  font-size: 1em;
  color: #333;
  transition: color 0.3s ease;
}

.required-message {
  font-size: 0.9em;
  color: #777;
  margin-bottom: 20px;
  transition: color 0.3s ease;
}

.required-asterisk {
  color: red;
  font-size: 1.2em;
  margin-left: 2px;
}

#contact-form {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#contact-form div {
  margin-bottom: 25px;
  text-align: left;
  width: 100%;
}

#contact-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 1em;
  color: #444;
  transition: color 0.3s ease;
}

#contact-form input[type="text"],
#contact-form input[type="email"], /* <<< ADDED THIS LINE */
#contact-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.2s ease;
}
#contact-form input[type="text"]:focus,
#contact-form input[type="email"]:focus, /* <<< ADDED THIS LINE */
#contact-form textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* --- Image Slideshow Overlay --- */
#image-slideshow-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1008;
  display: none;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

#image-slideshow-container {
  background-color: #fff;
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s ease;
}

#horizontal-scroll-wrapper {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  width: 100%;
  height: calc(100% - 80px);
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  margin-top: 40px;
  margin-bottom: 40px;
}

#horizontal-scroll-wrapper > div.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

#horizontal-scroll-wrapper img {
  max-width: 50%; /* Base desktop size */
  max-height: 70%; /* Base desktop size */
  object-fit: contain;
  display: block;
  -webkit-touch-callout: none; /* ADDED: Prevent iOS long-press menu */
}

/* === SLIDESHOW ARROWS (Base, Transparency, Wider Angle) === */
#slide-prev,
#slide-next {
  background: rgba(255, 255, 255, 0.7);
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.5em;
  z-index: 1009;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scaleX(1.5);
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, visibility 0.2s ease; /* Added visibility transition */
  color: black;
}

/* === START: CORRECTED ARROW ANIMATION === */
/* Change background on hover for visual feedback */
#slide-prev:hover,
#slide-next:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

/* Apply scale effect only on active press */
#slide-prev:active,
#slide-next:active {
  transform: translateY(-50%) scaleX(1.5) scale(1.1);
}

/* Ensure night mode hover still works */
body.night-mode #slide-prev:hover,
body.night-mode #slide-next:hover {
    background-color: rgba(60, 60, 60, 0.6);
}
/* === END: CORRECTED ARROW ANIMATION === */

#slide-prev {
  left: 10px;
}

#slide-next {
  right: 10px;
}

/* --- FIX: Prev/Next Project Button Z-INDEX --- */
#prev-project,
#next-project {
  position: absolute;
  bottom: 20px;
  background: transparent;
  border: none;
  padding: 25px 30px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  z-index: 1011; /* SOLUTION: HIGHER THAN THE FOOTER'S 1010 */
  transition: color 0.3s ease, text-shadow 0.3s ease, transform 0.2s ease;
  color: black;
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* --- END FIX --- */

#prev-project:hover,
#next-project:hover {
  transform: scale(1.05);
}

#prev-project {
  left: 20px;
}

#next-project {
  right: 20px;
}

/* =================================================================== */
/* === UNIFIED OVERLAY SYSTEM: Header/Footer on Top === */
/* =================================================================== */
/* When the body has the .overlay-active class, bring header/footer to the top */
body.overlay-active header,
body.overlay-active footer {
  background-color: transparent !important;
  border-top-color: transparent !important;
  pointer-events: auto;
  z-index: 1010; /* This is the key: brings them in front of the overlays */
  transition: background-color 0.3s ease, border-top-color 0.3s ease;
}

/* Also control the text opacity for consistency */
body.overlay-active header a,
body.overlay-active footer p,
body.overlay-active footer a {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}
body.overlay-active header a:hover,
body.overlay-active footer a:hover {
    opacity: 1;
}

/* Repositioned Slideshow Category Name */
.slideshow-category-name {
  position: fixed; /* Changed from absolute to fixed */
  left: 20px;
  top: 75px; /* Adjust as needed based on header height */
  font-size: 1.1em;
  font-weight: 200;
  color: #555;
  text-shadow: none;
  white-space: nowrap;
  transition: color 0.3s ease;
  z-index: 1010; /* Ensure it's above images and potentially overlay elements */
  pointer-events: none; /* Make sure it doesn't interfere with clicks */
}
body.night-mode .slideshow-category-name {
    color: #ccc;
}


/* --- Contact Form Submit Button --- */
.submit-button-wrapper {
  margin-top: 25px;
  text-align: center;
  width: 100%;
}

#submit-contact-button {
  padding: 10px 25px;
  font-size: 1.1em;
  font-weight: bold;
  color: #fff;
  background-color: #cccccc;
  border: none;
  border-radius: 5px;
  cursor: not-allowed;
  opacity: 0.6;
  transition: background-color 0.3s ease, opacity 0.3s ease, transform 0.1s ease;
}

#submit-contact-button:not(:disabled) {
  background-color: #3498db;
  cursor: pointer;
  opacity: 1;
}

#submit-contact-button:not(:disabled):hover {
  background-color: #2980b9;
  transform: scale(1.03);
}

#submit-contact-button:not(:disabled):active {
    transform: scale(0.98);
}

/* --- Night Mode Submit Button Styles --- */
body.night-mode .submit-button-wrapper { }

body.night-mode #submit-contact-button {
    background-color: #444;
    color: #888;
}

body.night-mode #submit-contact-button:not(:disabled) {
    background-color: #5dade2;
    color: #1a1a1a;
}

body.night-mode #submit-contact-button:not(:disabled):hover {
    background-color: #85c1e9;
    transform: scale(1.03);
}

body.night-mode #submit-contact-button:not(:disabled):active {
    transform: scale(0.98);
}

/* Submission Confirmation */
#submission-confirmation {
  display: none;
  margin-top: 20px;
  padding: 10px;
  background-color: #dff0d8;
  border: 1px solid #d6e9c6;
  color: #3c763d;
  border-radius: 5px;
  font-size: 0.9em;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/* Hidden Work Titles Container */
#work-titles-container { display: none; }

/* Transparent Header/Footer over Work Section */
.transparent-over-work {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-top-color: rgba(238, 238, 238, 0.8) !important;
    transition: background-color 0.3s ease, border-top-color 0.3s ease;
}
body.night-mode .transparent-over-work {
    background-color: rgba(30, 30, 30, 0.8) !important;
    border-top-color: rgba(51, 51, 51, 0.8) !important;
}

/* --- Media Queries --- */

/* --- Tablet Media Query --- */
@media (max-width: 768px) {
  #homepage-slideshow {
    /* Adjust size constraints for tablet */
    max-width: 75vw;
    max-height: 75vh;
    min-width: 250px;
    min-height: 250px;
    /* FIX: Nudge slideshow up for visual centering on tablets */
    transform: translate(-50%, -65%);
  }

  .bio-text {
    font-size: 1em;
  }
  #language-toggle {
    top: 12px;
    right: 12px;
  }
  #about-me-content {
    padding-top: 40px;
    margin-top: 80px;
    width: 90%;
  }

  main {
    padding-top: 90px;
    padding-bottom: 50px;
  }
}

/* --- Desktop Centering of .nav-center --- */
@media (min-width: 769px) {
  .nav-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    flex-grow: 0;
  }
}

/* --- Mobile Media Query --- */
@media (max-width: 568px) {

  /* --- Footer Fix --- */
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    border-top: 1px solid #eee;
    margin-top: 0;
    z-index: 1003;
  }
  body.night-mode footer {
    border-top-color: #333;
  }
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .footer-content > * { margin: 5px 0; }
  .footer-left, .footer-right { text-align: center; width: 100%; }
  
  /* --- Main Content Padding --- */
  main {
    padding-top: 90px;
    padding-bottom: 60px;
    padding-left: 10px;
    padding-right: 10px;
    /* flex-grow is already set on the base main style */
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  /* --- Homepage Layout Rework (FIXED) --- */
  #homepage-content {
      /* Flexbox properties are inherited from the base style */
      position: relative;
      overflow: hidden;
  }
  #homepage-text-left,
  #homepage-text-right {
      display: none;
  }
  #homepage-slideshow {
      position: absolute;
      top: 50%;
      left: 50%;
      /* FIX: Nudge slideshow up for visual centering on phones */
      transform: translate(-50%, -65%);
      min-width: 0;
      min-height: 0;
      width: 280px;
      height: 280px;
  }
  
  /* === START: ROBUST MOBILE CONTACT FORM FIX === */
  #contact-section {
    padding-top: 80px;
    padding-bottom: 60px;
    justify-content: center;
    align-items: flex-start;
    display: flex;
    overflow-y: auto;
  }
  #contact-form-container {
    margin: 20px 0;
    max-width: 90%;
    padding: 20px;
    display: flex;
    flex-direction: column;
  }
   #contact-form div {
     margin-bottom: 15px;
   }
   #contact-form textarea {
     min-height: 80px;
     height: 100px;
   }
   .submit-button-wrapper {
     margin-top: 15px;
   }
  /* === END: ROBUST MOBILE CONTACT FORM FIX === */

  /* --- About me mobile styles --- */
  #about-me-section {
      padding-top: 80px;
      align-items: flex-start;
      padding-bottom: 60px;
  }
  #about-me-content {
      margin-top: 20px;
      width: 90%;
      padding: 20px;
      padding-top: 35px;
      padding-left: 15px;
      padding-right: 15px;
      margin-bottom: 20px;
  }
  .bio-text {
    font-size: 0.95em;
    line-height: 1.55;
  }
  #language-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: 1px solid #cccccc;
    padding: 4px 10px;
    font-size: 0.65em;
    font-weight: bold;
    color: #444444;
    cursor: pointer;
    line-height: 1;
    border-radius: 4px;
    transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  }
  #language-toggle:hover {
    transform: scale(1.05);
    color: #000000;
    border-color: #aaaaaa;
    background-color: #f5f5f5;
  }
  body.night-mode #language-toggle {
      color: #cccccc;
      border-color: #555555;
      background-color: rgba(45, 45, 45, 0.5);
  }
  body.night-mode #language-toggle:hover {
      color: #ffffff;
      border-color: #777777;
      background-color: #383838;
  }

  /* --- Work Section Mobile Fixes (Title Above Image) --- */
  #work-section {
    padding-top: 0px;
    padding-left: 10px;
    padding-right: 0px;
    left: 0px;
    align-items: center;
    padding-bottom: 60px;
  }
  #work-content-wrapper {
    display: flex;
    width: 100%;
    margin: 0 auto;
    padding: 0px;
    box-sizing: border-box;
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
  #work-content {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    padding-left: 0;
    flex-direction: column;
    align-items: center;
  }
  #work-titles-column { display: none; }

 .work-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0px;
    position: relative;
    margin-bottom: 80px;
    width: 100%;
    max-width: 100%;
  }
  .work-item .work-title {
    position: static;
    order: -1;
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
    left: auto;
    top: auto;
    transform: none;
    z-index: auto;
    font-size: 0.8em;
    white-space: normal;
    font-weight: normal;
  }
  .work-images-container {
      width: auto;
      margin: 0;
      display: flex;
      justify-content: center;
      order: 0;
      margin-left: 0px;
  }
  .work-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    margin-bottom: 10px;
    overflow: hidden;
  }
  .work-image img {
    display: block;
    width: auto;
    max-width: min(80vw, 550px);
    height: auto;
    object-fit: contain;
    cursor: pointer;
  }

  /* --- Header/Nav mobile styles --- */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    z-index: 1005;
    box-sizing: border-box;
  }
  body.night-mode header { background-color: #1e1e1e; }
  nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .nav-right > * { margin-left: 10px; }
  .nav-right > :first-child { margin-left: 0; }
  .info-container {
    position: relative;
  }
  .info-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: auto;
    width: max-content;
    text-align: left;
    white-space: nowrap;
    display: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #fff;
    border-top: 1px solid #ccc;
    padding: 10px 0;
    z-index: 10;
  }
  body.night-mode .info-dropdown {
      background-color: #1e1e1e;
      border-top-color: #333;
  }
  body.night-mode .info-dropdown a {
     color: #f0f0f0;
  }
   body.night-mode .info-dropdown a:hover {
     background-color: #333;
  }
  .info-container:hover .info-dropdown {
     display: block;
  }

  /* --- Index mobile styles --- */
  #index-section {
      padding-top: 80px;
      padding-bottom: 60px;
  }
  #index-content {
    margin-top: 20px;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
  }

  /* --- Work Slideshow mobile styles --- */
  #image-slideshow-overlay {
      z-index: 1008;
  }
  #image-slideshow-container {
      padding: 0;
      height: 100vh;
      width: 100%;
  }
  #horizontal-scroll-wrapper {
    height: calc(100% - 60px - 30px);
    padding-left: 0;
    scroll-padding-left: 0;
    margin-top: 30px;
    margin-bottom: 30px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
   #horizontal-scroll-wrapper > div.slide {
        flex: 0 0 100%;
        width: 100%;
        scroll-snap-align: center;
        box-sizing: border-box;
   }
  #horizontal-scroll-wrapper img {
      max-height: 70%;
      max-width: 70%;
      object-fit: contain;
      display: block;
  }
  #slide-prev, #slide-next {
      display: block;
      padding: 8px 10px;
      font-size: 1.3em;
      transform: translateY(-50%) scaleX(1.3);
  }
  #slide-prev { left: 5px; }
  #slide-next { right: 5px; }
  #prev-project,
  #next-project {
    bottom: 90px;
    font-size: 0.7em;
    padding: 6px 10px;
    text-shadow: none;
  }
   #prev-project {
     left: -8px;
   }
   #next-project {
     right: -8px;
   }
  .slideshow-category-name {
    position: fixed;
    top: 75px;
    left: 10px;
    font-size: 1em;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 1010;
    pointer-events: none;
  }
  body.night-mode .slideshow-category-name {
      background-color: rgba(30, 30, 30, 0.8);
      color: #ccc;
  }
}

/* =================================================================== */
/* === STABILITY FIX: MOBILE LANDSCAPE REFACTORED WITHOUT !important === */
/* =================================================================== */
@media (orientation: landscape) and (max-height: 568px) {

  /* --- Header Name Centering for Mobile Landscape --- */
  header .nav-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    flex-grow: 0;
  }

  /* --- FIX: Homepage Slideshow fix for Mobile Landscape (non-scrollable) --- */
  main #homepage-slideshow {
    position: absolute;
    top: 50%;
    left: 50%;
    /* FIX: Nudge slideshow up for visual centering in landscape */
    transform: translate(-50%, -55%);
    min-width: 0;
    min-height: 0;
    /* Use viewport height (the shorter side) to ensure it fits */
    width: 70vh;
    height: 70vh;
    max-width: 70vh;
    max-height: 70vh;
  }
  /* --- END FIX --- */

  /* --- Slideshow Image Adjustments --- */
  #image-slideshow-container #horizontal-scroll-wrapper img {
    max-height: 70vh;
    max-width: 60vw;
  }
  
  #image-slideshow-container #prev-project,
  #image-slideshow-container #next-project {
    font-size: 0.8em; 
    bottom: 15px;
  }

  /* --- Index Page Thumbnail Fix --- */
  #index-section #index-content {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
  }

  /* --- Work Preview Image & Title Adjustments --- */
  #work-content-wrapper .work-item {
    align-items: flex-start;
    text-align: left;
  }
  #work-content-wrapper .work-item .work-title {
    text-align: left;
    margin-bottom: 8px;
    font-size: 0.8em;
  }
  #work-content-wrapper .work-item .work-images-container .work-image img {
    max-height: 65vh;
    max-width: min(80vw, 450px);
  }

  /* --- About Me Section Adjustments (Robust Fix) --- */
  #about-me-section {
    padding-top: 60px;
    padding-bottom: 40px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
  }
  #about-me-section #about-me-content {
    padding: 15px 20px;
    margin: 15px 0;
    width: 90%;
  }
  #about-me-section .bio-text {
    font-size: 0.85em;
    line-height: 1.5;
  }

  /* --- Contact Section Adjustments (Robust Fix) --- */
  #contact-section {
    padding-top: 60px;
    padding-bottom: 50px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
  }
  #contact-section #contact-form-container {
    padding: 15px;
    margin: 15px 0;
    max-width: 90vw;
    width: auto;
  }
  #contact-section #contact-form-container .contact-message,
  #contact-section #contact-form-container .required-message {
    font-size: 0.8em;
    margin-bottom: 8px;
  }
  #contact-section #contact-form label {
    font-size: 0.85em;
  }
  #contact-section #contact-form textarea {
    min-height: 60px;
  }

  /* --- Footer Font Size Fix --- */
  footer .footer-content p {
    font-size: 0.7em;
  }
}
/* =================================================================== */
/* === END OF STABILITY FIX BLOCK ==================================== */
/* =================================================================== */

/* REMOVED .homepage-no-scroll from here as it's now handled by the universal .body-lock */

/* --- Scale down specific work preview images (:nth-child) --- */
#work-content > .work-item:nth-child(6) .work-image img,
#work-content > .work-item:nth-child(10) .work-image img {
  max-width: min(50vw, 450px);
}
@media (max-width: 568px) {
  #work-content > .work-item:nth-child(6) .work-image img,
  #work-content > .work-item:nth-child(10) .work-image img {
    max-width: min(70vw, 320px);
  }
}

/* --- Media Query for Large Desktop Screens --- */
@media (min-width: 1600px) {
  /* 1. Make all font sizes slightly smaller */
  body {
    font-size: 13px;
  }

  /* 2. Make Work Section preview images smaller */
  .work-image img {
    max-width: min(60vw, 550px); /* Reduced from 650px */
  }

  /* 3. Also specifically reduce the size of the extra-large preview images */
  #work-content > .work-item:nth-child(6) .work-image img,
  #work-content > .work-item:nth-child(10) .work-image img {
    max-width: min(40vw, 400px); /* Reduced from 450px */
  }
}


/* --- Media Query for Very Large Screens --- */
@media (min-width: 1921px) {
  #homepage-slideshow {
    min-width: 850px;
    min-height: 850px;
  }
}

/* =================================================================== */
/* === ROBUST FIX: Slideshow State Management                      === */
/* =================================================================== */

/* When the main work slideshow is active, make the header transparent
   to clicks, but keep the nav links inside it clickable. */
body.slideshow-is-active header {
  pointer-events: none;
}
body.slideshow-is-active header > nav {
  pointer-events: auto;
}

/* When the slideshow is active, just hide the footer.
   This is simpler and more reliable than z-index or pointer-events battles. */
body.slideshow-is-active footer {
  display: none;
}

/* =================================================================== */
/* === ELEGANT CUE: Clickable Work Image Indicator for Mobile      === */
/* =================================================================== */

/* This rule will only apply on devices that don't support hover (like tablets and phones) */
/* =================================================================== */
/* === ELEGANT CUE (METHOD 1): Breathing Icon for Work Images      === */
/* =================================================================== */

/* 1. Define the "breathing" animation */