/* ══════════════════════════════════════════════════════════
   Ministry of Failures — style.css
   ══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --black:    #0a0a0a;
  --dark:     #111111;
  --mid:      #1a1a1a;
  --border:   #2a2a2a;
  --muted:    #444444;
  --dim:      #666666;
  --silver:   #999999;
  --light:    #cccccc;
  --white:    #f0ece4;
  --red:      #c8000a;
  --red-hot:  #ff1a1a;
  --gold:     #d4a017;
  --amber:    #e8900a;
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-serif:   'DM Serif Display', Georgia, serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;
  --font-sinhala: 'Noto Sans Sinhala', sans-serif;
  --radius: 2px;
  --transition: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-sinhala);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scanline overlay ───────────────────────────────────── */
.scanline {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px);
  pointer-events: none;
  z-index: 9999;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3 { line-height: 1.1; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  border-bottom: 2px solid var(--red);
  box-shadow: 0 2px 20px rgba(200,0,10,0.3);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 64px;
}
.logo { display: flex; align-items: baseline; gap: 0.35rem; flex-shrink: 0; }
.logo-ministry { font-family: var(--font-display); font-size: 1.4rem; color: var(--white); letter-spacing: 0.08em; }
.logo-of       { font-family: var(--font-serif); font-size: 0.8rem; color: var(--dim); font-style: italic; }
.logo-failures { font-family: var(--font-display); font-size: 1.4rem; color: var(--red); letter-spacing: 0.08em; }
.logo-year     { font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted); margin-left: 0.25rem; }

/* ── Desktop Nav ─────────────────────────────────────────── */
.main-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  align-items: center;
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--silver);
  padding: 0.4rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-align: center;
  line-height: 1.3;
}
.nav-link:hover { color: var(--white); border-color: var(--border); }
.nav-link.active { color: var(--red); border-color: var(--red); background: rgba(200,0,10,0.08); }
.nav-link--active {
  color: var(--red) !important;
  border-bottom: 2px solid var(--red);
}
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 1.4rem; cursor: pointer; padding: 0.25rem 0.5rem; }

/* ── Nav Dropdown (desktop) ──────────────────────────────── */
.nav-dropdown {
  display: flex;
  align-items: center;
  position: relative;
}
.nav-dropdown .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--dark);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  min-width: 100px;
  z-index: 200;
  flex-direction: column;
}
.nav-dropdown:hover .nav-dropdown-menu { display: flex; }
.nav-dropdown-item {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--silver);
  padding: 0.5rem 1rem;
  letter-spacing: 0.05em;
  transition: all var(--transition);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.nav-dropdown-item:hover { color: var(--white); background: var(--mid); }
.nav-dropdown-item.active,
.nav-dropdown-item.nav-link--active {
  color: var(--red) !important;
  border-left: 2px solid var(--red);
  background: rgba(200,0,10,0.08);
}
.nav-dropdown-item:last-child { border-bottom: none; }

/* nav-si, nav-en, nav-sub-links — desktop hidden, mobile shown */
.nav-si { display: none; }
.nav-sub-links { display: none; }
.nav-close { display: none; }

/* ── Main ───────────────────────────────────────────────── */
.site-main { min-height: calc(100vh - 128px); }

/* ── Flash messages ─────────────────────────────────────── */
.flash {
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-left: 4px solid var(--red);
  background: rgba(200,0,10,0.1);
  color: var(--red-hot);
}

