/* ===== VARIABLES ===== */
:root {
  --primary-color: #ec8f06;
  --background-color: #201d19;
  --text-color: #ffffff;
  --sidebar-color: #404042;
  --card-color: #2a2724;
  --border-color: #3a3a3c;
  --hover-color: #f09c1a;
  --transition: all 0.3s ease;
  --sidebar-width: 60px;
  --header-height: 80px;
}

/* Light mode variables */
.light-mode {
  --background-color: #f5f5f5;
  --text-color: #333333;
  --card-color: #ffffff;
  --border-color: #dddddd;
  --sidebar-color: #e0e0e0;
}

/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  /* Prevent zoom on mobile */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  transition: var(--transition);
  /* Prevent zoom and movement on mobile */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  position: relative;
  min-height: 100vh;
  width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
  /* Prevent tap highlight on mobile */
  -webkit-tap-highlight-color: transparent;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  /* Prevent image dragging on mobile */
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* Prevent text selection on mobile to reduce movement */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection for content areas */
p,
span,
h1,
h2,
h3,
h4,
h5,
h6,
input,
textarea {
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ===== BACKGROUND LINES ===== */
.bg-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: -1;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  height: 100vh;
}

.line {
  width: 1px;
  height: 100%;
  background-color: var(--primary-color);
  opacity: 0.175;
}

/* ===== HEADER ===== */
header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: var(--sidebar-width);
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 100;
  background-color: rgba(32, 29, 25, 0.8);
  backdrop-filter: blur(10px);
  transition: var(--transition);
  /* Prevent header movement on mobile */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

.light-mode header {
  background-color: rgba(245, 245, 245, 0.8);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  max-width: 50px;
  cursor: pointer;
}

.logo span {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  width: 200px;
}

.desktop-menu {
  display: flex;
  gap: 30px;
}

.desktop-menu a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  position: relative;
  transition: var(--transition);
}

.desktop-menu a:hover,
.desktop-menu a.active {
  color: var(--primary-color);
}

.desktop-menu a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.desktop-menu a:hover::after,
.desktop-menu a.active::after {
  width: 100%;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  z-index: 102;
}

.hamburger span {
  display: block;
  width: 30px;
  height: 2px;
  background-color: var(--text-color);
  transition: var(--transition);
}

/* ===== MOBILE MENU ===== */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 300px;
  height: 100vh;
  background-color: var(--card-color);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: none;
  transition: right 0.5s ease;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  border-left: 1px solid var(--border-color);
}

.mobile-menu.active {
  right: 0;
  transform: none;
}

.mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 30px;
  text-align: center;
  width: 100%;
  padding: 0 20px;
}

.mobile-menu a {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
  transition: var(--transition);
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu a:hover {
  color: var(--primary-color);
  transform: translateX(10px);
}

.hamburger {
  z-index: 102;
}

.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);
}

