/* ==========================================================================
   GLOBAL RESET & CORE STYLES
   Standardizing the box model and typography across browsers.
==========================================================================
*/
/* The Box Model Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Remove default list styles */
ul,
ol {
  list-style: none; /* no dot or square before the list */
}

/* ==========================================================================
   THEME CONFIGURATION
   Centralized variables for instant Light/Dark mode switching.
==========================================================================
*/
/* Colors for Light Mode (Default) */
:root {
  --bg-color: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #4b5563;
  --accent: #4f46e5; /* Indigo */
  --secondary-bg: #f3f4f6; /* Light gray for greetings/skills */
  --card-bg: #ffffff;
  --border: #eaeaea;
}

/* Colors for Dark Mode */
[data-theme="dark"] {
  --bg-color: #0f172a; /* Deep navy */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #818cf8; /* Lighter indigo for dark bg */
  --secondary-bg: #1e293b;
  --card-bg: #1e293b;
  --border: #334155;
}

/* Dims images in dark mode */
[data-theme="dark"] #my-photo,
[data-theme="dark"] .project-photo {
    filter: brightness(0.8);
    transition: filter 0.3s ease;
}

[data-theme="dark"] .project-element:hover .project-photo {
    filter: brightness(1);
}

/* Standardize line height and text rendering */
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased; /* For Mac & iOS, makes the font pixels look smoother and thinner. */
  min-height: 100vh; /* Viewport Height. 100vh means 100% of the height of the screen. */
  /* Even if there is only one sentence on this page, make the body at least as tall as the entire screen. */
  padding: 0 5%;
  font-family: sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  transition:
    background-color 0.3s ease,
    color 0.3s ease; /* Smooth fade */
}

/* Sticky Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  padding: 20px 0;
  border-bottom: 1px solid #eaeaea;
  margin-bottom: 40px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 15px;
}

.lang-btn {
  cursor: pointer;
  background: var(--secondary-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
}

#themeToggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 5px;
  transition: transform 0.3s ease;
  color: var(--text-main); /* The icon follow the theme text color */
}

#themeToggle:hover {
  transform: scale(1.1);
}

/* Home Section Flexbox Logic */
#home {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 40px; /* Reduced gap since max-width will handle spacing */
  min-height: 20vh;
  padding-bottom: 50px;
  max-width: 1200px; /* Limits spread on ultra-wide screens */
  margin: 0 auto; /* Centers the whole container */
}

.home-text {
  flex: 1 1 500px; /* Adjusted basis for better balance */
}

.home-text h1 {
  font-size: 3rem;
  margin: 15px 0;
  line-height: 1.1;
}

.home-text .bio p {
  text-align: left;
  margin-bottom: 15px;
  max-width: 600px; /* Keeps text lines readable length */
  color: var(--text-muted);
}

/* Photo Container & Responsive Alignment */

.home-photo {
  flex: 1 1 300px;
  display: flex;
  justify-content: center;
}

#my-photo {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 4px solid var(--secondary-bg);
}

.greetings {
  background-color: var(--secondary-bg);
  color: var(--text-main);
  border-radius: 8px;
  padding: 12px 20px;
  width: fit-content;
  font-weight: 600;
}

.horizontal-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox: Hides scrollbar */
  -ms-overflow-style: none; /* IE and Edge: Hides scrollbar */
}

/* Chrome, Safari and Opera: Hides scrollbar */
.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

#skills {
  margin-bottom: 40px; /* More space between the Skills section and the Projects title */
  text-align: center;
  padding-top: 20px;
}

.skills-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding-top: 20px;
}

.skill-container {
  background-color: var(--secondary-bg);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.projects-container-relative {
  position: relative;
  width: 100%;
}

.dot-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 0;
}

.dot-indicators .dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: var(--border);
  opacity: 0.7;
  transition:
    background-color 0.25s ease,
    transform 0.25s ease,
    opacity 0.25s ease;
}

.dot-indicators .dot.active {
  background-color: var(--accent);
  opacity: 1;
  transform: scale(1.2);
}

.scroll-controls {
  position: absolute;
  top: 50%;
  left: -20px;
  right: -20px;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  width: calc(100% + 40px);
  padding: 0;
  pointer-events: none; /* Allows scrolling the container, but we need to re-enable it for child buttons */
  z-index: 20;
}

