/* BUET CSE Admission Ebook — shared styles */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #5b6579;
  --brand: #0f4c81;
  --brand-2: #1976d2;
  --accent: #e8f1fa;
  --border: #dde4ee;
  --good: #1b7f4d;
  --warn: #b45309;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 34, 60, 0.08), 0 4px 14px rgba(16, 34, 60, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", "Noto Sans Bengali", "Hind Siliguri", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16.5px;
}

/* ---------- Language switching ---------- */
/* Default: English visible */
.bn { display: none; }
body.lang-bn .bn { display: revert; }
body.lang-bn .en { display: none; }
/* inline spans need inline display */
span.bn { display: none; }
body.lang-bn span.bn { display: inline; }
body.lang-bn span.en { display: none; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.home-link {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.92;
  white-space: nowrap;
}
.home-link:hover { opacity: 1; text-decoration: underline; }
.header-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 200px;
}

/* Language switch tabs */
.lang-switch {
  display: flex;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  padding: 3px;
  gap: 2px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lang-switch button.active {
  background: #fff;
  color: var(--brand);
}

/* ---------- Layout ---------- */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---------- Hero (index) ---------- */
.hero {
  text-align: center;
  padding: 34px 16px 26px;
}
.hero h1 {
  font-size: 2rem;
  margin: 0 0 10px;
  color: var(--brand);
}
.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* Topic cards grid (index) */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 26px;
}
.topic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: block;
}
.topic-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-2);
  box-shadow: 0 6px 20px rgba(16, 34, 60, 0.12);
}
.topic-card .num {
  display: inline-block;
  background: var(--accent);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 6px;
  padding: 2px 9px;
  margin-bottom: 8px;
}
.topic-card h2 {
  font-size: 1.08rem;
  margin: 0 0 6px;
  color: var(--brand);
}
.topic-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Topic page content ---------- */
article.topic h1 {
  color: var(--brand);
  font-size: 1.7rem;
  margin: 6px 0 4px;
}
article.topic .subtitle {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 1rem;
}

section.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}
section.card > h2 {
  margin-top: 0;
  color: var(--brand);
  font-size: 1.3rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
}
section.card h3 {
  color: var(--brand-2);
  font-size: 1.08rem;
  margin: 22px 0 8px;
}

/* Table of contents box */
.toc {
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin: 18px 0 26px;
}
.toc strong { color: var(--brand); }
.toc ol { margin: 8px 0 0; padding-left: 22px; }
.toc a { color: var(--brand-2); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ---------- Code blocks ---------- */
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 0.87rem;
  line-height: 1.55;
}
code {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}
p code, li code, td code {
  background: var(--accent);
  color: var(--brand);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.87em;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 14px 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  background: #fff;
}
th, td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
th { background: var(--accent); color: var(--brand); }
tr:nth-child(even) td { background: #fafcff; }

/* ---------- Callouts ---------- */
.note, .example-box, .formula-box {
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
  border: 1px solid var(--border);
}
.note {
  background: #fff8e6;
  border-left: 4px solid var(--warn);
}
.example-box {
  background: #f0faf4;
  border-left: 4px solid var(--good);
}
.example-box > strong:first-child { color: var(--good); }
.formula-box {
  background: var(--accent);
  border-left: 4px solid var(--brand-2);
  overflow-x: auto;
}

/* ---------- Images ---------- */
figure {
  margin: 18px 0;
  text-align: center;
}
figure img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
}
figcaption {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- Practice questions ---------- */
.question {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 14px 0;
  background: #fff;
  overflow: hidden;
}
.question .q-text {
  padding: 14px 18px 6px;
}
.question .q-text .q-num {
  font-weight: 700;
  color: var(--brand);
  margin-right: 6px;
}
.question details {
  border-top: 1px dashed var(--border);
  background: #fbfdff;
}
.question summary {
  cursor: pointer;
  padding: 10px 18px;
  font-weight: 600;
  color: var(--brand-2);
  user-select: none;
}
.question summary:hover { background: var(--accent); }
.question details[open] summary { border-bottom: 1px dashed var(--border); }
.question .answer {
  padding: 12px 18px 16px;
}

/* MCQ options */
ul.options {
  list-style: none;
  padding-left: 6px;
  margin: 8px 0;
}
ul.options li { margin: 4px 0; }
ul.options li::before {
  content: "○ ";
  color: var(--brand-2);
}

/* ---------- Prev / next nav ---------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 34px;
  flex-wrap: wrap;
}
.page-nav a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
.page-nav a:hover { border-color: var(--brand-2); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 22px 16px 34px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .container { padding: 18px 14px 60px; }
  section.card { padding: 16px 16px; }
  .hero h1 { font-size: 1.5rem; }
  article.topic h1 { font-size: 1.35rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .page-nav, .site-footer { display: none; }
  section.card { box-shadow: none; page-break-inside: avoid; }
  .question details { display: block; }
}
