:root {
  --primary-color: #001F3F; /* Azul Cobalto Profundo */
  --secondary-color: #00F2FF; /* Cian Eléctrico */
  --bg-color: #0a0f1a;
  --text-main: #ffffff;
  --text-muted: #a0aec0;
  --card-bg: rgba(0, 31, 63, 0.4);
  --glass-border: rgba(0, 242, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 31, 63, 0.37);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'JetBrains Mono', 'Segoe UI', system-ui, monospace;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 31, 63, 0.8) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(0, 242, 255, 0.1) 0%, transparent 20%);
  background-size: cover;
  background-attachment: fixed;
}

/* Hero Section */
.hero {
  padding: 4rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(0,31,63,0.8) 0%, rgba(10,15,26,1) 100%);
}

.hero h1 {
  font-size: 3rem;
  color: var(--secondary-color);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
}

/* Portfolio Container */
.portfolio-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Grid Layout */
.projects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* Project Cards */
.card {
  flex: 1 1 300px; /* Crucial for filling auto space */
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  min-height: 350px;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 242, 255, 0.15);
  border-color: rgba(0, 242, 255, 0.5);
}

.card-img-container {
  height: 200px;
  overflow: hidden;
  position: relative;
  background-color: var(--primary-color);
}

.card-img-container::after {
  content: '';
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  background: linear-gradient(to bottom, transparent 50%, var(--card-bg) 100%);
}

.card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.card:hover .card-img-container img {
  opacity: 1;
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.keyword-badge {
  background: rgba(0, 31, 63, 0.8);
  border: 1px solid var(--secondary-color);
  color: var(--secondary-color);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.modal {
  display: none; 
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 15, 26, 0.9);
  backdrop-filter: blur(8px);
  overflow-y: auto; /* Let the OVERLAY scroll if the modal is larger than screen */
  padding: 2rem 1rem; /* Space at top and bottom */
}

.modal.show {
  display: block; /* Removing flex here, which causes cut-offs on large elements */
}

.modal-content {
  background: var(--primary-color);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  width: 95%;
  max-width: 1100px;
  margin: 0 auto; /* Center horizontally */
  border-radius: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.4s ease-out;
}

/* This contains the actual text/content */
.modal-body-scrollable {
  padding: 3rem 2rem 2rem 2rem; /* Extra top padding so the close button doesn't overlap text */
}

/* Specific styling for the Lightbox */
.lightbox-content {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: auto;
  width: auto;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-close-btn {
  top: -40px;
  right: 0;
  color: #fff;
  z-index: 1001;
}

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

.close-btn {
  color: var(--text-muted);
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close-btn:hover {
  color: var(--secondary-color);
}

.modal-header h2 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #000;
  border-radius: 8px;
  margin: 1.5rem 0;
  border: 1px solid rgba(0, 242, 255, 0.3);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-description {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.modal-skills {
  margin-top: 1.5rem;
}

.modal-skills h3 {
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  background: rgba(0, 242, 255, 0.1);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  border-left: 3px solid var(--secondary-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color); 
}
::-webkit-scrollbar-thumb {
  background: var(--primary-color); 
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color); 
}

/* Modal Sections */
.modal-section-title {
  color: var(--secondary-color);
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

/* Image Gallery */
.modal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gallery-img-container {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  height: 150px;
  cursor: pointer;
}

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

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