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

html {
  scroll-behavior: smooth;
}

/* Theme Variables */
:root,
[data-theme="default"] {
  --color-bg: #f8fafc;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  --color-card: #ffffff;
  --color-border: #e5e7eb;

  --primary-500: #3b82f6; /* blue-500 */
  --primary-700: #1d4ed8; /* blue-700 */
  --primary-shadow: rgba(59, 130, 246, 0.4);

  --accent-start: #10b981; /* emerald-500 */
  --accent-end: #34d399;   /* emerald-400 */

  /* Public site extras */
  --nav-bg: rgba(255, 255, 255, 0.95);
  --nav-border: rgba(229, 231, 235, 0.8);
  --nav-text: #1f2937;
  --hero-bg-start: #667eea;
  --hero-bg-end: #764ba2;
  --hero-overlay-start: rgba(59, 130, 246, 0.8);
  --hero-overlay-end: rgba(147, 51, 234, 0.8);
  --footer-bg: #1f2937;
  --footer-text: #ffffff;
  --footer-muted: #9ca3af;
}

/* Ocean theme */
[data-theme="ocean"] {
  --primary-500: #06b6d4; /* cyan-500 */
  --primary-700: #0e7490; /* cyan-700 */
  --primary-shadow: rgba(6, 182, 212, 0.4);
  --accent-start: #22d3ee; /* cyan-400 */
  --accent-end: #67e8f9;   /* cyan-300 */
  /* Public site extras */
  --nav-bg: rgba(240, 253, 255, 0.9);        /* cyan-50 glass */
  --nav-border: rgba(165, 243, 252, 0.6);    /* cyan-200 */
  --nav-text: #083344;                        /* cyan-950 */
  --hero-bg-start: #0ea5e9;                   /* sky-500 */
  --hero-bg-end: #0369a1;                     /* sky-700 */
  --hero-overlay-start: rgba(6, 182, 212, 0.75);   /* cyan-500 */
  --hero-overlay-end: rgba(59, 130, 246, 0.65);    /* blue-500 */
  --footer-bg: #0b1220;                        /* deep slate for contrast */
  --footer-text: #e6f9ff;
  --footer-muted: #93c5fd;                     /* blue-300 */
}

/* Emerald theme */
[data-theme="emerald"] {
  --primary-500: #10b981; /* emerald-500 */
  --primary-700: #047857; /* emerald-700 */
  --primary-shadow: rgba(16, 185, 129, 0.4);
  --accent-start: #34d399; /* emerald-400 */
  --accent-end: #6ee7b7;   /* emerald-300 */
  /* Public site extras */
  --nav-bg: rgba(240, 253, 244, 0.9);        /* green-50 glass */
  --nav-border: rgba(187, 247, 208, 0.6);    /* green-200 */
  --nav-text: #052e16;                        /* green-950 */
  --hero-bg-start: #10b981;                   /* emerald-500 */
  --hero-bg-end: #065f46;                     /* emerald-800 */
  --hero-overlay-start: rgba(16, 185, 129, 0.75);
  --hero-overlay-end: rgba(132, 204, 22, 0.65);    /* lime-500 */
  --footer-bg: #052e16;
  --footer-text: #ecfdf5;
  --footer-muted: #a7f3d0;
}

/* Royal theme */
[data-theme="royal"] {
  --primary-500: #8b5cf6; /* violet-500 */
  --primary-700: #6d28d9; /* violet-700 */
  --primary-shadow: rgba(139, 92, 246, 0.4);
  --accent-start: #a78bfa; /* violet-400 */
  --accent-end: #c4b5fd;   /* violet-300 */
  /* Public site extras */
  --nav-bg: rgba(245, 243, 255, 0.9);        /* violet-50 glass */
  --nav-border: rgba(221, 214, 254, 0.6);    /* violet-200 */
  --nav-text: #2e1065;                        /* violet-950 */
  --hero-bg-start: #7c3aed;                   /* violet-600 */
  --hero-bg-end: #4c1d95;                     /* violet-900 */
  --hero-overlay-start: rgba(139, 92, 246, 0.75);
  --hero-overlay-end: rgba(59, 130, 246, 0.55);    /* blue-500 */
  --footer-bg: #1e1b4b;                        /* indigo-950 */
  --footer-text: #eef2ff;                      /* indigo-100 */
  --footer-muted: #c7d2fe;                     /* indigo-200 */
}

