/* ==========================================================================
   Bangla Name Meaning — design system
   Signature: illuminated-manuscript inspired — deep teal + brass gold,
   a pointed-arch (mihrab) frame around the search hero, and hairline
   geometric corner ornaments instead of stock photography.
   ========================================================================== */

:root {
  /* Color tokens — modern emerald + warm gold system */
  --teal-950: #06231d;
  --teal-900: #0a3229;
  --teal-800: #0f4738;
  --teal-700: #16624d;
  --gold-600: #b8842a;
  --gold-500: #d6a63f;
  --gold-300: #eecb7d;
  --gold-100: #fbf1dc;
  --maroon-700: #9c3b3b;
  --parchment-100: #fbfaf7;
  --parchment-200: #f2efe6;
  --parchment-300: #e7e2d3;
  --ink-900: #14181a;
  --ink-600: #576066;
  --line: #e3e0d6;

  --bg: var(--parchment-100);
  --bg-elevated: #ffffff;
  --text: var(--ink-900);
  --text-muted: var(--ink-600);
  --accent: var(--teal-800);
  --accent-strong: var(--teal-950);
  --brand-surface: var(--teal-950); /* header/hero/footer — constant across themes */
  --gold: var(--gold-500);
  --border: var(--line);

  --shadow-sm: 0 1px 2px rgba(20, 24, 26, 0.05);
  --shadow: 0 2px 8px rgba(20, 24, 26, 0.05), 0 10px 28px rgba(10, 50, 41, 0.08);
  --shadow-lg: 0 8px 20px rgba(10, 50, 41, 0.10), 0 24px 48px rgba(10, 50, 41, 0.16);

  --font-display: "Amiri", "Noto Serif Bengali", Georgia, serif;
  --font-body: "Hind Siliguri", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-arabic: "Noto Naskh Arabic", "Amiri", serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --container: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #071e19;
  --bg-elevated: #0e2f27;
  --text: #eef3ef;
  --text-muted: #9fc2b3;
  --accent: var(--gold-300);
  --accent-strong: var(--gold-500);
  --border: #1a4438;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.25), 0 10px 28px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

.arabic { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; }
.bangla { font-family: "Hind Siliguri", var(--font-body); }

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.25;
  font-weight: 700;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

/* ---- Signature: kilim border ----
   A woven zigzag trim, drawn from the triangle borders on Nakshi
   kantha embroidery and manuscript page edges. Used sparingly as the
   one recurring flourish: under the header, above the footer, and
   between the hero and the page body. */
.kilim {
  height: 10px;
  background-image:
    linear-gradient(135deg, var(--gold-500) 25%, transparent 25.5%),
    linear-gradient(-135deg, var(--gold-500) 25%, transparent 25.5%);
  background-size: 20px 20px;
  background-position: 0 0;
  background-color: var(--teal-950);
  background-repeat: repeat-x;
}


/* ---- Header ---- */
.site-header {
  background: var(--brand-surface);
  color: var(--parchment-100);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-size: 1.3rem; letter-spacing: 0.01em; }
.brand .mark { color: var(--gold-300); font-size: 1.5rem; }
.brand-mark { display: block; border-radius: 8px; flex-shrink: 0; }
.brand:hover { text-decoration: none; opacity: 0.92; }
.footer-brand { font-size: 1.1rem; margin-bottom: 10px; }

.main-nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
@media (max-width: 720px) {
  .site-header .container { flex-direction: column; align-items: flex-start; gap: 10px; }
  .main-nav { gap: 14px; font-size: 0.9rem; }
  .hero { padding: 48px 20px 40px; }
}
.main-nav a { position: relative; color: var(--parchment-200); font-size: 0.92rem; padding-bottom: 3px; }
.main-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--gold-300); transition: right 0.25s var(--ease);
}
.main-nav a:hover { color: var(--gold-100); text-decoration: none; }
.main-nav a:hover::after { right: 0; }

.theme-toggle {
  background: transparent; border: 1px solid rgba(255,255,255,0.3); color: var(--parchment-200);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 0.8rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--gold-300); color: var(--gold-300); }

/* ---- Hero / arch-framed search ---- */
.hero {
  position: relative;
  padding: 72px 20px 56px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200,155,60,0.16), transparent 62%),
    var(--brand-surface);
  color: var(--parchment-100);
  overflow: hidden;
}
/* faint diaper-lattice texture, evoking manuscript vellum */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(227,199,128,0.06) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(-45deg, rgba(227,199,128,0.06) 0 1px, transparent 1px 42px);
  pointer-events: none;
}
.hero .container { position: relative; }

