@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Noto+Sans+Bengali:wght@400;600;700&display=swap');

/* ===========================
   THEME VARIABLES
=========================== */
:root{
  --bg:#f5f7fa;
  --card:#ffffff;
  --text:#0b1a33;
  --muted:#52606d;
  --link:#0b5fff;
  --border:rgba(0,0,0,.08);
  --shadow:0 10px 24px rgba(0,0,0,.08);
}

body.dark{
  --bg:#0b1a33;
  --card:#0f2347;
  --text:#e6eaf2;
  --muted:#b7c3d6;
  --link:#66b2ff;
  --border:rgba(255,255,255,.12);
  --shadow:0 12px 26px rgba(0,0,0,.35);
}

/* ===========================
   BASE
=========================== */
*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
  background:var(--bg);
}

body{
  font-family:"Noto Sans Bengali","Inter",Arial,sans-serif;
  color:var(--text);
  line-height:1.85;
  font-size:17px;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

a{
  color:var(--link);
  text-decoration:none;
}
a:hover{ text-decoration:underline; }

/* ===========================
   CONTAINER
=========================== */
.container{
  max-width:980px;
  margin:0 auto;
  padding:22px 16px 42px;
}

/* ===========================
   TOPBAR
=========================== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  position:sticky;
  top:10px;
  z-index:10;
  backdrop-filter: blur(8px);
}

.brand{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.brand h1{
  margin:0;
  font-size:20px;
  font-weight:700;
  letter-spacing:-0.2px;
}
.brand p{
  margin:0;
  color:var(--muted);
  font-size:13px;
  font-weight:500;
}

.btn{
  border:1px solid var(--border);
  background:transparent;
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
  transition:0.2s ease;
}
.btn:hover{ transform:translateY(-1px); }
.btn.primary{
  background:var(--link);
  color:#fff;
  border-color:transparent;
}

/* ===========================
   HERO (Home Only)
=========================== */
.hero{
  margin-top:18px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow:var(--shadow);
  display:flex;
  gap:14px;
  justify-content:space-between;
  align-items:flex-start;
}
.hero h1{
  margin:0 0 8px;
  font-size:26px;
  line-height:1.25;
}
.hero p{
  margin:0;
  color:var(--muted);
}
.hero-left{ flex:1; }
.hero-right{ width:320px; }

.chip-row{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.chip{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:13px;
  font-weight:600;
  background: rgba(127,127,127,0.08);
}

/* Search box */
.search-box{
  display:flex;
  gap:8px;
}
.search-box input{
  flex:1;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:transparent;
  color:var(--text);
  outline:none;
}
.search-box button{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--link);
  color:#fff;
  cursor:pointer;
  font-weight:700;
}
.hint{
  display:block;
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
}

/* ===========================
   FEATURED (Home Only)
=========================== */
.featured{
  margin-top:18px;
  display:grid;
  grid-template-columns: 1fr 1.2fr;
  gap:14px;
  background: var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  box-shadow: var(--shadow);
}
.featured-img img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.featured-body{ padding:16px; }

.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(11,95,255,0.12);
  border:1px solid rgba(11,95,255,0.25);
  color: var(--link);
  font-weight:700;
  font-size:12px;
  letter-spacing:0.5px;
}

.meta{
  color:var(--muted);
  font-size:13px;
  margin-top:10px;
}

/* ===========================
   SECTION HEADER
=========================== */
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  margin:18px 0 10px;
}
.section-head h2{ margin:0; }
.section-head small{ color:var(--muted); }

/* ===========================
   POST GRID (Home)
=========================== */
.post-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:14px;
}

/* Post card */
.post-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow:var(--shadow);
  display:flex;
  gap:14px;
  align-items:center;
  transition:0.2s ease;
}
.post-card:hover{ transform: translateY(-2px); }

.thumb{
  width:110px;
  min-width:110px;
  height:110px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid var(--border);
  background:rgba(127,127,127,0.08);
  display:block;
}
.thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
}