/* Mono dark theme */
[data-theme="mono-dark"] {
  --color-bg: #0f172a;     /* slate-900 */
  --color-text: #e5e7eb;   /* gray-200 */
  --color-muted: #94a3b8;  /* slate-400 */
  --color-card: #111827;   /* gray-900 */
  --color-border: #334155; /* slate-700 */
  --primary-500: #22d3ee;  /* cyan-400 for contrast */
  --primary-700: #0891b2;  /* cyan-600 */
  --primary-shadow: rgba(34, 211, 238, 0.35);
  --accent-start: #22c55e; /* green-500 */
  --accent-end: #84cc16;   /* lime-500 */

  /* Public site extras */
  --nav-bg: rgba(17, 24, 39, 0.95);      /* gray-900 glass */
  --nav-border: rgba(51, 65, 85, 0.6);   /* slate-700 */
  --nav-text: var(--color-text);
  --hero-bg-start: #0b1220;               /* deeper slate */
  --hero-bg-end: #0f172a;
  --hero-overlay-start: rgba(2, 132, 199, 0.5);   /* cyan-600 */
  --hero-overlay-end: rgba(139, 92, 246, 0.5);    /* violet-500 */
  --footer-bg: #0b1220;
  --footer-text: #e5e7eb;
  --footer-muted: #94a3b8;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--nav-border);
  z-index: 1000;
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--nav-text);
}

.nav-icon {
  color: var(--primary-500);
  font-size: 1.5rem;
}

.nav-donate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><pattern id="grid" width="50" height="50" patternUnits="userSpaceOnUse"><path d="M 50 0 L 0 0 0 50" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--hero-overlay-start) 0%, var(--hero-overlay-end) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-top: 100px;
  padding-bottom: 80px;
}

.hero-text {
  text-align: center;
  color: white;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.7;
  margin-bottom: 3rem;
  opacity: 0.95;
  font-weight: 400;
}

/* Hero Stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.3s ease, background 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.2);
}

.stat-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
  font-weight: 500;
}

/* Hero Progress */
.hero-progress {
  margin-bottom: 3rem;
}

.progress-container {
  max-width: 600px;
  margin: 0 auto;
}

.progress-bar {
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  border-radius: 6px;
  width: 0%;
  transition: width 1s ease;
}

.progress-text {
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

/* Hero Actions */
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: white;
  box-shadow: 0 4px 15px var(--primary-shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-shadow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--primary-500);
  border: 2px solid var(--primary-500);
}

.btn-outline:hover {
  background: var(--primary-500);
  color: white;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: #ef4444; /* red-500 */
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Main Content */
.main-content {
  padding: 4rem 0;
}

.section {
  margin-bottom: 5rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.section-title i {
  color: var(--primary-500);
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--color-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Donation Modal */
.donation-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: var(--color-card);
  border-radius: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

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

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.donation-form {
  padding: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group input,
.form-group select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--color-card);
  color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-500) 20%, transparent);
}

/* Phases Grid */
.phases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

.phase-card {
  background: var(--color-card);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
  transition: all 0.3s ease;
  overflow: hidden;
}

.phase-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.phase-card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.phase-card p {
  color: var(--color-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.phase-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

.phase-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.phase-chevron {
  transition: transform 0.2s ease;
}

.phase-card.open .phase-chevron {
  transform: rotate(180deg);
}

.phase-card .progress {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.phase-card .progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  border-radius: 4px;
  transition: width 1s ease;
}

.phase-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--color-text);
}

.phase-details {
  padding-top: 1rem;
}

.materials {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.materials h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.materials-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
}

.mat-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(90px, 120px) minmax(110px, 140px) minmax(120px, 160px);
  gap: 0.75rem;
  padding: 0.5rem 0;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.mat-row > span {
  min-width: 0;
}

.mat-row.header {
  font-weight: 600;
  color: var(--color-text);
  border-bottom-color: var(--color-border);
}

