/* ইতিহাসের জীবন্ত লাইব্রেরি — থিম ভেরিয়েবল: ডার্ক ডিফল্ট, লাইট ওভাররাইড */
:root {
  --bg: #0b0e14;
  --bg-soft: #11151f;
  --surface: #161b28;
  --surface-2: #1d2334;
  --text: #f2f0e9;
  --muted: #aab0c0;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #e8b64c;
  --accent-ink: #241a05;
  --accent-soft: rgba(232, 182, 76, 0.16);
  --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 14, 20, 0.85);
  --chip-bg: #1d2334;
  --input-bg: #161b28;
  --canvas-text: #ffffff;
  --canvas-muted: #d5d9e4;
}
html[data-theme="light"] {
  --bg: #f2f5f9;
  --bg-soft: #e9edf3;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --text: #17233c;
  --muted: #5b6b82;
  --line: rgba(23, 35, 60, 0.14);
  --accent: #a86f0e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(168, 111, 14, 0.14);
  --card-shadow: 0 8px 24px rgba(23, 35, 60, 0.12);
  --header-bg: rgba(242, 245, 249, 0.9);
  --chip-bg: #ffffff;
  --input-bg: #ffffff;
  --canvas-text: #ffffff;
  --canvas-muted: #d5d9e4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Hind Siliguri", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
h1, h2, h3 { font-family: "Noto Serif Bengali", "Hind Siliguri", serif; line-height: 1.35; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* হেডার */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { font-size: 30px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: "Noto Serif Bengali", serif; font-size: 18px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  color: var(--text); font-weight: 600; font-size: 15px;
}
.site-nav a.active, .site-nav a:hover { background: var(--accent-soft); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}

main { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.view[hidden] { display: none; }

/* হিরো */
.hero { text-align: center; padding: 44px 12px 8px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); margin: 0 0 8px; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 18px; max-width: 640px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hero-stats span {
  background: var(--surface); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}

/* খোঁজা ও ফিল্টার */
.controls { margin: 28px 0 8px; }
#searchBox {
  width: 100%; padding: 14px 18px; font-size: 17px; font-family: inherit;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--input-bg); color: var(--text); outline: none;
}
#searchBox:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--text);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.result-count { color: var(--muted); margin: 14px 2px 0; }
.no-result { text-align: center; color: var(--muted); padding: 40px 0; }

/* কার্ড গ্রিড */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px; margin-top: 16px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; cursor: pointer; box-shadow: var(--card-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
  text-align: left; padding: 0; color: var(--text);
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.card img { width: 100%; height: 180px; object-fit: cover; background: var(--bg-soft); }
.card-body { padding: 14px 16px 16px; }
.card-body h3 { margin: 0 0 4px; font-size: 19px; }
.card-meta { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line);
}
.badge.country { background: var(--surface-2); color: var(--muted); }

/* বিস্তারিত */
.back-btn, .nav-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; margin: 20px 0 0;
}
.back-btn:hover, .nav-btn:hover { border-color: var(--accent); }
.detail-head h2 { font-size: clamp(26px, 4vw, 38px); margin: 14px 0 4px; }
.detail-sub { color: var(--muted); margin: 0 0 18px; font-size: 17px; }
.gallery { margin: 0 0 20px; }
.gallery-main { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 18px; background: var(--bg-soft); border: 1px solid var(--line); }
.gallery-caption { color: var(--muted); font-size: 14px; margin: 8px 2px 0; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumbs button {
  flex: 1; padding: 0; border: 2px solid transparent; border-radius: 12px;
  overflow: hidden; background: none;
}
.gallery-thumbs button.active { border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 84px; object-fit: cover; }
.fact-box {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin: 0 0 24px;
}
.fact-box div b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.fact-box div span { font-size: 16px; font-weight: 600; }
.detail-section { margin: 0 0 22px; }
.detail-section h3 { font-size: 22px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); display: inline-block; }
.detail-section p { margin: 0 0 10px; font-size: 17px; }
.detail-list { margin: 0 0 6px; padding-left: 22px; font-size: 17px; }
.detail-list li { margin: 0 0 8px; }
.detail-list li::marker { color: var(--accent); }
.detail-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }
.ai-note { color: var(--muted); font-size: 13px; }

/* থ্রিডি */
.view-head h2 { font-size: 30px; margin: 24px 0 4px; }
.view-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.daynight-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; margin-top: 24px;
}
.daynight-btn:hover { border-color: var(--accent); }
.view-head p { color: var(--muted); margin: 0 0 16px; }
.three-wrap {
  position: relative; height: 62vh; min-height: 380px;
  border-radius: 18px; overflow: hidden;
  background: #07080b; border: 1px solid var(--line);
}
#threeCanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.three-labels { position: absolute; inset: 0; pointer-events: none; }
.model-label {
  position: absolute; transform: translate(-50%, -130%);
  pointer-events: auto; cursor: pointer;
  background: rgba(10, 13, 20, 0.78); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.model-label:hover { background: var(--accent); color: var(--accent-ink); }
.three-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; background: rgba(7, 8, 11, 0.6);
}
.three-loading[hidden] { display: none; }
.model-jump { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.model-jump button {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
}
.model-jump button:hover { border-color: var(--accent); }
.three-note { color: var(--muted); font-size: 14px; }

/* ফুটার */
.site-footer {
  border-top: 1px solid var(--line); padding: 22px 20px 30px;
  text-align: center; color: var(--muted); font-size: 14px;
}
.site-footer p { margin: 4px 0; }

@media (max-width: 640px) {
  .site-header { padding: 10px 12px; flex-wrap: wrap; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 16px; }
  .site-nav a { padding: 7px 10px; font-size: 14px; }
  .theme-toggle { padding: 7px 10px; font-size: 13px; }
  main { padding: 0 12px 32px; }
  .hero { padding-top: 28px; }
  .hero p { font-size: 16px; }
  .card img { height: 160px; }
  .three-wrap { height: 52vh; min-height: 320px; }
  .model-label { font-size: 12px; padding: 4px 9px; }
}