/* ── Index section ──────────────────────────────────────── */
.index-section { max-width: 1400px; margin: 0 auto; padding: 3rem 1.5rem; }
.index-header {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
  margin-top: 3rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.index-header:first-child { margin-top: 0; }
.card-item .index-header { margin-top: 3rem; }
.card-item:first-child .index-header { margin-top: 0; }
.index-number { font-family: var(--font-mono); font-size: 0.75rem; color: var(--red); letter-spacing: 0.05em; }
.index-title { font-family: var(--font-sinhala); font-size: 1.2rem; font-weight: 700; color: var(--white); }
.index-en { font-family: var(--font-mono); font-size: 0.65rem; color: var(--dim); letter-spacing: 0.05em; white-space: nowrap; }
.index-body { padding-left: 4.25rem; margin-bottom: 1.5rem; }
.index-body p { font-size: 0.92rem; color: var(--light); line-height: 1.7; margin-bottom: 0.75rem; }
.index-body strong { color: var(--white); font-weight: 700; }
.index-body em { color: var(--amber); font-style: normal; }

/* Tags */
.index-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.tag { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; padding: 0.2rem 0.5rem; border: 1px solid var(--border); color: var(--dim); border-radius: 1px; text-transform: uppercase; }
.tag--red    { border-color: var(--red); color: var(--red); }
.tag--yellow { border-color: var(--amber); color: var(--amber); }

/* Media Tags */
.card-media-tags { margin-top: 0.4rem; }
.media-tag { background: var(--dark); border-color: var(--muted); cursor: pointer; transition: all var(--transition); text-transform: none; }
.media-tag:hover { background: var(--mid); color: var(--white); border-color: var(--silver); transform: translateY(-1px); }
.media-tag--video:hover { border-color: var(--gold); color: var(--gold); }
.media-tag--image:hover { border-color: #3b82f6; color: #3b82f6; }
.media-tag--doc:hover { border-color: #10b981; color: #10b981; }
.media-tag--link:hover { border-color: #a855f7; color: #a855f7; }

/* ── Card Share Buttons ──────────────────────────────────── */
.card-share {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  width: fit-content;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f1efe8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  font-size: 0.65rem;
  font-family: var(--font-mono);
}
.share-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}
.share-wa:hover {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.5);
}
.share-fb:hover {
  background: rgba(24, 119, 242, 0.2);
  border-color: rgba(24, 119, 242, 0.5);
}
.share-copy:hover {
  background: rgba(241, 239, 232, 0.12);
}

/* ── Quick access ───────────────────────────────────────── */
.quick-access { width: 100%; background: var(--mid); border-top: 1px solid var(--border); padding: 3rem 1.5rem; text-align: center; }
.qa-title { font-family: var(--font-display); font-size: 2rem; text-align: center; letter-spacing: 0.05em; margin-bottom: 2rem; color: var(--silver); }
.qa-grid { display: flex; gap: 1rem; max-width: 800px; margin: 0 auto; flex-wrap: wrap; justify-content: center; align-items: center; }
.qa-card {
  flex: 1; min-width: 130px; max-width: 160px;
  background: var(--dark); border: 1px solid var(--border);
  padding: 1.5rem 1rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  transition: all var(--transition); border-radius: var(--radius);
}
.qa-card:hover { border-color: var(--red); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(200,0,10,0.2); }
.qa-icon { font-size: 2rem; }
.qa-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--white); }
.qa-sub { font-size: 0.75rem; color: var(--dim); font-family: var(--font-sinhala); }

/* ── Page header ────────────────────────────────────────── */
.page-header { max-width: 1400px; margin: 0 auto; padding: 3rem 1.5rem 2rem; border-bottom: 1px solid var(--border); }
.page-title { font-family: var(--font-display); font-size: clamp(2.5rem, 6vw, 5rem); letter-spacing: 0.03em; line-height: 1; margin-bottom: 0.5rem; }
.page-title span { font-family: var(--font-serif); font-style: italic; color: var(--dim); font-size: 0.55em; margin-left: 0.5rem; vertical-align: middle; }
.page-sub { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.05em; }