.mat-row:last-child {
  border-bottom: none;
}

.mat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-qty, .mat-unit, .mat-sub {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mat-summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
}

.phase-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  border-radius: 0.6rem;
}

.text-muted {
  color: #6b7280;
}

/* Donations Widget */
.donations-widget {
  background: var(--color-card);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
}

.donations-list {
  display: grid;
  gap: 1rem;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--color-bg);
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.recent-item:hover {
  background: color-mix(in srgb, var(--color-bg) 80%, #ffffff);
  transform: translateX(5px);
}

.recent-item strong {
  color: var(--color-text);
  font-weight: 600;
}

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

.gallery-item {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  /* use landscape ratio for better visibility */
  aspect-ratio: 16 / 9;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.gallery-img-wrap {
  position: relative;
}

/* Apply to any gallery image (frontend/admin), fill tile while preserving ratio */
.gallery-item img,
.gallery-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.gallery-title {
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(4px);
  border-radius: 0 0 1rem 1rem;
}

.admin-link {
  text-align: center;
}

/* Delete Button */
.btn-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
}

.btn-delete i {
  pointer-events: none;
}

/* Optional: show button on hover if you want subtler UI */
/* .btn-delete { opacity: 0; transition: opacity .2s ease; }
.gallery-item:hover .btn-delete { opacity: 1; } */

/* Admin Gallery Overrides (admin/upload.php) */
.admin-section .gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.admin-section .gallery-item {
  position: static; /* override frontend relative positioning */
  aspect-ratio: auto; /* cancel fixed ratio for admin */
  cursor: default;
  background: #fff;
}

.admin-section .gallery-item img,
.admin-section .gallery-img-wrap img {
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Hide any overlay title bar on admin */
.admin-section .gallery-title { display: none !important; }

/* Place delete button below image in admin */
.admin-section .gallery-item .btn-delete {
  position: static;
  top: auto; right: auto;
  z-index: auto;
  padding: 6px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Align actions row to the right in admin */
.admin-section .gallery-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem;
}

/* Footer */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 3rem 0;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.footer-brand i {
  color: var(--primary-500);
  font-size: 1.25rem;
}

.footer-text {
  color: var(--footer-muted);
}

/* Loading Spinner */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-border);
  border-top: 4px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
}

.message:not(:empty) {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .phases-grid {
    grid-template-columns: 1fr;
  }
  
  .mat-row {
    grid-template-columns: minmax(120px, 1fr) minmax(70px, 90px) minmax(90px, 110px) minmax(100px, 120px);
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .nav-container {
    padding: 0 1rem;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  /* Slightly taller tiles on small screens for comfort */
  .gallery-item { aspect-ratio: 4 / 3; }
  
  /* a bit tighter hero padding on smaller screens */
  .hero-content {
    padding-top: 90px;
    padding-bottom: 60px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .modal-content {
    margin: 0.5rem;
  }
  
  .donation-form {
    padding: 1.5rem;
  }
  
  .modal-header {
    padding: 1.5rem 1.5rem 1rem;
  }
}

/* Lightbox for gallery */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}
.lightbox.open { display: block; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(2px);
}

.lightbox-content {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  grid-template-rows: 64px 1fr 80px;
  align-items: center;
  justify-items: center;
  padding: 1rem;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(0,0,0,0.65); }

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  border-radius: 8px;
}

.lightbox-caption {
  grid-column: 1 / -1;
  grid-row: 3 / 4;
  color: #e5e7eb;
  font-size: 0.95rem;
  text-align: center;
  padding-top: 0.5rem;
}

.lightbox-nav {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-nav.prev { grid-column: 1 / 2; grid-row: 2 / 3; }
.lightbox-nav.next { grid-column: 3 / 4; grid-row: 2 / 3; }
.lightbox-nav.prev::after { content: '‹'; font-size: 28px; }
.lightbox-nav.next::after { content: '›'; font-size: 28px; }

@media (max-width: 768px) {
  .lightbox-content {
    grid-template-columns: 48px 1fr 48px;
    grid-template-rows: 56px 1fr 64px;
    padding: 0.5rem;
  }
  .lightbox-img { max-height: 70vh; }
}
