:root {
  --brand: #005189;
  --accent: #e50069;
  --deep: #702283;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #eef2f6;
  --surface: #fafbfc;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 10px 26px rgba(0, 0, 0, .06);
}

body {
  margin: 0;
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

header {
  background: var(--brand);
  color: white;
  text-align: center;
  padding: 3rem 1rem;
  box-shadow: var(--shadow);
}

header h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
}

header p {
  margin-top: 0.8rem;
  font-size: 1.1rem;
  color: #e0f2fe;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Container */
#projects-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Cards */
.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  border-color: var(--brand);
}

.project-card img,
.placeholder-img,
.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  /* Show full image */
  background: #e5e5e5;
  /* Neutral background for letterboxing */
  border-bottom: 1px solid var(--line);
}

.video-thumbnail {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.placeholder-img {
  background: var(--bg);
  /* Soft gray background */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 3rem;
}

.card-content {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.project-card h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink);
  font-weight: 600;
}

.tap-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--brand);
}

.infra {
  border-top: 4px solid var(--accent) !important;
}

/* Modal */
dialog.project-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  background: var(--surface);
  cursor: default;
  /* Reset cursor */
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  padding-bottom: 2rem;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 100;
  /* Ensure visibility */
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.close-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.modal-hero {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #f8f9fa;
  display: block;
  margin: 0 auto;
  cursor: zoom-in;
  /* Indicate clickable */
  transition: transform 0.2s;
}

.modal-hero:hover {
  transform: scale(1.02);
}

/* Lightbox */
dialog.lightbox {
  background: transparent;
  box-shadow: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: none;
  /* Default hidden */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
}

dialog.lightbox[open] {
  display: flex;
}

dialog.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.9);
}

#lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
}

.lightbox .close-btn {
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.2);
  z-index: 1000;
}

.lightbox .close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  color: white;
}

.modal-content h2 {
  padding: 1.5rem 1.5rem 0.5rem;
  margin: 0;
  color: var(--brand);
  font-size: 1.5rem;
}

.modal-body {
  padding: 0 1.5rem;
  color: var(--ink);
}

.modal-body p {
  margin-bottom: 1rem;
  text-align: justify;
}

.modal-body .note {
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 8px;
}

/* Credentials Box */
.credentials-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.credentials-box h4 {
  margin-top: 0;
  color: #0369a1;
  margin-bottom: 0.5rem;
}

.credentials-box p {
  margin: 0.3rem 0;
  font-family: monospace;
  font-size: 0.95rem;
}

/* Media (Video) */
.media video {
  border-radius: 8px;
  margin-top: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* CTA Button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.8rem 1.5rem;
  background: var(--brand);
  color: white;
  text-decoration: none;
  font-weight: 500;
  border-radius: 50px;
  transition: transform 0.2s ease, background 0.2s ease;
  width: fit-content;
}

.btn-cta:hover {
  transform: translateY(-2px);
  background: var(--deep);
}

footer {
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2rem;
}