/* ═══════════════════════════════════════════════════════════
   ELASSIJI — Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Dark Theme (Default) ── */
:root,
[data-theme="dark"] {
  --bg: #0a0a0f;
  --surface: #151520;
  --text: #eaeaea;
  --muted: #a0a0a0;
  --accent: #7b1fa2;
  --accent2: #9c27b0;
  --accent-glow: rgba(123, 31, 162, 0.3);
  --border: #2a2a35;
  --shadow: rgba(0, 0, 0, 0.5);
  --error: #cf6679;
  --card-bg: rgba(21, 21, 32, 0.8);

  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
  --max-width: 1200px;
  --nav-height: 70px;
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #f8f6f3;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #6b6b7b;
  --accent: #7b1fa2;
  --accent2: #9c27b0;
  --accent-glow: rgba(123, 31, 162, 0.15);
  --border: #e0ddd8;
  --shadow: rgba(0, 0, 0, 0.08);
  --error: #b00020;
  --card-bg: rgba(255, 255, 255, 0.9);
}

/* ── Google Fonts Import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('animations.css');

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══ LAYOUT ═══ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ═══ HEADER & NAV ═══ */
.site-header {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  background-color: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  transition: background-color 0.3s ease;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.main-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  z-index: 101;
}

.mobile-toggle svg {
  width: 28px;
  height: 28px;
}

.main-nav a {
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ═══ PARTICLE BACKGROUND CANVAS ═══ */
#bg-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

body>* {
  position: relative;
  z-index: 1;
}

/* ═══ SOCIAL ICONS ═══ */
.social-icons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.22s ease;
  flex-shrink: 0;
}

.social-icons a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px var(--accent-glow);
}

.social-icons svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ═══ HERO ═══ */
.hero {
  text-align: center;
  padding: 5rem 0 3rem;
  position: relative;
}

.hero-portrait {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  border: 3px solid var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.hero-title {
  font-size: 3rem;
  font-weight: 300;
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  color: var(--muted);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 2rem;
}

.hero-social {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* ═══ MASONRY GRID ═══ */
.masonry-grid {
  column-count: 3;
  column-gap: 1.25rem;
  padding: 1rem 0;
}

@media (max-width: 900px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .masonry-grid {
    column-count: 1;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background-color: var(--card-bg);
  box-shadow: 0 4px 16px var(--shadow);
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.masonry-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 30px var(--shadow);
}

.masonry-item img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.masonry-item .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  padding: 2rem 1rem 1rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.masonry-item:hover .overlay {
  opacity: 1;
}

@media (hover: none) {
  .masonry-item .overlay {
    opacity: 1;
    padding-top: 1rem;
  }
}

/* ═══ DETAIL PAGES ═══ */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  margin-top: 2rem;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-container img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px var(--shadow);
  cursor: zoom-in;
  transition: transform 0.2s;
}

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

/* Thumbnail strip for carousel */
.thumb-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0 1rem;
}

.thumb-strip img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.2s;
}

.thumb-strip img:hover,
.thumb-strip img.active {
  opacity: 1;
  border-color: var(--accent);
}

.detail-info h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.meta-info {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.25s;
  text-align: center;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

/* ═══ FORMS ═══ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

.honeypot {
  display: none !important;
}

/* ═══ CARDS ═══ */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow);
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

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

.card-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.card-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.card-text {
  flex: 1;
  margin-bottom: 1rem;
}

/* ═══ TIMELINE (Exhibitions) ═══ */
.timeline {
  position: relative;
  padding: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent), transparent);
  top: 0;
}

.timeline-item {
  display: flex;
  justify-content: flex-end;
  width: 50%;
  padding: 0 2rem 2rem 0;
  position: relative;
}

.timeline-item:nth-child(even) {
  justify-content: flex-start;
  margin-left: 50%;
  padding: 0 0 2rem 2rem;
}

.timeline-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  top: 0;
  right: -7px;
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-item:nth-child(even) .timeline-dot {
  left: -7px;
  right: auto;
}

.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 400px;
  transition: transform 0.3s;
}

.timeline-content:hover {
  transform: translateY(-3px);
}

