/* CTOS CMS – Mobile-first, PWA-ready */
/* Layer system: প্রতিটি লেয়ারের নিজস্ব stacking context (isolation) + একক z-index স্কেল */
:root {
  --bg: #fff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #0d9488;
  --header-bg: #f8fafc;
  --footer-bg: #0f172a;
  --footer-text: #e2e8f0;
  --card-bg: #f1f5f9;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(0,0,0,.08);
  --font: system-ui, -apple-system, sans-serif;
  /* z-index: লেয়ার অর্ডার ১=হেডার, ২=মেইন, ৩=ফুটার। হেডার ওপরে, মেইন মাঝে, ফুটার নিচের বার */
  --z-below: -1;
  --z-base: 0;
  --z-main: 1;
  --z-footer: 2;
  --z-header: 3;
  --z-dropdown: 4;
  --z-overlay: 5;
  --z-modal-backdrop: 6;
  --z-modal: 7;
  --z-tooltip: 8;
}

.theme-dark {
  --bg: #0f172a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #2dd4bf;
  --header-bg: #0f172a;
  --card-bg: #1e293b;
  --shadow: 0 4px 14px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  height: 100%;
}
/* body: লেয়ার ১→২→৩। হোমসহ সব পেজে ফুটার নিচে – full height + flex */
body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: var(--vh100, 100vh);
  padding-bottom: var(--footer-height, 80px);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}
/* লেয়ার ১: হেডার – সর্বদা প্রথম, ওপরে */
.site-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  isolation: isolate;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 0.75rem 1rem;
  min-height: var(--header-height, 56px);
  display: flex;
  align-items: center;
}
/* লেয়ার ২: মেইন – খালি হোম পেজসহ সব পেজে নিচ পর্যন্ত জায়গা, ফুটার তার নিচে fixed */
.site-main {
  flex: 1 1 auto;
  position: relative;
  z-index: var(--z-main);
  isolation: isolate;
  min-height: 0;
  min-height: calc(100vh - var(--header-height, 56px) - var(--footer-height, 80px));
  min-height: calc(var(--vh100, 100vh) - var(--header-height, 56px) - var(--footer-height, 80px));
}

body.header-fixed .site-header { position: fixed; left: 0; right: 0; top: 0; }
body.header-fixed .site-main { padding-top: var(--header-height, 56px); }
.theme-dark .site-header { border-bottom-color: rgba(255,255,255,.08); }
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.header-inner.logo-right { flex-direction: row-reverse; }
.header-inner.logo-right .site-name { margin-right: 0; margin-left: auto; }
.logo { display: inline-flex; align-items: center; }
.logo img { max-height: 40px; width: auto; }
.site-name { font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.nav-menu {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.nav-menu.is-open { display: flex; }
.nav-menu a { color: var(--text); text-decoration: none; padding: 0.4rem 0; }
.nav-menu a:hover { color: var(--accent); }
.nav-menu .submenu { list-style: none; margin: 0; padding-left: 1rem; }
.nav-menu .submenu a { display: block; }
.nav-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
  position: relative;
}
.nav-toggle::before,
.nav-toggle::after,
.nav-toggle span {
  content: '';
  display: block;
  height: 2px;
  background: var(--text);
  margin: 6px 8px;
  transition: transform .2s;
}
.nav-toggle span { margin: 6px 8px; }
.nav-toggle.is-open::before { transform: translateY(8px) rotate(45deg); }
.nav-toggle.is-open::after { transform: translateY(-8px) rotate(-45deg); }
.nav-toggle.is-open span { opacity: 0; }
@media (min-width: 768px) {
  .nav-menu { display: flex; width: auto; flex-direction: row; flex-wrap: wrap; padding: 0; gap: 0.25rem; }
  .nav-menu .has-sub { position: relative; }
  .nav-menu .submenu { position: absolute; top: 100%; left: 0; min-width: 160px; background: var(--header-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.5rem; display: none; z-index: var(--z-dropdown); }
  .nav-menu .has-sub:hover .submenu { display: block; }
  .nav-toggle { display: none; }
}

/* Blocks – Main এর অধীন প্রতিটি ব্লক আলাদা লেয়ার (আইশোলেশন), ভিতরে bg/caption স্ট্যাক কন্ট্রোল */
.block {
  position: relative;
  isolation: isolate;
  z-index: var(--z-base);
  padding: 2rem 1rem;
}
.block-inner, .block-body { max-width: 800px; margin: 0 auto; }
.block-title { margin: 0 0 1rem; font-size: clamp(1.25rem, 4vw, 2rem); }
.block-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .15;
  z-index: var(--z-below);
}
.theme-dark .block-bg { opacity: .2; }
.block-hero, .block-banner, .block-cta {
  position: relative;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.block-hero .block-inner, .block-banner .block-inner, .block-cta .block-inner { position: relative; z-index: var(--z-base); }
/* পেজ ব্লক: header = মেইনের ভিতরে উপরের সেকশন, footer = মেইনের ভিতরে নিচের সেকশন */
.block-page-header, .block-page-footer {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.block-page-header .block-inner, .block-page-footer .block-body {
  position: relative;
  z-index: var(--z-base);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}
.block-page-footer { min-height: 80px; }

/* 3D Gallery */
.block-gallery-3d { overflow: hidden; padding: 2rem 0; }
.gallery-3d-wrap { perspective: 1000px; padding: 1rem 0; }
.gallery-3d-carousel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  transform-style: preserve-3d;
}
.gallery-3d-item {
  flex: 0 0 calc(50% - 0.5rem);
  max-width: 280px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .3s ease;
  transform: rotateY(0deg);
}
@media (min-width: 600px) {
  .gallery-3d-item { flex: 0 0 calc(33.333% - 0.67rem); }
}
@media (min-width: 900px) {
  .gallery-3d-item { flex: 0 0 calc(25% - 0.75rem); }
}
.gallery-3d-item:hover { transform: rotateY(-8deg) scale(1.02); }
.gallery-3d-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item-title {
  display: block;
  padding: 0.5rem;
  font-size: 0.9rem;
  background: var(--card-bg);
  text-align: center;
}

/* লেয়ার ৩: ফুটার – সব পেজে (হোমসহ) ভিউপোর্টের একদম নিচে, অ্যাডমিন নিয়ন্ত্রণের বাইরে নয় */
.site-footer,
.site-footer-fixed {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: var(--z-footer);
  isolation: isolate;
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 1rem;
  text-align: center;
  min-height: var(--footer-height, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,.1);
}
.footer-content { max-width: 600px; margin: 0 auto 1rem; }
.footer-copy { font-size: 0.875rem; opacity: .95; }

/* Animations */
.anim-fade { animation: fadeIn .6s ease; }
.anim-slideup { animation: slideUp .6s ease; }
.anim-slidedown { animation: slideDown .6s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* Content */
.block-content figure, .block-body figure { margin: 1rem 0; }
.block-content img, .block-body img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }
.block-content img[width], .block-body img[width] { max-width: 100%; }
