/* Shared styles for blog.html and post.html. Same tokens as the homepage. */
:root {
  --bg: #fafbfd; --surface: #ffffff; --ink: #101828; --muted: #5b6577;
  --line: #e3e7ee; --accent: #2457f5; --accent-ink: #ffffff; --accent-soft: #e8eefe;
  --font-display: "Bricolage Grotesque", "Hind Siliguri", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Hind Siliguri", "Noto Sans Bengali", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --surface: #121826; --ink: #eef1f7; --muted: #98a2b5;
    --line: #232b3b; --accent: #6b93ff; --accent-ink: #0b0f17; --accent-soft: #17213d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --ink: #eef1f7; --muted: #98a2b5;
  --line: #232b3b; --accent: #6b93ff; --accent-ink: #0b0f17; --accent-soft: #17213d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.8;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.3; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
p { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }

/* header */
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; text-decoration: none; }
.brand span { color: var(--accent); }
#nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
#nav a { display: block; padding: 6px 12px; border-radius: 8px; text-decoration: none; font-size: 15px; font-weight: 500; color: var(--muted); line-height: 1.6; }
#nav a:hover, #nav a.on, #nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.actions { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: 10px; font: 600 15px var(--font-body); text-decoration: none; border: 1px solid transparent; cursor: pointer; background: var(--accent); color: var(--accent-ink); line-height: 1.5; }
.btn:hover { opacity: .92; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--accent-soft); }
#menuBtn { display: none; }
@media (max-width: 1000px) {
  #menuBtn { display: inline-grid; }
  .hide-sm { display: none; }
  #nav { position: absolute; left: 0; right: 0; top: 64px; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-left, 0px)) 16px; display: none; }
  #nav.open { display: block; }
  #nav ul { flex-direction: column; }
}

/* blog index */
.blog-head { padding-block: 64px 32px; }
.blog-head h1 { font-size: clamp(34px, 5.5vw, 56px); margin-top: 12px; }
.blog-head p { color: var(--muted); max-width: 52ch; margin-top: 12px; }
.tools { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding-block: 16px 28px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 14.5px var(--font-body); padding: 5px 14px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; line-height: 1.7; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.search { font: 400 16px var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; width: min(100%, 280px); }
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.list { display: grid; gap: 0; padding-bottom: 72px; }
.row { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 32px; align-items: start; padding-block: 28px; border-bottom: 1px solid var(--line); text-decoration: none; }
.row > * { min-width: 0; }
.row .date { font-family: var(--font-mono); font-size: 13px; color: var(--muted); padding-top: 6px; }
.row h2 { font-size: 24px; }
.row:hover h2 { color: var(--accent); }
.row p { color: var(--muted); font-size: 16px; margin-top: 8px; max-width: 62ch; }
.row .cat { font-size: 13px; padding: 2px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); align-self: start; margin-top: 4px; }
.empty { color: var(--muted); padding-block: 40px; }
@media (max-width: 700px) {
  .row { grid-template-columns: 1fr; gap: 6px; padding-block: 22px; }
  .row .date { padding-top: 0; }
  .row .cat { justify-self: start; order: -1; }
}

/* post */
.progress { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; height: 3px; width: 0; background: var(--accent); z-index: 30; }
article.post { max-width: 720px; margin: 0 auto; padding-block: 56px 40px; }
.crumb { font-size: 14.5px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
.post-head { margin-block: 20px 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.post-head h1 { font-size: clamp(30px, 5vw, 46px); margin-block: 14px 16px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14.5px; color: var(--muted); }
.post-meta .cat { color: var(--accent); font-weight: 600; }
.lead { font-size: 20px; color: var(--muted); margin-top: 6px; }
.prose { font-size: 18.5px; line-height: 1.95; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 28px; margin-top: 1.9em; }
.prose h3 { font-size: 22px; margin-top: 1.6em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); font-size: 20px; }
.prose figure { margin-inline: 0; }
.prose figure .ph { aspect-ratio: 16 / 9; max-width: 100%; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; }
.prose img { border-radius: 14px; display: block; }
.prose figcaption { font-size: 14.5px; color: var(--muted); margin-top: 8px; text-align: center; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; }
.prose pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; line-height: 1.6; }
.prose pre code { background: none; padding: 0; }
.post-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 48px; padding-block: 20px; border-block: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { font-size: 13.5px; padding: 1px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.pn a { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; min-width: 0; }
.pn a:hover { border-color: var(--accent); }
.pn small { display: block; font-size: 13px; color: var(--muted); }
.pn b { font-family: var(--font-display); font-size: 17px; line-height: 1.5; }
.pn a.next { text-align: right; }
@media (max-width: 560px) { .pn { grid-template-columns: 1fr; } .pn a.next { text-align: left; } .prose { font-size: 17.5px; } }

footer { border-top: 1px solid var(--line); padding-block: 32px 40px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; color: var(--muted); font-size: 14.5px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* social icons, share, comments, language chips */
.social { display: flex; flex-wrap: wrap; gap: 8px; }
.soc { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); display: inline-grid; place-items: center; color: var(--muted); text-decoration: none; background: transparent; }
.soc:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share .lbl { font-size: 14.5px; color: var(--muted); margin-right: 4px; }
.share a.chip { text-decoration: none; display: inline-block; }
#comments { margin-top: 40px; }
#comments h2 { font-size: 24px; margin-bottom: 16px; }
.chips.lang { margin-left: 0; }
footer .social { order: 2; }

/* feature images */
.feature { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); margin-bottom: 36px; background: var(--accent-soft); }
.row .fi { display: block; width: 100%; height: auto; max-width: 420px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; background: var(--accent-soft); }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post .thumb { overflow: hidden; }

/* hidden attribute must win over component display rules */
[hidden] { display: none !important; }
.post .thumb { position: relative; }
.post .thumb img { position: absolute; inset: 0; }

/* blog list: thumbnail beside the text on desktop, full width above it on phones */
.row > div:has(> .fi) { display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 24px; align-items: start; }
.row > div:has(> .fi) .fi { grid-row: 1 / span 2; max-width: none; margin-bottom: 0; }
.row > div:has(> .fi) h2, .row > div:has(> .fi) p { grid-column: 2; }
.row > div:has(> .fi) p { margin-top: 8px; }
@media (max-width: 700px) {
  .row > div:has(> .fi) { display: block; }
  .row > div:has(> .fi) .fi { margin-bottom: 14px; }
}