.hero-eyebrow {
  font-family: var(--font-arabic);
  color: var(--gold-300);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  direction: rtl;
}
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4vw, 2.9rem); margin: 0 0 12px; letter-spacing: -0.01em; }
.hero p.lede { color: var(--parchment-200); max-width: 560px; margin: 0 auto 40px; font-size: 1.08rem; }

.arch-frame { max-width: 560px; margin: 0 auto; }
.arch-ornament { display: block; width: 100%; height: auto; margin-bottom: -1px; }
.arch-ornament .arch-line { fill: none; stroke: var(--gold-300); stroke-width: 1.5; opacity: 0.85; }
.arch-ornament .arch-star { fill: var(--gold-300); }

.search-pill {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  background: var(--parchment-100);
  border: 1px solid var(--gold-300);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
}
.search-form { display: flex; align-items: stretch; gap: 6px; width: 100%; }
.search-form input[type="text"] {
  flex: 1;
  width: 100%;
  display: block;
  padding: 13px 20px;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  font-family: var(--font-body);
  background: transparent;
  color: var(--ink-900);
}
.search-form input[type="text"]:focus { outline: none; }
.search-form button {
  flex-shrink: 0;
  padding: 13px 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500));
  color: var(--teal-950);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-form button:hover { box-shadow: 0 4px 14px rgba(200,155,60,0.4); transform: translateY(-1px); }
.hero-links { margin-top: 22px; font-size: 0.9rem; }
.hero-links a { color: var(--gold-300); margin: 0 6px; }

.autocomplete-wrap { position: relative; flex: 1; }
.autocomplete-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  text-align: left; overflow: hidden; z-index: 20; display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-list a {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 16px; color: var(--text); border-bottom: 1px solid var(--border);
}
.autocomplete-list a:last-child { border-bottom: none; }
.autocomplete-list a:hover { background: var(--parchment-200); text-decoration: none; }
.autocomplete-list small { color: var(--text-muted); }

/* ---- Sections ---- */
section.block { padding: 48px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 8px; }
.section-head h2 { margin: 0; font-size: 1.5rem; }
.section-head .see-all { font-size: 0.9rem; }

.stat-line { color: var(--text-muted); font-size: 0.95rem; }

/* ---- Name cards ---- */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.name-card {
  position: relative;
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-radius: var(--radius-md);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-top-color 0.2s var(--ease);
}
.name-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-top-color: var(--gold-500);
  text-decoration: none;
}
.name-card .en { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--text); display: block; letter-spacing: -0.01em; }
.name-card .bn { font-family: "Hind Siliguri", var(--font-body); color: var(--text-muted); display: block; margin-top: 3px; font-size: 0.95rem; }
.name-card .meta { display: flex; gap: 8px; margin-top: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.badge.gold { border-color: var(--gold-500); color: var(--gold-600); background: rgba(200,155,60,0.08); }
[data-theme="dark"] .badge.gold { color: var(--gold-300); }
.badge.boy { border-color: var(--teal-700); color: var(--teal-700); background: rgba(26,96,88,0.06); }
[data-theme="dark"] .badge.boy { color: var(--teal-700); background: rgba(26,96,88,0.18); }
.badge.girl { border-color: var(--maroon-700); color: var(--maroon-700); background: rgba(122,46,46,0.06); }
[data-theme="dark"] .badge.girl { background: rgba(122,46,46,0.2); }
.badge.unisex { border-color: var(--gold-600); color: var(--gold-600); background: rgba(166,124,46,0.08); }

/* ---- Category chips ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font-size: 0.9rem; font-weight: 500;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease);
}
.chip:hover { border-color: var(--gold-500); background: var(--parchment-200); text-decoration: none; transform: translateY(-1px); }
[data-theme="dark"] .chip:hover { background: var(--teal-800); }

/* ---- Name detail page ---- */
.name-hero {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px 36px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow: hidden;
}
.name-hero::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300) 50%, var(--gold-500));
}
.name-hero .titles { display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline; }
.name-hero h1 { font-size: 2.4rem; margin: 0; }
/* illuminated initial — a manuscript-illumination echo, the one drop-cap
   flourish on the page, reserved for the name itself */
