/* ============================================================
   BanglaText Toolkit — Design System
   Light + Dark theme, mobile-first, zero framework
   ============================================================ */

@font-face {
  font-family: 'Noto Sans Bengali';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/noto-sans-bengali-bengali-400-normal.woff2') format('woff2'),
       url('../fonts/noto-sans-bengali-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Sans Bengali';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/noto-sans-bengali-bengali-700-normal.woff2') format('woff2'),
       url('../fonts/noto-sans-bengali-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #191b2e;
  --muted: #5f6480;
  --border: #e4e6f2;
  --primary: #4f46e5;
  --primary-h: #4338ca;
  --primary-soft: #eef1ff;
  --accent: #c2560a;
  --accent-soft: #fdf1dc;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 3px rgba(25, 27, 46, .07), 0 8px 24px rgba(25, 27, 46, .06);
  --shadow-lg: 0 12px 40px rgba(25, 27, 46, .13);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 62px;
}
[data-theme="dark"] {
  --bg: #0d0e17;
  --card: #14162a;
  --text: #e7e9f7;
  --muted: #9aa0c0;
  --border: #262a47;
  --primary: #8b93f8;
  --primary-h: #a5acf9;
  --primary-soft: #1f2140;
  --accent: #f0a04b;
  --accent-soft: #2d230e;
  --warn: #f0b429;
  --warn-soft: #33270f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans Bengali', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; flex: none; }
.brand .logo-orb { border-radius: 9px; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: .92rem; font-weight: 700;
}
.nav-links a:hover { color: var(--text); background: var(--primary-soft); text-decoration: none; }
.header-spacer { flex: 1; }
.hbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--card); color: var(--text);
  cursor: pointer; font: inherit; font-size: .85rem; font-weight: 700;
}
.hbtn:hover { border-color: var(--primary); color: var(--primary); }
.hbtn .icn { width: 17px; height: 17px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .95rem;
  transition: all .15s ease; user-select: none; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn .icn { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-h); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { filter: brightness(.97); }
.btn-danger { background: transparent; color: var(--accent); border-color: transparent; }
.btn-danger:hover { background: var(--accent-soft); }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 8px; }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 34px; text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .85rem; font-weight: 700; padding: 6px 14px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero .badge .icn { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.3; letter-spacing: -.5px; }
.hero h1 .hl { color: var(--primary); }
.hero p.sub { max-width: 640px; margin: 14px auto 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- Sections ---------- */
.section { padding: 34px 0; }
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 { font-size: 1.55rem; }
.section-head p { color: var(--muted); margin-top: 6px; }

/* ---------- Tool grid (home) ---------- */
.toolgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px;
}
.toolcard {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px; color: var(--text);
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative; overflow: hidden;
}
.toolcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); text-decoration: none; }
.toolcard .ticon {
  width: 44px; height: 44px; border-radius: 11px; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.toolcard .ticon .icn { width: 23px; height: 23px; }
.toolcard h3 { font-size: 1.04rem; margin-bottom: 5px; }
.toolcard p { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.toolcard .go {
  position: absolute; top: 18px; right: 18px; color: var(--muted); opacity: 0; transition: opacity .15s;
}
.toolcard:hover .go { opacity: 1; color: var(--primary); }
.toolcard .go .icn { width: 18px; height: 18px; }

/* ---------- Feature strip ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.feature .ticon { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.feature .ticon .icn { width: 21px; height: 21px; }
.feature h3 { font-size: 1rem; margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: .88rem; }

/* ---------- Tool page layout ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); padding: 18px 0 0; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .5; }
.tool-hero { display: flex; align-items: center; gap: 16px; padding: 22px 0 8px; }
.tool-hero .ticon {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.tool-hero .ticon .icn { width: 28px; height: 28px; }
.tool-hero h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.25; }
.tool-hero p { color: var(--muted); margin-top: 3px; font-size: .95rem; }
.tool-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-top: 18px;
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: .86rem; font-weight: 700; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="email"], .field input[type="tel"], .field input[type="url"],
.field select, .field textarea {
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; outline: none; width: 100%; transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; user-select: none; }
.checkline input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.radioline { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; margin-bottom: 7px; }
.radioline input { accent-color: var(--primary); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--primary); cursor: pointer; }
.rangeval { font-size: .82rem; color: var(--muted); text-align: right; margin-top: 2px; }
.opts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px; margin-top: 20px;
}
.optcard {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px;
}
.optcard.full { grid-column: 1 / -1; }
.optcard h4 { font-size: .92rem; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.optcard .field { margin-bottom: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); cursor: pointer; font: inherit;
  font-size: .88rem; font-weight: 700; transition: all .13s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Two-pane text converter ---------- */
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pane-head h4 { font-size: .92rem; display: flex; align-items: center; gap: 7px; }
.pane-head .pcnt { color: var(--muted); font-size: .78rem; font-weight: 400; }
.pane textarea {
  font: inherit; font-size: 1rem; line-height: 1.7; color: var(--text);
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; outline: none; width: 100%; min-height: 210px; resize: vertical;
  transition: border-color .15s;
}
.pane textarea:focus { border-color: var(--primary); }
.pane textarea:read-only { background: var(--bg); }
.pane-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.pane-tools .btn { padding: 7px 12px; font-size: .82rem; border-radius: 8px; }
.swapwrap { display: flex; justify-content: center; margin: 10px 0 2px; }

/* ---------- status / result ---------- */
.status { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: .92rem; display: none; align-items: flex-start; gap: 9px; }
.status.show { display: flex; }
.status .icn { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.status.ok { background: var(--primary-soft); color: var(--primary); }
.status.err { background: var(--accent-soft); color: var(--accent); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.info { background: var(--primary-soft); color: var(--text); }

.resultarea { margin-top: 18px; display: none; }
.resultarea.show { display: block; }
.resultcard {
  border: 1.5px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--card));
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.resultcard .rtitle { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.resultcard .rtitle .icn { width: 20px; height: 20px; color: var(--primary); }
.resultcard .rmeta { color: var(--muted); font-size: .88rem; margin-bottom: 16px; }
.resultcard .rmeta b { color: var(--text); }
.resultbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- stat chips (word counter etc.) ---------- */
.chipgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-top: 18px;
}
.chip {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; text-align: center;
}
.chip .cval { font-size: 1.45rem; font-weight: 700; color: var(--primary); line-height: 1.2; word-break: break-all; }
.chip .clabel { color: var(--muted); font-size: .8rem; margin-top: 3px; }

/* ---------- virtual keyboard ---------- */
.kb {
  display: flex; flex-direction: column; gap: 6px; margin-top: 14px;
  user-select: none; -webkit-user-select: none;
}
.kb-row { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; }
.kb-row + .kb-row { margin-top: 0; }
.kkey {
  flex: 1; min-width: 0; height: 52px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--card); cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  transition: all .06s ease; padding: 2px;
  line-height: 1.15; text-align: center;
}
.kkey:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.kkey:active, .kkey.pressed { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(.96); }
.kkey .sub { font-size: .62rem; color: var(--muted); position: absolute; top: 2px; right: 4px; line-height: 1; }
.kkey:hover .sub { color: var(--primary); }
.kkey.wide2 { flex: 2; }
.kkey.wide25 { flex: 2.5; }
.kkey.wide6 { flex: 6; }
.kkey.wide7 { flex: 7; }
.kkey.fn { flex: 1.5; font-size: .8rem; color: var(--muted); background: var(--bg); }
.kkey.fn:hover { color: var(--primary); }
.kb-hint { text-align: center; color: var(--muted); font-size: .84rem; margin-top: 10px; }

/* ---------- date converter result ---------- */
.datecard { text-align: center; padding: 10px 0 2px; }
.datecard .dbig { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; color: var(--primary); line-height: 1.4; }
.datecard .dsub { color: var(--muted); font-size: .95rem; margin-top: 4px; }
.datecard .dchips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.datecard .dchip {
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; font-size: .85rem; color: var(--text);
}
.datecard .dchip b { color: var(--primary); }

/* ---------- TTS ---------- */
.voicelist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.voicerow {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .88rem; cursor: pointer; transition: border-color .13s;
}
.voicerow:hover { border-color: var(--primary); }
.voicerow.active { border-color: var(--primary); background: var(--primary-soft); }
.voicerow .vname { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voicerow .vlang { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.speaking-bar { display: flex; align-items: center; justify-content: center; gap: 4px; height: 26px; }
.speaking-bar span { width: 4px; background: var(--primary); border-radius: 3px; animation: bounce .9s ease-in-out infinite; }
.speaking-bar span:nth-child(1) { height: 10px; animation-delay: 0s; }
.speaking-bar span:nth-child(2) { height: 18px; animation-delay: .15s; }
.speaking-bar span:nth-child(3) { height: 24px; animation-delay: .3s; }
.speaking-bar span:nth-child(4) { height: 15px; animation-delay: .45s; }
.speaking-bar span:nth-child(5) { height: 9px; animation-delay: .6s; }
@keyframes bounce { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1.15); } }

/* ---------- list sorter ---------- */
.sortlist { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
.sortlist .sl-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 13px; font-size: .95rem;
}
.sortlist .sl-item .sl-idx { color: var(--muted); font-size: .78rem; min-width: 26px; text-align: right; }
.sortlist .sl-item .sl-text { flex: 1; min-width: 0; word-break: break-word; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; counter-reset: step; }
.step {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative;
}
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: -13px; left: 16px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step h3 { font-size: .98rem; margin: 6px 0 4px; }
.step p { color: var(--muted); font-size: .87rem; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; }
.faq details {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 18px; box-shadow: var(--shadow);
}
.faq summary {
  cursor: pointer; font-weight: 700; font-size: .95rem; padding: 15px 0;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ''; width: 9px; height: 9px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s; margin-right: 4px;
}
.faq details[open] summary::after { transform: rotate(225deg); }
.faq .fa-body { color: var(--muted); font-size: .9rem; padding: 0 0 16px; }

/* ---------- SEO article ---------- */
.seo-article { max-width: 760px; margin: 0 auto; color: var(--muted); font-size: .93rem; }
.seo-article h2 { color: var(--text); font-size: 1.2rem; margin: 18px 0 8px; }
.seo-article h2:first-child { margin-top: 0; }
.seo-article p, .seo-article li { line-height: 1.75; }
.seo-article ul { padding-left: 22px; margin: 8px 0; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 46px; border-top: 1px solid var(--border);
  background: var(--card); padding: 34px 0 26px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid h4 { font-size: .92rem; margin-bottom: 10px; }
.footer-grid p, .footer-grid a { color: var(--muted); font-size: .87rem; }
.footer-grid ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.footer-grid a:hover { color: var(--primary); text-decoration: none; }
.footer-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text) !important; font-size: 1.02rem; margin-bottom: 10px; }
.footer-brand .logo { width: 28px; height: 28px; }
.footer-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  color: var(--muted); font-size: .82rem;
}

/* ---------- Ad placeholder ---------- */
.ad-slot { margin: 22px auto; text-align: center; min-height: 0; }

/* ---------- misc ---------- */
.icn { width: 20px; height: 20px; flex: none; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .panes { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 36px 0 24px; }
  .tool-panel { padding: 18px 14px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .tool-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .steps { grid-template-columns: 1fr; }
  .resultbtns .btn { width: 100%; }
  .kkey { height: 44px; font-size: 1.05rem; border-radius: 7px; }
  .kb-row { gap: 4px; }
  .pane textarea { min-height: 160px; }
  .swapwrap .btn { width: 100%; }
}
