/* BWA theme. Mobile first: base rules are for a 360px phone; wider screens are added at the end. */

:root {
    --bg: #121417; --surface: #1c1f24; --line: #3a3f47; --text: #eceef1; --muted: #a3a9b3;
    --accent: #f2676b; --red: #c4161c;
    --font-body: var(--gh-font-body, "Kalpurush", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --font-head: var(--gh-font-heading, "Kalpurush", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --wide: 1120px; --read: 720px; --gut: 16px;
    color-scheme: dark;
}
:root[data-theme="light"] {
    --bg: #f2f3f5; --surface: #ffffff; --line: #cfd3d9; --text: #15171a; --muted: #565c66;
    --accent: #b01218; --red: #b01218;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: var(--font-body); font-size: 16px; line-height: 1.65;
    min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Two-language interface text: both are in the page, one is shown. */
html:not(.lang-en) .t-en { display: none !important; }
html.lang-en .t-bn { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; padding: 12px 16px; background: var(--surface); z-index: 10; }
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gut); }
.wrap--read { max-width: calc(var(--read) + 2 * var(--gut)); }
.site-main { flex: 1; }

/* Control bar */
.bar__in { max-width: var(--wide); margin: 0 auto; min-height: 60px; padding: 0 6px 0 var(--gut); display: flex; align-items: center; gap: 10px; }
.lang { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--muted); }
.lang a { min-height: 48px; display: flex; align-items: center; }
html:not(.lang-en) .lang__bn, html.lang-en .lang__en { color: var(--text); font-weight: 700; }
.bar__search {
    flex: 1; min-width: 0; height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 22px; color: var(--muted); font-size: 15px;
}
.bar__mode { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.mode-moon, :root[data-theme="light"] .mode-sun { display: none; }
:root[data-theme="light"] .mode-moon { display: block; }
.mode-sun, .mode-moon { line-height: 0; }

/* Masthead */
.mast { max-width: var(--wide); margin: 0 auto; padding: 6px var(--gut) 12px; }
.mast__brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 62px; height: auto; flex: none; }
.mark--light, :root[data-theme="light"] .mark--dark { display: none; }
:root[data-theme="light"] .mark--light { display: block; }
.mast__names { display: flex; flex-direction: column; min-width: 0; }
.mast__name { font-family: var(--font-head); font-size: 19px; line-height: 1.35; font-weight: 700; }
.mast__sub { display: none; font-size: 13px; color: var(--muted); }
.mast--full { padding: 16px var(--gut) 0; }
.mast--full .mast__brand { gap: 14px; padding-bottom: 18px; }
.mast--full .mark { width: 92px; }
.mast--full .mast__name { font-size: 23px; }
.mast--full .mast__sub { display: block; }

.about { padding: 14px; background: var(--surface); border-radius: 16px; }
.about__label { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.nav { list-style: none; margin: 0; padding: 0; }
.about .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.about .nav a {
    min-height: 48px; padding: 4px 10px; display: flex; align-items: center; justify-content: center; text-align: center;
    border: 1px solid var(--line); border-radius: 12px; font-weight: 600;
}

/* Category tabs */
.tabs { border-bottom: 1px solid var(--line); margin-top: 14px; }
.mast:not(.mast--full) + .tabs { margin-top: 0; }
.tabs__in { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tab {
    min-height: 52px; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head); font-size: 17px; font-weight: 600; color: var(--muted);
    border-bottom: 3px solid transparent;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--red); }

/* Feed */
.page-title { font-size: 26px; line-height: 1.35; font-weight: 700; padding: 20px 0 0; }
.page-intro { color: var(--muted); margin: 8px 0 0; }
.feed { display: grid; gap: 12px; padding: 16px 0; }
.kicker { font-size: 14px; color: var(--muted); }
.kicker:empty { display: none; }
time { font-size: 14px; color: var(--muted); }

.lead { background: var(--surface); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; margin-bottom: 4px; }
.lead__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line); }
.lead__body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.lead__title { font-size: 21px; line-height: 1.45; font-weight: 700; overflow-wrap: anywhere; }
.lead__excerpt { margin: 0; font-size: 15px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.row { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row__title { font-size: 18px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
.row__img { flex: none; width: 92px; height: 92px; object-fit: cover; border-radius: 10px; background: var(--surface); }

.empty { color: var(--muted); padding: 32px 0; }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 0 32px; }
.pager__link {
    min-height: 52px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: 26px; font-weight: 600;
}
.pager__link.is-off { background: none; color: var(--muted); opacity: .6; }

/* Books */
.books { display: grid; gap: 12px; padding: 16px 0 32px; }
.book { display: flex; gap: 16px; padding: 14px; background: var(--surface); border-radius: 16px; }
.book__cover { flex: none; width: 96px; height: 136px; object-fit: cover; border-radius: 8px; background: var(--line); }
.book__text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.book__title { font-size: 19px; line-height: 1.45; font-weight: 700; overflow-wrap: anywhere; }
.book__meta { margin: 0; font-size: 14px; color: var(--muted); }

/* Article */
.article__head { padding-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.article__title { font-size: 27px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.pair {
    margin-top: 6px; min-height: 48px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
}
.article__image { margin: 18px auto 0; }
.article__image img { display: block; width: 100%; border-radius: 16px; background: var(--surface); }
figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center; }

.article__body { padding-top: 20px; font-size: 18px; line-height: 1.8; overflow-wrap: break-word; }
.gh-content > * { margin: 0 0 20px; }
.gh-content > *:last-child { margin-bottom: 0; }
.gh-content h1, .gh-content h2 { font-size: 23px; line-height: 1.4; margin-top: 34px; }
.gh-content h3 { font-size: 20px; line-height: 1.45; margin-top: 28px; }
.gh-content h4, .gh-content h5, .gh-content h6 { font-size: 18px; line-height: 1.5; margin-top: 24px; }
.gh-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 6px; }
.gh-content blockquote { margin-left: 0; margin-right: 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--red); color: var(--muted); }
.gh-content hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.gh-content img { border-radius: 12px; }
.gh-content figure { margin-left: 0; margin-right: 0; }
.gh-content iframe, .gh-content video { max-width: 100%; }
.gh-content pre { overflow-x: auto; padding: 14px; background: var(--surface); border-radius: 12px; font-size: 14px; line-height: 1.6; }
.gh-content code { font-size: .9em; }
.gh-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 16px; }
.gh-content th, .gh-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }

/* Ghost editor cards */
.kg-card { margin-left: 0; margin-right: 0; }
.kg-image { display: block; margin: 0 auto; }
.kg-width-wide, .kg-width-full { width: 100%; }
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.kg-gallery-row { display: flex; gap: 8px; }
.kg-gallery-image { flex: 1 1 0; min-width: 0; }
.kg-gallery-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kg-bookmark-card a.kg-bookmark-container { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text); text-decoration: none; }
.kg-bookmark-content { flex: 1; min-width: 0; padding: 14px; }
.kg-bookmark-title { font-weight: 600; }
.kg-bookmark-description { font-size: 14px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { font-size: 13px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.kg-bookmark-icon { width: 18px; height: 18px; }
.kg-bookmark-thumbnail { flex: none; width: 110px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.kg-callout-card { display: flex; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface); }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }

.share { margin-top: 28px; }
.share::before { content: ""; display: block; border-top: 1px solid var(--line); margin-bottom: 18px; }
.share__label, .more__label { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.share__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share__links a { min-height: 48px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; font-weight: 600; }

.more { padding-top: 30px; padding-bottom: 20px; }
.more .feed { padding-top: 0; }
.error { padding-top: 32px; padding-bottom: 48px; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 24px; font-size: 14px; color: var(--muted); }
.foot__in { max-width: var(--wide); margin: 0 auto; padding: 22px var(--gut) 32px; display: flex; flex-direction: column; gap: 8px; }
.foot__name { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--text); }
.foot__label { font-weight: 600; }
.foot .nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
.foot .nav a { min-height: 44px; display: flex; align-items: center; }

/* Search */
.search {
    width: 100%; max-width: 640px; height: 100%; max-height: 100%; margin: 0 auto; padding: 0; border: 0;
    background: var(--bg); color: var(--text);
}
.search::backdrop { background: rgba(0, 0, 0, .6); }
.search__bar { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px var(--gut); border-bottom: 1px solid var(--line); }
.search__field { flex: 1; min-width: 0; height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--accent); border-radius: 24px; }
.search__field input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font: inherit; font-size: 17px; color: inherit; }
.search__close { min-height: 48px; padding: 0 10px; font-weight: 600; }
.search__status { margin: 0; padding: 14px var(--gut) 6px; font-size: 14px; color: var(--muted); }
.search__status:empty { display: none; }
.search__list { list-style: none; margin: 0; padding: 0 var(--gut) 24px; }
.search__list li + li { border-top: 1px solid var(--line); }
.search__list a { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; }
.search__list b { font-family: var(--font-head); font-size: 17px; line-height: 1.45; font-weight: 600; }
.search__list span { font-size: 14px; color: var(--muted); }

/* Wider screens */
@media (min-width: 700px) {
    :root { --gut: 24px; }
    .bar { border-bottom: 1px solid var(--line); }
    .bar__in { min-height: 64px; padding: 0 var(--gut); justify-content: space-between; }
    .lang { flex: 1; }
    .bar__search { flex: 2; max-width: 440px; }
    .bar__mode { margin-left: auto; }
    .mast { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding: 14px var(--gut); }
    .mark { width: 74px; }
    .mast__name { font-size: 22px; }
    .mast--full { padding: 28px var(--gut) 24px; }
    .mast--full .mast__brand { padding-bottom: 0; gap: 18px; }
    .mast--full .mark { width: 124px; }
    .mast--full .mast__name { font-size: 32px; }
    .mast--full .mast__sub { font-size: 15px; }
    .about { padding: 0; background: none; }
    .about .nav { display: flex; flex-wrap: wrap; }
    .about .nav a { min-height: 44px; padding: 0 18px; }
    .tabs { margin-top: 0; }
    .tabs__in { display: flex; padding: 0 var(--gut); }
    .tab { min-height: 54px; padding: 0 36px; font-size: 18px; }
    .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; padding-top: 28px; }
    .feed .lead { grid-column: 1 / -1; }
    .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
    .pager { display: flex; justify-content: center; gap: 12px; padding-top: 20px; }
    .pager__link { padding: 0 40px; }
    .article__head { padding-top: 40px; }
    .article__title { font-size: 38px; line-height: 1.35; }
    .article__body { font-size: 19px; }
    .share__links { display: flex; }
    .share__links a { padding: 0 24px; min-height: 44px; }
    .search { height: auto; max-height: 80vh; margin-top: 8vh; border: 1px solid var(--line); border-radius: 16px; }
    .foot__in { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
    .foot__about { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; }
}
@media (min-width: 960px) {
    .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .feed--lead .lead { grid-column: 1 / 3; grid-row: 1 / span 4; margin-bottom: 0; align-self: start; }
    .feed--lead .lead__body { padding: 20px 24px 24px; gap: 10px; }
    .feed--lead .lead__title { font-size: 28px; line-height: 1.4; }
    .feed--lead .lead__excerpt { font-size: 17px; }
    .books { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