.name-hero h1::first-letter {
  color: var(--gold-600);
  font-size: 1.15em;
}
[data-theme="dark"] .name-hero h1::first-letter { color: var(--gold-300); }
.name-hero .bangla-title { font-size: 1.6rem; color: var(--text-muted); }
.name-hero .arabic-title { font-size: 2rem; }
.name-hero .pronunciation { color: var(--text-muted); margin-top: 8px; font-style: italic; }
.name-hero .badges { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.name-hero .badges a.badge { transition: border-color 0.2s ease, color 0.2s ease; }
.name-hero .badges a.badge:hover { border-color: var(--gold-500); color: var(--gold-600); text-decoration: none; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 820px) { .detail-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 24px 26px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { font-size: 1.15rem; margin-top: 0; color: var(--accent-strong); }
[data-theme="dark"] .card h2, [data-theme="dark"] .card h3 { color: var(--gold-300); }
.def-list dt { font-weight: 600; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 14px; }
.def-list dt:first-child { margin-top: 0; }
.def-list dd { margin: 4px 0 0; }

.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin: 18px 0; }
.breadcrumbs a { color: var(--text-muted); }

/* ---- Search results ---- */
.search-meta { color: var(--text-muted); margin-bottom: 20px; }
.pagination { display: flex; gap: 10px; justify-content: center; margin-top: 30px; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text);
}
.pagination .disabled { opacity: 0.4; }

/* ---- Forms (admin) ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
  font-family: var(--font-body); font-size: 0.95rem; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--gold-500);
  background: var(--gold-500); color: var(--teal-950); font-weight: 700; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--gold-300); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent-strong); border-color: var(--border); }
.btn.danger { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; }

table.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); border-radius: var(--radius-md); overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
table.admin-table th { background: var(--parchment-200); }
[data-theme="dark"] table.admin-table th { background: var(--teal-900); }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 0.92rem; }
.flash.success { background: #e3f3ec; color: #1b6b45; border: 1px solid #a9dcc4; }
.flash.danger { background: #fbe9e7; color: #a4342a; border: 1px solid #f2b8b0; }
.flash.warning { background: #fff6e0; color: #8a6415; border: 1px solid #f0d99a; }
.flash.info { background: #e8f1fb; color: #1e5a96; border: 1px solid #b7d5f2; }

.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 70vh; }
.admin-sidebar { border-right: 1px solid var(--border); padding: 24px 0; }
.admin-sidebar a { display: block; padding: 10px 24px; color: var(--text); }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--parchment-200); text-decoration: none; }
[data-theme="dark"] .admin-sidebar a:hover, [data-theme="dark"] .admin-sidebar a.active { background: var(--teal-900); }
.admin-main { padding: 28px 32px; }
@media (max-width: 760px) { .admin-shell { grid-template-columns: 1fr; } .admin-sidebar { border-right: none; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; padding: 8px; } .admin-sidebar a { padding: 8px 14px; white-space: nowrap; } }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.stat-card .num { font-family: var(--font-display); font-size: 1.8rem; color: var(--accent-strong); }
.stat-card .label { color: var(--text-muted); font-size: 0.85rem; }

/* ---- Footer ---- */
.site-footer {
  background: var(--teal-950); color: var(--parchment-200);
  padding: 40px 0 24px; margin-top: 60px; font-size: 0.9rem;
}
.site-footer a { color: var(--gold-300); }
.footer-cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.footer-cols h4 { color: #fff; font-family: var(--font-display); font-size: 1rem; margin-bottom: 10px; }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols li { margin-bottom: 6px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 26px; padding-top: 16px; font-size: 0.8rem; color: var(--parchment-200); opacity: 0.75; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h2 { color: var(--text); }

/* ---- Static site additions: letter index ---- */
.letter-jump {
  margin: 20px 0 32px; font-size: 0.9rem; line-height: 2.2;
  padding: 14px 18px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.letter-jump a { color: var(--gold-600); margin-right: 2px; font-weight: 600; }
.letter-heading {
  margin-top: 44px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--accent-strong);
}
[data-theme="dark"] .letter-heading { color: var(--gold-300); }
.letter-heading::first-letter { color: var(--gold-600); }
[data-theme="dark"] .letter-heading::first-letter { color: var(--gold-300); }