/* ===== SIDEBARS ===== */
.sidebar {
  position: fixed;
  top: 0;
  width: var(--sidebar-width);
  background-color: var(--sidebar-color);
  z-index: 100;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  /* Prevent sidebar movement on mobile */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

.left-sidebar {
  left: 0;
  top: 180px;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-top-right-radius: 30px;
  gap: 55px;
}

.right-sidebar {
  right: 0;
  bottom: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-bottom-left-radius: 30px;
  gap: 60px;
}

.social-icon {
  color: var(--text-color);
  transition: var(--transition);
  width: 30px;
  height: 40px;
}

.social-icon:hover {
  color: var(--primary-color);
  transform: translateY(-3px);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 80px;
  width: 50px;
  height: 50px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.theme-toggle svg {
  color: var(--background-color);
}

.sun-icon {
  display: none;
}

.light-mode .sun-icon {
  display: block;
}

.light-mode .moon-icon {
  display: none;
}

/* ===== MAIN CONTENT ===== */
main {
  margin-left: var(--sidebar-width);
  margin-right: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  /* Prevent main content movement */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

section {
  padding: 100px 0;
}

.section-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
}

.highlight {
  color: var(--primary-color);
}

/* ===== HERO SECTION ===== */
.hero-section {
  height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section h1 {
  font-size: 60px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
}

.hero-section p {
  font-size: 18px;
  max-width: 600px;
  margin-bottom: 40px;
}

.buttons {
  display: flex;
  gap: 20px;
}

.btn {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 30px;
  font-weight: 500;
  letter-spacing: 1px;
  transition: var(--transition);
  cursor: pointer;
}

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

.primary-btn:hover {
  background-color: var(--hover-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--primary-color);
}

.secondary-btn:hover {
  background-color: var(--primary-color);
  color: var(--background-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Animation for text reveal */
.reveal-text {
  opacity: 0;
  transform: translateY(30px);
  animation: revealText 1s forwards;
}

.delay-1 {
  animation-delay: 0.3s;
}

.delay-2 {
  animation-delay: 0.6s;
}

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

/* ===== ABOUT SECTION ===== */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: flex-start;
}

.about-text p {
  margin-bottom: 20px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.image-container {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* FIXED: Consistent rotation at all screen sizes */
.image-container img {
  /* Ensure consistent animation across all screen sizes */
  animation: spin 30s linear infinite;
  animation-fill-mode: both;
  animation-play-state: running;

  /* Maintain aspect ratio and prevent distortion */
  opacity: 0.25;
  width: 100%;
  max-width: 700px;
  height: auto;
  object-fit: contain;

  /* Ensure rotation center stays consistent */
  transform-origin: center center;

  /* Prevent any transition interference with animation */
  transition: max-width 0.3s ease, opacity 0.3s ease;

  /* Ensure the image maintains its intrinsic dimensions */
  aspect-ratio: 1 / 1;
  object-position: center;
}

/* Continuous rotation keyframes - no interruption */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.image-container::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  border: 2px solid var(--primary-color);
  border-radius: 10px;
  z-index: -1;
}

/* ===== SERVICES SECTION ===== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
}

.service-card {
  background-color: var(--card-color);
  border-radius: 10px;
  padding: 30px;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.service-icon {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.service-card h3 {
  font-size: 20px;
  margin-bottom: 15px;
}

/* ===== DESIGN SECTION ===== */
.design-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 50px;
}

.design-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  border: 1px solid #3a3a3c;
}

.design-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.design-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
}

.design-item:hover img {
  transform: scale(1.05);
}

.design-item:hover .design-overlay {
  opacity: 1;
  transform: translateY(0);
}

.design-overlay h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.design-overlay p {
  font-size: 14px;
  opacity: 0.8;
  color: #ec8f06;
}

.center-button {
  text-align: center;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.design-item.new-item {
  animation: fadeInUp 0.5s ease forwards;
}

/* ===== PROJECT SECTION ===== */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.project-card {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 30px;
  align-items: center;
}

.project-card:nth-child(even) {
  direction: rtl;
}

.project-card:nth-child(even) .project-info {
  direction: ltr;
}

.project-image {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 350px;
  cursor: pointer;
}

.project-info h3 {
  font-size: 20px;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.project-info p {
  margin-bottom: 15px;
}

.project-link {
  display: inline-block;
  font-weight: 500;
  color: var(--primary-color);
  position: relative;
}

.project-link::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.project-link:hover::after {
  width: 100%;
}

/* ===== CONTACT SECTION ===== */
.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
}

.contact-info p {
  margin-bottom: 30px;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.form-group {
  margin-bottom: 20px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 15px;
  background-color: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-color);
  font-family: "Poppins", sans-serif;
  transition: var(--transition);
  /* Prevent zoom on focus for mobile */
  font-size: 16px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
}

.contact-form .primary-btn {
  background-color: var(--primary-color);
  color: var(--background-color);
  font-weight: 600;
  padding: 14px 32px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(236, 143, 6, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  border: none;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  letter-spacing: 1px;
}

.contact-form .primary-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(236, 143, 6, 0.4);
}

.contact-form .primary-btn:active {
  transform: translateY(-1px);
}

.contact-form .primary-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.contact-form .primary-btn:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.form-status-message {
  margin-top: 15px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
  display: none;
  transition: all 0.3s ease;
}

/* ===== FOOTER ===== */
footer {
  margin-left: var(--sidebar-width);
  margin-right: var(--sidebar-width);
  background-color: var(--card-color);
  padding: 60px 40px 30px;
  position: relative;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo img {
  max-width: 50px;
}

.footer-logo span {
  width: 200px;
}

.footer-links {
  display: flex;
  gap: 30px;
}

.footer-links a {
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary-color);
}

.footer-social {
  display: flex;
  gap: 20px;
}

.copyright {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
  opacity: 0.7;
}

.scroll-top {
  position: absolute;
  top: -25px;
  right: 40px;
  width: 50px;
  height: 50px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--background-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
}

.scroll-top.active {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* ===== MODAL STYLES ===== */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.modal {
  background-color: var(--card-color);
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-container.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--primary-color);
}

.modal-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

/* Gallery Styles */
.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.gallery-main {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
}

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

.gallery-thumbnails {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.gallery-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.gallery-thumbnail.active {
  border-color: var(--primary-color);
}

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

.gallery-description {
  padding: 20px 0;
}

.gallery-title {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.gallery-container.portrait-mode {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  height: 70vh;
  overflow: hidden;
}

.gallery-container.portrait-mode .gallery-main {
  height: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.gallery-container.portrait-mode .gallery-main img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.gallery-container.portrait-mode .gallery-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 70vh;
  padding-right: 10px;
}

.gallery-container.portrait-mode .gallery-thumbnail {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.gallery-container.portrait-mode .gallery-thumbnail:hover {
  transform: translateX(-5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gallery-container.portrait-mode .gallery-thumbnail.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.gallery-container.portrait-mode .gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-container.portrait-mode .gallery-thumbnail:hover img {
  transform: scale(1.05);
}

.gallery-container.portrait-mode .gallery-thumbnails::-webkit-scrollbar {
  width: 6px;
}

.gallery-container.portrait-mode .gallery-thumbnails::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.gallery-container.portrait-mode .gallery-thumbnails::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.gallery-container.portrait-mode .gallery-thumbnails::-webkit-scrollbar-thumb:hover {
  background: var(--hover-color);
}

.gallery-description {
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}

.gallery-title {
  font-size: 24px;
  margin-bottom: 15px;
  color: var(--primary-color);
  font-weight: 600;
}

.gallery-text {
  line-height: 1.6;
}

.case-study-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.case-study-header {
  text-align: center;
  margin-bottom: 20px;
}

.case-study-title {
  font-size: 28px;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.case-study-subtitle {
  font-size: 16px;
  opacity: 0.8;
}

.case-study-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.case-study-image {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.case-study-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.case-study-image:hover img {
  transform: scale(1.05);
}

.case-study-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.case-study-section h4 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.social-icon img {
  width: 24px;
  height: 24px;
  transition: var(--transition);
  filter: brightness(0.9);
}

.social-icon:hover img {
  transform: translateY(-3px);
  filter: brightness(1);
}

.modern-gallery {
  background-color: var(--card-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 1200px;
  width: 95%;
  max-height: 90vh;
}

.modern-gallery .modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modern-gallery .modal-content {
  padding: 0;
  overflow: hidden;
  max-height: calc(90vh - 70px);
}

.modern-gallery .gallery-container {
  display: grid;
  grid-template-columns: 3fr 1fr;
  height: calc(90vh - 70px);
}

.modern-gallery .gallery-main {
  position: relative;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modern-gallery .gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-navigation {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 5;
}

.gallery-nav {
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.gallery-nav:hover {
  opacity: 1;
  background-color: var(--primary-color);
  transform: scale(1.1);
}

.gallery-info {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  height: 100%;
}

.gallery-details {
  padding: 30px;
  flex: 1;
  overflow-y: auto;
}

.gallery-details .gallery-title {
  font-size: 24px;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.gallery-details .gallery-text {
  line-height: 1.7;
  font-size: 15px;
}

.modern-gallery .gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 30px 20px;
  max-height: 200px;
  overflow-y: auto;
}

.modern-gallery .gallery-thumbnail {
  width: 100%;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.modern-gallery .gallery-thumbnail:hover {
  opacity: 0.9;
  transform: translateY(-3px);
}

.modern-gallery .gallery-thumbnail.active {
  border-color: var(--primary-color);
  opacity: 1;
}

.gallery-counter {
  padding: 15px 30px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-container.pdf-scroll-mode {
  display: grid;
  grid-template-columns: 3fr 1fr;
  height: calc(90vh - 70px);
  overflow: hidden;
}

.gallery-scroll-container {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) rgba(0, 0, 0, 0.1);
}

.gallery-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.gallery-scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.gallery-scroll-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.gallery-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--hover-color);
}

.gallery-scroll-image {
  height: 100%;
  display: flex;
  align-items: start;
  justify-content: center;
  scroll-snap-align: start;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 100%;
}

.gallery-scroll-image img {
  width: auto;
  height: 80vh;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  transition: transform 0.3s ease;
  margin: 0 auto;
  display: block;
}

.pdf-scroll-mode .gallery-navigation {
  flex-direction: column;
  height: 100%;
  width: auto;
  right: 20px;
  padding: 0;
}

.pdf-scroll-mode .gallery-nav.prev {
  transform: rotate(90deg);
  margin-bottom: 20px;
}

.pdf-scroll-mode .gallery-nav.next {
  transform: rotate(90deg);
}

.pdf-scroll-mode + .gallery-info .gallery-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 10px;
}

.pdf-scroll-mode + .gallery-info .gallery-thumbnail {
  width: 100%;
  height: 60px;
  border-radius: 5px;
}

.page-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 1200px) {
  .hero-section h1 {
    font-size: 50px;
  }

  .section-title {
    font-size: 32px;
  }
}

@media (max-width: 992px) {
  .about-content,
  .contact-container {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .project-card:nth-child(even) {
    direction: ltr;
  }

  .hero-section h1 {
    font-size: 40px;
  }

  .gallery-container.portrait-mode {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
  }

  .gallery-container.portrait-mode .gallery-main {
    max-height: 50vh;
  }

  .gallery-container.portrait-mode .gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .modern-gallery .gallery-container {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
  }

  .modern-gallery .gallery-main {
    height: 50vh;
  }

  .modern-gallery .gallery-info {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .modern-gallery .gallery-thumbnails {
    grid-template-columns: repeat(4, 1fr);
    max-height: none;
  }

  .gallery-container.pdf-scroll-mode {
    grid-template-columns: 1fr;
    height: auto;
  }

  .gallery-scroll-container {
    height: 60vh;
  }

  .pdf-scroll-mode + .gallery-info .gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-height: none;
    overflow-y: visible;
  }

  .pdf-scroll-mode .gallery-navigation {
    flex-direction: row;
    height: auto;
    width: 100%;
    bottom: 20px;
    right: auto;
    justify-content: center;
  }

  .pdf-scroll-mode .gallery-nav.prev {
    transform: none;
    margin-bottom: 0;
    margin-right: 20px;
  }

  .pdf-scroll-mode .gallery-nav.next {
    transform: none;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
    --header-height: 70px;
  }

  header {
    padding: 0 20px;
    left: 0;
    right: 0;
    /* Ensure header is fixed and stable on mobile */
    position: fixed;
    top: 0;
    width: 100%;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  .desktop-menu {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .content-wrapper {
    padding: 0 20px;
  }

  .hero-section h1 {
    font-size: 36px;
  }

  .hero-section p {
    font-size: 16px;
  }

  .buttons {
    flex-direction: column;
    gap: 15px;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .section-title {
    font-size: 28px;
  }

  /* FIXED: Complete sidebar hiding on mobile */
  .sidebar {
    width: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
  }

  .left-sidebar {
    transform: translateX(-100%);
  }

  .right-sidebar {
    transform: translateX(100%);
  }

  .sidebar.active {
    width: 60px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }

  main {
    margin-left: 0;
    margin-right: 0;
  }

  footer {
    margin-left: 0;
    margin-right: 0;
  }

  .theme-toggle {
    right: 20px;
  }

  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .modal {
    width: 95%;
  }

  .gallery-thumbnails {
    flex-wrap: wrap;
    justify-content: center;
  }

  .case-study-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .modal-content {
    padding: 15px;
  }

  /* Mobile responsive - only change max-width, keep animation consistent */
  .image-container img {
    max-width: 320px;
  }

  .modern-gallery .gallery-thumbnails {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-nav {
    width: 40px;
    height: 40px;
  }

  .pdf-scroll-mode + .gallery-info .gallery-thumbnails {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .hero-section h1 {
    font-size: 30px;
  }

  section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 24px;
  }

  /* Very small screens - only change max-width, keep animation consistent */
  .image-container img {
    max-width: 260px;
  }

  .modern-gallery .gallery-thumbnails {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-details {
    padding: 20px;
  }

  .gallery-details .gallery-title {
    font-size: 20px;
  }

  .pdf-scroll-mode + .gallery-info .gallery-thumbnails {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-scroll-container {
    height: 50vh;
  }
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.animate {
  opacity: 1;
  transform: translateY(0);
}

.loaded .hero-section .reveal-text {
  animation-play-state: running;
}

.no-scroll {
  overflow: hidden;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