/* ── Gallery controls ───────────────────────────────────── */
.gallery-controls { max-width: 1400px; margin: 1.5rem auto; padding: 0 1.5rem; display: flex; align-items: center; gap: 1rem; }
.search-input { background: var(--mid); border: 1px solid var(--border); color: var(--white); padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 0.8rem; border-radius: var(--radius); width: 280px; transition: border-color var(--transition); }
.search-input:focus { outline: none; border-color: var(--red); }
.search-input::placeholder { color: var(--muted); }
.file-count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--dim); margin-left: auto; }

/* ── Gallery masonry ────────────────────────────────────── */
.gallery-masonry { columns: 4; column-gap: 0.75rem; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem 3rem; }
.gallery-item { position: relative; break-inside: avoid; margin-bottom: 0.75rem; cursor: pointer; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); }
.gallery-item img { width: 100%; display: block; transition: transform 0.4s ease; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%); display: flex; flex-direction: column; justify-content: flex-end; padding: 0.75rem; opacity: 0; transition: opacity var(--transition); }
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-filename { font-family: var(--font-mono); font-size: 0.65rem; color: var(--white); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.4rem; }
.gallery-open { font-family: var(--font-mono); font-size: 0.62rem; color: var(--red); letter-spacing: 0.05em; }
.gallery-placeholder { background: var(--mid); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; min-height: 120px; color: var(--muted); font-size: 2rem; }
.gallery-placeholder small { font-family: var(--font-mono); font-size: 0.6rem; }

/* ── Lightbox ───────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 2rem; }
.lightbox.active { display: flex; }
.lightbox-close { position: absolute; top: 1.5rem; right: 1.5rem; background: none; border: 1px solid var(--border); color: var(--white); font-size: 1.2rem; width: 2.5rem; height: 2.5rem; cursor: pointer; border-radius: var(--radius); }
.lightbox-inner { max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; gap: 1rem; }
.lightbox-inner img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: var(--radius); }
.lightbox-caption { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lightbox-caption span { font-family: var(--font-mono); font-size: 0.75rem; color: var(--silver); }

/* ── Universal Lightbox ─────────────────────────────────── */
.univ-lightbox { position: fixed; inset: 0; background: transparent; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 10000; display: none; align-items: center; justify-content: center; padding: 2rem; }
.univ-lightbox.active { display: flex; }
.univ-lightbox-close { position: absolute; top: 1.5rem; right: 1.5rem; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.15); color: var(--white); font-size: 1.2rem; width: 2.5rem; height: 2.5rem; cursor: pointer; border-radius: var(--radius); z-index: 10001; backdrop-filter: blur(8px); }
.univ-lightbox-inner { width: 90vw; max-width: 1200px; height: 90vh; display: flex; flex-direction: column; gap: 1rem; }
.univ-lb-content { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: transparent; border-radius: var(--radius); overflow: hidden; position: relative; }
.univ-media-item { width: 100%; height: 100%; max-height: 100%; object-fit: contain; }
.univ-lightbox-caption { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-shrink: 0; }
.univ-lightbox-caption span { font-family: var(--font-mono); font-size: 0.85rem; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Lightbox Controls (Zoom / Fullscreen) ─────────────── */
.lb-controls { display: flex; align-items: center; gap: 0.4rem; justify-content: center; flex-shrink: 0; padding: 0.3rem 0.6rem; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.lb-ctrl-btn { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #fff; font-size: 1.1rem; width: 2.2rem; height: 2.2rem; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s, transform 0.15s; }
.lb-ctrl-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.08); }
.lb-ctrl-btn:active { transform: scale(0.95); }
.lb-zoom-label { font-family: var(--font-mono); font-size: 0.75rem; color: rgba(255,255,255,0.7); min-width: 3rem; text-align: center; }
.univ-lb-content img { transition: transform 0.15s ease-out; transform-origin: center center; }

/* ── Files grid ─────────────────────────────────────────── */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; max-width: 1400px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.files-grid--videos { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.file-card { background: transparent; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color var(--transition), transform var(--transition); }
.file-card:hover { border-color: var(--red); transform: translateY(-2px); }
.file-thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--dark); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.video-placeholder { color: var(--red); }
.file-info { padding: 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.file-name { font-family: var(--font-mono); font-size: 0.65rem; color: var(--light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-actions { display: flex; gap: 0.4rem; }
.video-thumb-link { position: relative; display: block; aspect-ratio: 16/9; overflow: hidden; }
.video-thumb-link img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.file-thumb-video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; background: var(--dark); }
.video-thumb-link:hover img, .video-thumb-link:hover .file-thumb-video { transform: scale(1.05); }
.play-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: white; background: rgba(0,0,0,0.4); opacity: 0; transition: opacity var(--transition); }
.video-thumb-link:hover .play-badge { opacity: 1; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.5rem 1rem; background: var(--red); color: var(--white); border: 1px solid var(--red); border-radius: var(--radius); cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:hover { background: var(--red-hot); border-color: var(--red-hot); }
.btn--small { font-size: 0.65rem; padding: 0.3rem 0.6rem; }
.btn--lg { font-size: 0.8rem; padding: 0.75rem 1.75rem; }
.btn--outline { background: transparent; color: var(--silver); border-color: var(--border); }
.btn--outline:hover { background: var(--mid); color: var(--white); border-color: var(--silver); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 6rem 1.5rem; color: var(--muted); }
.empty-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 0.5rem; font-size: 0.95rem; }
.empty-sub { font-family: var(--font-mono); font-size: 0.75rem; color: var(--dim); }
.empty-state a { color: var(--red); }
.empty-state .btn { margin-top: 1.5rem; }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--dark); border-top: 1px solid var(--border); padding: 1.25rem 1.5rem; }
.footer-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-brand { font-family: var(--font-display); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.1em; }
.footer-note { font-family: var(--font-mono); font-size: 0.65rem; color: var(--border); }