.control-btn {
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease, filter 0.3s ease;
    pointer-events: auto; /* Ensure buttons are clickable since parent is pointer-events: none */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: var(--accent);
    filter: brightness(1.1);
}

.scrollLeft {
  opacity: 0; /* JS handles this */
}

.scrollRight {
  opacity: 1; /* JS handles this */
}

/* Remove the specific mobile hide rule */
@media (max-width: 600px) {
  .control-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    transform: none; /* Reset transform on mobile */
  }

  .control-btn:hover {
    transform: scale(1.1); /* Standard scaling only */
  }
}

/* Add a subtle hint that more content exists on the right */
#projects {
  position: relative;
  text-align: center;
}

#projects::after {
  display: none;
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1));
  pointer-events: none;
}

.project-element {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  flex: 0 0 260px;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.project-photo {
  width: 100%;
  height: 230px;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 11px 25px 1px #00000021;
}

#tech-stack {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

#tech-stack h2 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.tech-stack-subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.tech-stack-container {
  display: flex;
  justify-content: center;
}

.tech-stack-list {
  text-align: left;
  display: inline-block;
  list-style: disc; /* Re-enable bullets */
  padding-left: 20px; /* Space for bullets */
  color: var(--text-muted);
  line-height: 1.8;
}

.tech-stack-list li {
  margin-bottom: 8px;
}

/* Mobile-specific adjustments */
@media (max-width: 600px) {
  section {
    padding: 40px 20px;
  }

  .scroll-controls {
    left: 0;
    right: 0;
    width: 100%;
  }

  .control-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    background: var(--accent);
    opacity: 0.8;
  }

  .project-element {
    flex: 0 0 68vw; /* Slightly thinner card on small screens */
    scroll-snap-align: center; /* Snap cards to the center of the screen */
  }

  .project-photo {
    height: 210px; /* Reduce vertical size of the card image on mobile */
  }

  .horizontal-scroll {
    padding-left: 8vw;  /* Extra room so the full card is visible */
    padding-right: 8vw;
  }

  h1 {
    font-size: 1.8rem;
  }
}

.project-element:hover {
  transform: translateY(-8px); /* Subtle lift on hover */
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: var(--accent); /* Highlights the card with Indigo */
}

.project-info {
  padding: 20px;
}

.project-info h2 {
  color: var(--text-main);
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.project-skill,
a.project-skill {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  display: inline-block;
}

a.project-skill:hover {
  text-decoration: underline;
}

.main-footer {
  margin-top: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column; /* Stacks children vertically */
  align-items: center; /* Centers them horizontally */
  gap: 20px; /* Adds space between the blocks */
  background-color: var(--bg-color); /* Match site background */
  border-top: 1px solid var(--border);
}

.social-links {
  display: flex;
  gap: 15px; /* Space between the two icons */
}

.social-links svg {
  transition:
    color 0.3s ease,
    transform 0.3s ease;
  color: #555; /* Default icon color */
}

.social-links a:hover svg {
  color: var(--accent);
  transform: translateY(-3px); /* Small bounce effect */
}

/* Less padding between Submit and Footer */
#contact {
  text-align: center;
  margin: auto;
  max-width: 600px;
  padding-bottom: 20px; /* Reduced from default */
  margin-bottom: 0; /* Removes extra bottom margin */
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit; /* Keeps the body font */
}

.contact-form textarea {
  height: 150px;
  resize: vertical; /* Allows user to grow the box height only */
}

.submit-button {
  background-color: #0070f3;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: background 0.3s;
  margin-bottom: 0px;
}

.submit-button:hover {
  background-color: #0056b3;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  margin: 0; /* Removes default browser margins */
  cursor: pointer;
  width: 16px; /* Standardizes size */
  height: 16px;
}

.checkbox-container label {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.2;
  cursor: pointer;
}

#result {
  min-height: 24px; /* Reserves space for the message even when it's empty */
  margin-top: 10px;
  font-size: 14px; /* Keep it readable but smaller than main text */
}

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

.footer-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.copyright {
  font-size: 0.8rem;
  color: #888;
}

.copyright a {
  color: inherit;
  font-weight: bold;
}
