:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #3498db;
  --text-color: #333;
  --bg-color-glass: rgba(255, 255, 255, 0.72);
  --glass-border: 1px solid rgba(255, 255, 255, 0.3);
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --hover-bg: rgba(255, 255, 255, 0.6);
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: transparent;
  /* Essential for z-index: -1 element to show */
}

#bg {
  position: fixed;
  left: 0;
  top: 0;
  transform: none;
  width: 250vw;
  height: 250vh;
  display: grid;
  justify-content: start;
  align-content: start;
  grid-template-columns: repeat(auto-fill, 235px);
  grid-auto-rows: 235px;
  /* background: removed to show faces */
  z-index: 0;
  pointer-events: none;
}

.face {
  width: 235px;
  height: 235px;
  background-color: #f0f0f0;
  /* Fallback color to see if faces exist */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  transition: background-image 0.08s linear;
}

/* CV Container Styling */
.cv-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 40px;
  background: var(--bg-color-glass);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 20px;
  border: var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  /* Ensures content stays above background */
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Top Buttons Container */
.top-buttons {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

/* Language Button */
#lang-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

#lang-btn:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
}

/* Download Button - Attention Grabber */
#download-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  /* Vivid red gradient */
  color: white;
  border: none;
  border-radius: 5px;
  padding: 10px 18px;
  /* Slightly larger */
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  animation: pulse-attention 2s infinite;
}

#download-btn:hover {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

#download-btn:active {
  transform: translateY(1px);
}

@keyframes pulse-attention {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

/* Header */
.cv-header {
  text-align: center;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.cv-header h1 {
  margin: 0;
  font-size: 2.5rem;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: -0.5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.cv-header h2 {
  margin: 10px 0 20px;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--secondary-color);
}

.contact-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  font-size: 0.95rem;
}

.contact-info a,
.contact-info span {
  color: var(--secondary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  padding: 5px 10px;
  border-radius: 20px;
}

.contact-info a:hover {
  color: white;
  background-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
}

/* Sections */
.cv-section {
  margin-bottom: 40px;
}

.cv-section h3 {
  font-size: 1.5rem;
  color: var(--primary-color);
  border-left: 4px solid var(--accent-color);
  padding-left: 15px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s ease;
}

.cv-section:hover h3 {
  transform: translateX(5px);
}

.cv-section h3 i {
  color: var(--accent-color);
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.cv-section:hover h3 i {
  transform: rotate(10deg);
}

/* Listings */
.summary-list,
.job-details,
.cert-list,
.activity-list,
.language-list {
  padding-left: 20px;
}

.summary-list li,
.job-details li {
  margin-bottom: 8px;
}

/* Job & Education Items with Hover */
.job-item,
.education-item {
  margin-bottom: 25px;
  padding: 15px;
  border-radius: 12px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.job-item:hover,
.education-item:hover {
  background: var(--hover-bg);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
  border-color: rgba(52, 152, 219, 0.2);
}

.job-header,
.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

.job-header h4,
.edu-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary-color);
  font-weight: 600;
}

.company,
.institution {
  font-weight: 500;
  color: var(--secondary-color);
}

.job-meta,
.edu-meta {
  font-size: 0.9rem;
  color: #666;
  margin-top: 4px;
  margin-bottom: 10px;
  display: flex;
  gap: 15px;
}

.job-meta i,
.edu-meta i {
  margin-right: 4px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.skill-category {
  background: rgba(255, 255, 255, 0.5);
  padding: 20px;
  border-radius: 15px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skill-category:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

.skill-category strong {
  display: block;
  color: var(--accent-color);
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 5px;
  font-size: 1.1rem;
}

/* Certifications & Activities Hover */
.cert-list li,
.activity-list li {
  list-style: none;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.cert-list li:hover::after,
.activity-list li:hover::after {
  content: '\f06e';
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  margin-left: auto;
  color: var(--accent-color);
  opacity: 0.7;
}

.cert-list li:hover,
.activity-list li:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: translateX(5px);
  color: var(--primary-color);
}

.cert-list li i {
  color: gold;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
  font-size: 1.1rem;
}

.language-list {
  list-style: none;
  display: flex;
  gap: 30px;
}

.language-list li {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  transition: all 0.3s ease;
}

.language-list li:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.language-list li strong {
  margin-right: 5px;
}

/* Modal Styles - Lightbox Look */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  /* Deep dark backdrop */
  z-index: 1000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  width: 95%;
  max-width: 1200px;
  height: 90vh;
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

/* Remove header bar */
.modal-header {
  display: none;
}

/* Floating Close Button */
.close-modal {
  position: fixed;
  top: 20px;
  right: 30px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
  transform: rotate(90deg);
}

.modal-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  position: relative;
  width: 100%;
  height: 100%;
}

.modal-body iframe,
.modal-body object,
.modal-body embed {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  background: white;
}

/* Slider Controls */
.slider-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 20px;
  cursor: pointer;
  font-size: 1.5rem;
  border-radius: 50%;
  transition: all 0.2s;
  z-index: 1010;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

.slide-counter {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 1rem;
  z-index: 1010;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Show modal state */
.modal-overlay.active {
  opacity: 1;
}

@media (max-width: 768px) {
  #bg {
    grid-template-columns: repeat(auto-fill, 118px);
    grid-auto-rows: 118px;
  }

  .face {
    width: 118px;
    height: 118px;
    opacity: 0.5;
    /* Fade background pattern slightly on mobile to reduce noise */
  }

  .cv-container {
    margin: 10px;
    padding: 25px 20px;
    background: rgba(255, 255, 255, 0.92);
    /* More opaque background for better text contrast */
    backdrop-filter: none;
    /* remove blur for performance and clarity on low-end devices */
  }

  body {
    font-size: 16px;
    /* Ensure base font size is readable */
  }

  p,
  li {
    line-height: 1.7;
    /* Increase line height */
  }

  /* Header adjustments */
  .cv-header {
    margin-top: 40px;
    /* Push down to make room for absolute buttons */
  }

  .cv-header h1 {
    font-size: 1.8rem;
    margin-top: 10px;
    padding-right: 0;
  }

  .cv-header h2 {
    font-size: 1.1rem;
    line-height: 1.4;
    color: #444;
    /* Slightly darker for better contrast */
  }

  /* Adjust Top Buttons container */
  .top-buttons {
    top: 10px;
    right: 10px;
    gap: 8px;
    width: auto;
  }

  #lang-btn {
    padding: 8px 12px;
  }

  #download-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    /* On very small screens, maybe just icon? For now keep text but smaller */
  }

  /* Hide "Download CV" text only on very small screens if needed, 
     but user wants it noticeable. Let's keep it but ensure no overlap. */

  /* Stack Contact Info nicely */
  .contact-info {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .contact-info a,
  .contact-info span {
    width: 100%;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    /* Slight background to make touch targets obvious */
    padding: 8px;
  }

  /* Job/Edu headers */
  .job-header,
  .edu-header {
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
  }

  .job-header h4,
  .edu-header h4 {
    font-size: 1.15rem;
    /* Larger headings */
  }

  .job-meta,
  .edu-meta {
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    /* Readable meta text */
  }

  .job-details li,
  .summary-list li {
    margin-bottom: 12px;
    /* More space between list items */
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .skill-category {
    background: rgba(255, 255, 255, 0.6);
    /* Ensure contrast */
  }

  .language-list {
    flex-direction: column;
    gap: 15px;
  }

  .language-list li {
    text-align: center;
    background: rgba(0, 0, 0, 0.05);
  }
}

@media (max-width: 400px) {
  .cv-header h1 {
    font-size: 1.5rem;
  }
}