/* ── Hero Counter ────────────────────────────────────────── */
.hero-counter { display: flex; justify-content: center; gap: 3rem; padding: 2rem 1rem; background: #0a0a0a; border-top: 1px solid #1a1a1a; }
.counter-item { text-align: center; }
.counter-num { display: block; font-family: 'Bebas Neue', sans-serif; font-size: 4rem; color: #c8000a; line-height: 1; }
.counter-label { font-size: 0.65rem; color: #666; letter-spacing: 0.1em; text-transform: uppercase; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* ── Smart TV (1920px+) ─────────────────────────────────── */
@media (min-width: 1920px) {
  .header-inner, .index-section, .quick-access, .page-header,
  .gallery-controls, .gallery-masonry, .files-grid,
  .footer-inner { max-width: 1800px; }
  .gallery-masonry { columns: 6; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .nav-link { font-size: 0.85rem; padding: 0.5rem 1rem; }
  .logo-ministry, .logo-failures { font-size: 1.8rem; }
  body { font-size: 18px; }
}

/* ── Desktop (1200px – 1919px) ──────────────────────────── */
@media (min-width: 1200px) and (max-width: 1919px) {
  .gallery-masonry { columns: 4; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ── Laptop (1024px – 1199px) ───────────────────────────── */
@media (min-width: 1024px) and (max-width: 1199px) {
  .gallery-masonry { columns: 3; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .index-header { grid-template-columns: 3rem 1fr auto; }
}

/* ── Tablet landscape (768px – 1023px) ─────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .header-inner { padding: 0 1rem; gap: 1rem; }
  .main-nav { gap: 0.15rem; }
  .nav-link { font-size: 0.62rem; padding: 0.35rem 0.55rem; }
  .logo-ministry, .logo-failures { font-size: 1.1rem; }
  .gallery-masonry { columns: 3; padding: 0 1rem 2rem; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); padding: 1rem; }
  .index-header { grid-template-columns: 2.5rem 1fr; gap: 1rem; }
  .index-en { display: none; }
  .index-body { padding-left: 3.5rem; }
  .qa-grid { gap: 0.75rem; }
  .qa-card { min-width: 110px; padding: 1.25rem 0.75rem; }
}

/* ── Tablet portrait (600px – 767px) ───────────────────── */
@media (min-width: 600px) and (max-width: 767px) {
  .site-header { height: auto; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; }
  .gallery-masonry { columns: 2; padding: 0 1rem 2rem; column-gap: 0.5rem; }
  .files-grid { grid-template-columns: repeat(2, 1fr); padding: 0.75rem; gap: 0.75rem; }
  .index-header { grid-template-columns: 2rem 1fr; gap: 0.75rem; }
  .index-en { display: none; }
  .index-body { padding-left: 2.75rem; }
  .index-title { font-size: 1rem; }
  .qa-grid { justify-content: space-between; }
  .qa-card { flex: 1 1 45%; max-width: 48%; }
  .btn--small { width: 100%; justify-content: center; }
}

/* ── Mobile (up to 599px) ───────────────────────────────── */
@media (max-width: 599px) {
  .site-header { height: auto; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.6rem 1rem; gap: 0.5rem; }
  .logo-ministry, .logo-failures { font-size: 1rem; }
  .logo-of { font-size: 0.65rem; }
  .logo-year { display: none; }
  .hero-tape { font-size: 0.6rem; }
  .hero-body { padding: 2rem 1rem 1rem; }
  .hero-counter { flex-direction: row; flex-wrap: wrap; justify-content: space-evenly; align-items: center; gap: 1rem 0.5rem; }
  .counter-item { flex: 0 0 auto; text-align: center; min-width: 80px; border-right: none; border-bottom: none; padding: 0.5rem; }
  .counter-num { font-size: 3rem; }
  .counter-label { font-size: 0.6rem; }
  .index-section { padding: 2rem 1rem; }
  .index-header { grid-template-columns: 1.75rem 1fr; gap: 0.5rem; margin-top: 2rem; padding-bottom: 0.5rem; }
  .card-item .index-header { margin-top: 2rem; }
  .card-item:first-child .index-header { margin-top: 0; }
  .index-en { display: none; }
  .index-number { font-size: 0.65rem; }
  .index-title { font-size: 0.95rem; }
  .index-body { padding-left: 2.25rem; }
  .index-body p { font-size: 0.82rem; line-height: 1.6; }
  .tag { font-size: 0.55rem; padding: 0.15rem 0.4rem; }
  .quick-access { padding: 2rem 1rem; }
  .qa-title { font-size: 1.4rem; }
  .qa-grid { gap: 0.5rem; }
  .qa-card { flex: 1 1 40%; max-width: 48%; min-width: 100px; padding: 1rem 0.5rem; }
  .qa-icon { font-size: 1.5rem; }
  .qa-label { font-size: 0.6rem; }
  .qa-sub { font-size: 0.65rem; }
  .page-header { padding: 2rem 1rem 1.5rem; }
  .page-title { font-size: 2.5rem; }
  .gallery-controls { padding: 0 1rem; flex-wrap: wrap; }
  .search-input { width: 100%; }
  .gallery-masonry { columns: 1; padding: 0 1rem 2rem; }
  .files-grid { grid-template-columns: repeat(2, 1fr); padding: 0.75rem 1rem; gap: 0.5rem; }
  .files-grid--videos { grid-template-columns: 1fr; }
  .file-name { font-size: 0.6rem; }
  .btn--small { flex: 1; justify-content: center; font-size: 0.6rem; }
  .btn--lg { font-size: 0.75rem; padding: 0.6rem 1.25rem; }
  .site-footer { padding: 1rem; }
  .footer-inner { flex-direction: column; text-align: center; gap: 0.4rem; }
  .footer-brand { font-size: 0.7rem; }
  .footer-note { font-size: 0.58rem; }
  .lightbox { padding: 1rem; }
  .lightbox-inner img { max-height: 70vh; }
  .lightbox-caption { flex-direction: column; gap: 0.5rem; }
  .lightbox-close { top: 0.75rem; right: 0.75rem; }
}

/* ── Extra small (360px) ────────────────────────────────── */
@media (max-width: 360px) {
  .files-grid { grid-template-columns: 1fr; }
  .qa-card { flex: 1 1 100%; max-width: 100%; }
  .page-title { font-size: 2rem; }
}

/* ── Touch devices ───────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .gallery-overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%); }
  .play-badge { opacity: 1; }
  .btn { min-height: 44px; }
}

/* ── Landscape phone ─────────────────────────────────────── */
@media (max-width: 812px) and (orientation: landscape) {
  .hero-counter { flex-direction: row; }
  .counter-item { padding: 0.75rem 1rem; }
  .counter-num { font-size: 2rem; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE FULLSCREEN NAV
   ══════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .nav-toggle { display: block; margin-left: auto; }
  .gallery-masonry { columns: 2; }
  .index-header { grid-template-columns: 2rem 1fr; }
  .index-en { display: none; }
  .index-body { padding-left: 2.25rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .rules-grid { flex-direction: column; gap: 0.75rem; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .files-grid--videos { grid-template-columns: 1fr; }

  .main-nav {
    display: none;
    position: fixed;
    top: 64px;
    right: 1rem;
    width: 260px;
    background: rgba(17, 17, 17, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--red);
    z-index: 999;
    flex-direction: column;
    padding: 1rem 0;
    gap: 0;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    border-radius: 2px;
    margin-left: 0;
  }

  .main-nav.open { display: flex; }

  .main-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    font-size: 0.9rem;
    color: var(--silver);
    background: none;
  }

  .main-nav .nav-dropdown .nav-link {
    flex-direction: row;
    justify-content: flex-start;
  }

  .main-nav .nav-link:hover,
  .main-nav .nav-link.active {
    color: var(--red);
    background: rgba(200,0,10,0.06);
    border-color: var(--border);
  }

  .nav-si {
    display: inline;
    font-family: var(--font-sinhala);
    font-size: 1rem;
    color: inherit;
  }

  .nav-en {
    display: inline;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-left: auto;
  }

  .nav-sub-links {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-sub-links a {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--dim);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: all var(--transition);
  }

  .nav-sub-links a:hover,
  .nav-sub-links a.nav-link--active {
    color: var(--red) !important;
    border-color: var(--red) !important;
  }

  .nav-dropdown { display: block; }
  .nav-dropdown-menu { display: none !important; }

  .nav-close {
    display: none !important;
  }

  .nav-close:hover { color: var(--white); }
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--mid);
  border: 1px solid var(--border);
  color: var(--light);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: var(--transition);
}

.page-btn:hover {
  background: var(--dark);
  color: var(--white);
  border-color: var(--red);
}

.page-btn.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* ── Card Highlight (shared link pop) ──────────────────── */
.card-highlight {
  animation: cardPop 0.6s ease-out forwards;
  border-left: 3px solid var(--red) !important;
  background: rgba(200, 30, 30, 0.08);
  border-radius: 4px;
  padding-left: 0.75rem;
}

.card-highlight-body {
  animation: cardBodyGlow 0.6s ease-out forwards;
  background: rgba(200, 30, 30, 0.04);
  border-radius: 0 0 4px 4px;
  padding-left: 0.75rem;
  border-left: 3px solid rgba(200, 30, 30, 0.3);
}

@keyframes cardPop {
  0%   { transform: scale(0.95); opacity: 0.5; }
  50%  { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes cardBodyGlow {
  0%   { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ── Client-side Pagination Bar ── */
.pagination-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 2.5rem 0 1.5rem;
}

.pagination-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pagination-nav a,
.pagination-nav a:hover,
.pagination-nav a:focus,
.pagination-nav a:visited {
  text-decoration: none;
}

/* Page number buttons: dark tiles with rounded corners & uniform width */
.pg-btn,
a.pg-btn,
span.pg-btn {
  background: #1c1c1c;
  color: var(--light, #ddd);
  border: 2px solid transparent;
  border-radius: 4px;
  height: 2.4rem;
  min-width: 2.4rem;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.pg-btn:hover:not(.pg-active),
a.pg-btn:hover:not(.pg-active) {
  background: #252525;
  color: #fff;
  text-decoration: none;
}

/* Active page: border highlight in #C8000A only, no fill change */
.pg-active,
span.pg-active {
  border-color: #C8000A !important;
  color: #fff;
}

/* Prev and Next: solid filled red #C8000A action buttons */
.pg-prev,
.pg-next,
a.pg-prev,
a.pg-next,
span.pg-prev,
span.pg-next {
  background: #C8000A;
  color: #fff;
  border: 2px solid #C8000A;
  border-radius: 4px;
  height: 2.4rem;
  padding: 0 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.pg-prev:hover:not(.pg-disabled),
.pg-next:hover:not(.pg-disabled),
a.pg-prev:hover:not(.pg-disabled),
a.pg-next:hover:not(.pg-disabled) {
  background: #a50008;
  border-color: #a50008;
  color: #fff;
  text-decoration: none;
}

/* Disabled state */
.pg-disabled,
span.pg-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  text-decoration: none;
}

/* Plain text ellipsis */
.pg-ellipsis,
span.pg-ellipsis {
  color: var(--dim, #888);
  padding: 0 0.35rem;
  font-size: 0.9rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Per-page selector */
.pagination-size select {
  background: transparent;
  color: var(--text, #eee);
  border: 1px solid var(--border, #444);
  border-radius: 4px;
  height: 2.4rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.pagination-size select:focus {
  outline: none;
  border-color: #C8000A;
}

@media (max-width: 700px) {
  .pagination-nav {
    flex-direction: row;
    gap: 0.25rem;
  }
  .pg-btn,
  a.pg-btn,
  span.pg-btn {
    height: 2.1rem;
    min-width: 2.1rem;
    font-size: 0.8rem;
    padding: 0 0.35rem;
  }
  .pg-prev,
  .pg-next,
  a.pg-prev,
  a.pg-next,
  span.pg-prev,
  span.pg-next {
    height: 2.1rem;
    padding: 0 0.85rem;
    font-size: 0.8rem;
  }
  .pg-ellipsis,
  span.pg-ellipsis {
    height: 2.1rem;
    padding: 0 0.2rem;
    font-size: 0.8rem;
  }
  .pagination-size select {
    height: 2.1rem;
    font-size: 0.8rem;
  }
}

/* ── Cinematic Slideshow with Crossfade, Text Overlay, & Progress Bars ── */
.mof-slideshow {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
}

.mof-slide-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1a1a19;
}

.mof-slide-img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}

.mof-slide-img.on {
  opacity: 1;
  pointer-events: auto;
}

.mof-slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 24px 52px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

.mof-slide-category {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(241, 239, 232, 0.65);
  font-family: sans-serif;
}

.mof-slide-title {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: #f1efe8;
  margin-top: 4px;
  max-width: 56%;
  font-family: sans-serif;
}

.mof-slide-controls {
  position: absolute;
  bottom: 28px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 2;
}

#mofSlideCounter {
  color: #f1efe8;
  font-size: 13px;
  font-family: monospace;
  letter-spacing: 0.04em;
}

.mof-slide-btns {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.mof-slide-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #f1efe8;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  transition: background 0.15s;
}

.mof-slide-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mof-slide-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  display: flex;
  gap: 2px;
  z-index: 2;
}

.mof-slide-dot {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  cursor: pointer;
}

.mof-slide-dot span {
  display: block;
  height: 100%;
  width: 0;
  background: #f1efe8;
}

@media (max-width: 767px) {
  .mof-slide-title {
    font-size: 1.2rem;
  }
  .mof-slide-controls {
    bottom: 24px;
  }
}

@media (max-width: 599px) {
  .mof-slide-title {
    font-size: 1rem;
    max-width: 60%;
  }
  .mof-slide-controls {
    right: 16px;
    bottom: 20px;
  }
  .mof-slide-overlay {
    padding: 16px 16px 48px 16px;
  }
}

/* ── Search ───────────────────────────────────────────────── */
.nav-search-form {
  display: flex;
  align-items: center;
  position: relative;
  margin-right: 0.5rem;
}

.nav-search-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: #f1efe8;
  padding: 5px 14px 5px 34px;
  font-size: 13px;
  width: 180px;
  outline: none;
  transition: width 0.2s, background 0.15s, border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f1efe8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
}

.nav-search-input:focus {
  border-color: rgba(241, 239, 232, 0.45);
  background: rgba(255, 255, 255, 0.11);
  width: 240px;
}

/* Mobile Search Component */
.mob-search-container {
  display: none;
}

@media (max-width: 767px) {
  .header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
  }
  .nav-toggle {
    display: block !important;
    margin-left: 0.5rem !important;
    flex-shrink: 0;
  }
  .nav-search-form {
    display: none !important;
  }
  .mob-search-container {
    display: flex;
    align-items: center;
    margin-left: auto;
  }
  .mob-search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    color: #f1efe8;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }
  .mob-search-trigger:hover,
  .mob-search-trigger:active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
  }
  .mob-search-box {
    display: none;
  }
  .mob-search-container.active .mob-search-trigger {
    display: none !important;
  }
  .mob-search-container.active .mob-search-box {
    display: flex !important;
    align-items: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 52px;
    left: 12px;
    height: 40px;
    background: #191918;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    padding: 0 6px 0 12px;
    z-index: 120;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75);
    animation: mobSearchIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes mobSearchIn {
    from {
      opacity: 0;
      transform: translateY(-50%) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(-50%) scale(1);
    }
  }
  .mob-search-box-icon {
    color: rgba(241, 239, 232, 0.55);
    flex-shrink: 0;
    margin-right: 8px;
    display: flex;
    align-items: center;
  }
  .mob-search-field {
    flex: 1;
    background: transparent;
    border: none;
    color: #f1efe8;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    padding: 6px 0;
    min-width: 0;
  }
  .mob-search-close-btn {
    background: transparent;
    border: none;
    color: #a09e97;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }
  .mob-search-close-btn:hover,
  .mob-search-close-btn:active {
    color: #ffffff;
  }
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #1e1e1c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: none;
  box-sizing: border-box;
}

.search-suggestion-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #d0cec7;
  transition: background 0.15s, color 0.15s;
}

.search-suggestion-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f1efe8;
}

.suggestion-label {
  padding: 6px 16px 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(241, 239, 232, 0.4);
  font-weight: 600;
}

.search-header-block {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.search-title {
  font-family: var(--font-display, inherit);
  font-size: 2.2rem;
  color: #f1efe8;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.search-also-searched {
  font-size: 0.9rem;
  color: rgba(241, 239, 232, 0.5);
  font-style: italic;
  margin-top: 0.25rem;
}

.search-no-results {
  text-align: center;
  padding: 5rem 1rem;
}

.search-empty-si {
  font-size: 1.6rem;
  font-weight: 600;
  color: #f1efe8;
  margin-bottom: 0.25rem;
}

.search-empty-en {
  font-size: 1.1rem;
  color: rgba(241, 239, 232, 0.6);
  margin-bottom: 1.2rem;
}

.search-empty-hint {
  font-size: 0.9rem;
  color: rgba(241, 239, 232, 0.4);
}