.timeline-content h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.timeline-content .date {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timeline-content p {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .timeline::before {
    left: 20px;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding: 0 0 2rem 3rem;
    justify-content: flex-start;
  }

  .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 13px;
    right: auto;
  }
}

/* ═══ UTILITY ═══ */
.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

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

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

/* ═══ FOOTER ═══ */
.site-footer {
  text-align: center;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.site-footer a {
  color: var(--muted);
  margin: 0 0.5rem;
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin: 2rem 0;
}

/* ═══ ADMIN ═══ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 250px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-nav button,
.admin-nav a {
  text-align: left;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
}

.admin-nav button:hover,
.admin-nav a:hover,
.admin-nav .active {
  background-color: var(--accent);
  color: #fff;
}

.admin-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* ═══ TABLES ═══ */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--border);
}

.badge.published {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

/* ═══ LIGHTBOX MODAL ═══ */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover {
  color: var(--accent2);
}

/* ═══ IMAGE LAZY LOADING (BLUR HASH) ═══ */
.blur-load {
  background-size: cover;
  background-position: center;
  background-color: var(--surface);
  /* Fallback */
  position: relative;
  overflow: hidden;
  border-radius: inherit;
}

.blur-load img {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blur-load.loaded img {
  opacity: 1;
}

.blur-load::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-100%);
  animation: loading-shimmer 1.5s infinite;
  z-index: 1;
}

.blur-load.loaded::before {
  display: none;
  animation: none;
}

@keyframes loading-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--surface);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px var(--shadow);
  border-left: 4px solid var(--accent);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-left-color: var(--error);
}

/* ═══ RESPONSIVE NAV & LAYOUT ═══ */
@media (max-width: 768px) {
  .site-header {
    padding: 0 1rem;
  }

  .mobile-toggle {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    background-color: var(--surface);
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 20px var(--shadow);
    transform: translateY(-150%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 99;
  }

  .main-nav.nav-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .main-nav a {
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
  }

  .theme-toggle {
    margin: 0 auto;
  }

  .hero-title {
    font-size: 2rem;
  }

  .card-container,
  .masonry-grid {
    padding: 0 0.5rem;
  }

  .detail-info h1 {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .card-list {
    grid-template-columns: 1fr;
  }
}

/* ═══ BLOG ═══ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin: 2.5rem 0;
}

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: var(--text);
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px var(--shadow);
  color: var(--text);
}

.blog-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.blog-card-image-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  flex-shrink: 0;
}

.blog-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-category {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  width: fit-content;
}

.blog-card-title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.blog-card-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

.blog-card-excerpt {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1.25rem;
}

.blog-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  align-self: flex-start;
  transition: gap 0.2s ease;
}

.blog-card:hover .blog-read-more {
  gap: 0.6rem;
}

/* Blog Article Page */
.blog-article-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.blog-article-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.blog-article-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.blog-article-meta {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.blog-article-cover {
  width: 100%;
  height: 380px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 30px var(--shadow);
}

.blog-article-cover-placeholder {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 30px var(--shadow);
}

.blog-article-content {
  font-size: 1.05rem;
  line-height: 1.85;
}

.blog-article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
}

.blog-article-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.blog-article-content p {
  margin-bottom: 1.25rem;
  color: var(--text);
}

.blog-article-content ul,
.blog-article-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.blog-article-content li {
  margin-bottom: 0.5rem;
}

.blog-article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.blog-article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--card-bg);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--muted);
}

.blog-nav-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .blog-article-header h1 {
    font-size: 1.6rem;
  }

  .blog-article-cover,
  .blog-article-cover-placeholder {
    height: 220px;
  }
}

/* ═══ Swiper Lightbox Overrides ═══ */
.swiper-modal .swiper {
  width: 100%;
  height: 100%;
}

.swiper-modal .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swiper-modal .swiper-zoom-container img {
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: 4px;
}

.swiper-modal .swiper-button-next,
.swiper-modal .swiper-button-prev {
  color: var(--accent);
}

.swiper-modal .swiper-pagination-bullet-active {
  background: var(--accent);
}