.post-body{
  flex:1;
  min-width:0;
}
.post-body h3{
  margin:0 0 6px;
  font-size:18px;
  line-height:1.35;
}
.post-body h3 a{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.post-body p{
  margin:0 0 10px;
  color:var(--muted);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.meta-bottom{
  font-size:13px;
  color:var(--muted);
}

/* ===========================
   POST PAGE LAYOUT (2 columns)
=========================== */
.page{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap:18px;
  margin-top:18px;
}
.main-content{ min-width:0; }

/* ===========================
   POST CONTENT BOX
=========================== */
.post{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:18px;
  box-shadow:var(--shadow);
}

.post h1{
  margin-top:0;
  font-size:28px;
  line-height:1.25;
}
.post h2{
  margin-top:22px;
  margin-bottom:10px;
  font-size:20px;
}
.post h3{
  margin-top:16px;
  margin-bottom:8px;
  font-size:17px;
}

.post p{
  margin:0 0 14px;
  font-size:1.02rem;
  line-height:1.95;
  color:var(--text);
}

.post ul, .post ol{
  margin:0 0 16px 18px;
}
.post li{ margin-bottom:8px; }

/* Blockquotes */
blockquote{
  margin:16px 0;
  padding:12px 14px;
  border-left:4px solid var(--link);
  background:rgba(127,127,127,0.10);
  border-radius:10px;
  color:var(--text);
}

/* Images inside post */
.post img{
  max-width:100%;
  height:auto;
  border-radius:14px;
  margin:12px 0;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

/* Tables */
table{
  width:100%;
  border-collapse:collapse;
  margin:18px 0;
  border-radius:12px;
  overflow:hidden;
  border:1px solid var(--border);
  background:var(--card);
  table-layout:fixed;
}
th, td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
  word-wrap:break-word;
  overflow-wrap:break-word;
}
th{
  background:rgba(127,127,127,0.10);
  font-weight:700;
  font-size:15px;
}
td{
  font-size:15px;
  line-height:1.7;
}
tr:last-child td{ border-bottom:none; }

/* Code blocks */
pre{
  padding:12px;
  border-radius:12px;
  background:rgba(127,127,127,.12);
  overflow:auto;
}

/* HR */
hr{
  border:none;
  height:1px;
  background:var(--border);
  margin:20px 0;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar{
  position:sticky;
  top:90px;
  height:fit-content;
}

.sidebar .widget{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow:var(--shadow);
  margin-bottom:14px;
}
.sidebar .widget h3{
  margin:0 0 10px;
  font-size:16px;
}
.sidebar .widget ul{
  list-style:none;
  padding:0;
  margin:0;
}
.sidebar .widget li{ margin-bottom:10px; }
.sidebar .widget a{
  font-weight:600;
  color:var(--link);
}
.sidebar small{
  color:var(--muted);
  display:block;
  margin-top:6px;
}
.sidebar input[type="text"]{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:transparent;
  color:var(--text);
  outline:none;
}

/* ===========================
   SAVING CHART (Visual Bars)
=========================== */
.saving-chart{
  margin:18px 0;
  padding:6px 0;
}
.saving-chart .bar-row{
  display:flex;
  align-items:center;
  gap:12px;
  margin:12px 0;
}
.saving-chart .label{
  min-width:70px;
  font-weight:700;
  color:var(--text);
}
.saving-chart .track{
  flex:1;
  height:14px;
  border-radius:999px;
  background:rgba(127,127,127,0.18);
  border:1px solid var(--border);
  overflow:hidden;
}
.saving-chart .fill{
  height:100%;
  display:block;
  background:var(--link);
  border-radius:999px;
}
.saving-chart .note{
  min-width:140px;
  font-size:13px;
  color:var(--muted);
}
.saving-chart .fill.p5{ width:15%; }
.saving-chart .fill.p10{ width:30%; }
.saving-chart .fill.p20{ width:60%; }
.saving-chart .fill.p30{ width:90%; }

/* Mobile: hide note */
@media(max-width:600px){
  .saving-chart .note{ display:none; }
  .saving-chart .label{ min-width:55px; }
}

/* ===========================
   FOOTER
=========================== */
.footer{
  margin-top:18px;
  text-align:center;
  color:var(--muted);
  font-size:13px;
}

/* ===========================
   MOBILE RESPONSIVE
=========================== */
@media(max-width: 900px){
  .featured{ grid-template-columns:1fr; }
  .hero{ flex-direction:column; }
  .hero-right{ width:100%; }
  .post-grid{ grid-template-columns:1fr; }
}

@media(max-width: 820px){
  .page{
    grid-template-columns:1fr;
  }
  .sidebar{
    position:static;
    top:auto;
  }
}

@media(max-width:700px){
  .post-card{
    flex-direction:column;
    align-items:stretch;
  }
  .thumb{
    width:100%;
    height:170px;
    min-width:100%;
  }
}
