/* =====================================================================
   Auto-fit for every screen (v1.2.2)
   320px phones → tablets → laptops → 1920px / 2K / 4K monitors.
   Loaded last on every page, so it adjusts all themes and the admin panel.
   ===================================================================== */

/* ---------- 1. Fluid page width ---------- */
:root {
  --gutter: clamp(12px, 3vw, 40px);
  --page-max: clamp(1180px, 90vw, 1880px);   /* 1180 on laptops, grows on big monitors */
}
.wrap { max-width: var(--page-max); padding-left: var(--gutter); padding-right: var(--gutter); }
html, body { max-width: 100%; }
/* stop sideways scrolling; "clip" keeps sticky headers working, "hidden" is the fallback for older phones */
body { overflow-x: hidden; }
@supports (overflow: clip) { body { overflow-x: clip; } }
img, video, iframe, svg { max-width: 100%; }
/* let grid columns and form rows shrink instead of overflowing (menus keep their natural width) */
.grid > *, .with-side > *, .hero > *, .np-front > *, .mag-top > *, .story-list .row > *, .row-form > *, .grid2 > *, .grid3 > * { min-width: 0; }
.cats a, .langs a, .admin-bar nav a, .pills a { flex: none; }
input, select, textarea, button { max-width: 100%; }

/* ---------- 2. Fluid text (grows a little on big screens, never tiny on phones) ---------- */
body { font-size: clamp(15px, 0.25vw + 13px, 19px); }
body.lang-hi { font-size: clamp(16px, 0.25vw + 14px, 20px); }
.brand { font-size: clamp(22px, 1vw + 18px, 38px); }
.section-title { font-size: clamp(19px, 0.5vw + 16px, 28px); }
.hero h2 { font-size: clamp(22px, 1.2vw + 16px, 44px); }
.card h3 { font-size: clamp(16px, 0.3vw + 14px, 22px); }
.card p, .story-list p { font-size: 0.94em; }
.meta { font-size: 0.82em; }
.story h1 { font-size: clamp(26px, 1.6vw + 18px, 56px); }
.story { max-width: min(46em, 100%); }
.story .body { font-size: 1.08em; }
.cats a { font-size: 0.94em; }
.kicker { font-size: 0.8em; }

/* ---------- 3. Grids use the extra width ---------- */
.grid { grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 17vw, 340px), 1fr)); gap: clamp(14px, 1.4vw, 30px); }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 13vw, 280px), 1fr)); }
.hero-img img { max-height: clamp(220px, 30vw, 620px); }
.hero h2 + p { font-size: 1.02em; }
.overlay.ov-main { min-height: clamp(300px, 30vw, 640px); }
.overlay { min-height: clamp(200px, 14vw, 320px); }
.with-side { grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 420px); gap: clamp(20px, 2vw, 44px); }
.story-list .row { grid-template-columns: clamp(110px, 16vw, 320px) 1fr; }
.np-hero .hero-img img { max-height: clamp(220px, 26vw, 560px); }
.story-banner { min-height: clamp(260px, 34vw, 720px); max-height: none; }
.banner-text { max-width: min(46em, 100%); }
@media (max-width: 900px) {
  .with-side { grid-template-columns: 1fr; }
}
@media (min-width: 1700px) {
  .grid.cards3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 2200px) {
  .grid.cards3 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .np-front { grid-template-columns: 2.4fr 1fr; }
}

/* ---------- 4. Header on small screens ---------- */
@media (max-width: 600px) {
  .top { gap: 8px 12px; }
  .top .date { order: 3; flex-basis: 100%; font-size: 13px; }
  .langs { margin-left: auto; }
  .langs a { padding: 4px 10px; }
  .cats .wrap { flex-wrap: nowrap; }
  .search input { width: 100%; }
  .hdr-centered .topline .search { flex: 1; }
  .ticker b { font-size: 12px; padding: 2px 8px; }
  .hero, .card, .overlay, .story-list .row { border-radius: min(var(--radius, 6px), 10px); }
}
/* very small phones (320–360px) */
@media (max-width: 360px) {
  .brand { font-size: 21px; }
  .hdr-centered .mast-center .brand { font-size: 32px; }
  .story-list .row { grid-template-columns: 96px 1fr; }
  .langs a { padding: 3px 8px; font-size: 13px; }
}

/* tablets: two-column cards, sidebar below */
@media (min-width: 601px) and (max-width: 1024px) {
  .hero { grid-template-columns: 1fr 1fr; }
}

/* ---------- 5. Admin panel ---------- */
.admin-main { max-width: min(1600px, 100%); padding-left: var(--gutter); padding-right: var(--gutter); }
.install { max-width: 760px; }
.row-form > * { flex: 1 1 160px; }
.row-form > .btn, .row-form > button, .row-form > label.check, .row-form > b { flex: 0 0 auto; }
code, pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.panel code { word-break: break-all; }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
@media (max-width: 600px) {
  .admin-bar { gap: 8px; padding: 10px 12px; }
  .admin-bar form { margin-left: 0; }
  table.list th, table.list td { padding: 6px 8px; font-size: 14px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .form.login { margin: 24px auto; padding: 20px; }
  .current-img { flex-wrap: wrap; }
  .current-img img { width: 100%; max-width: 260px; }
}
@media (max-width: 380px) {
  .theme-grid { grid-template-columns: 1fr; }
}
@media (min-width: 1800px) {
  body.admin { font-size: 16px; }
}

/* ---------- 6. Comfort ---------- */
@media (hover: none) {
  .cats a, .langs a, .pager a, .btn { min-height: 40px; display: inline-flex; align-items: center; }  /* finger-sized taps */
}
@supports (padding: max(0px)) {
  .wrap { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
}


/* =====================================================================
   7. Mobile ☰ menu (tablets & phones ≤ 900px) — pure CSS, works without JavaScript
   ===================================================================== */
.menu-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.menu-btn, .m-drawer, .m-backdrop { display: none; }

@media (max-width: 900px) {
  /* the ☰ button sits before the site name in every header style */
  .menu-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; cursor: pointer; padding: 8px 10px;
    margin-right: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
    font-size: 14px; font-weight: 700; line-height: 1; min-height: 40px; user-select: none; -webkit-tap-highlight-color: transparent; }
  .mb-icon { display: inline-grid; gap: 4px; width: 20px; }
  .mb-icon i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
  .menu-toggle:focus-visible ~ .masthead .menu-btn { outline: 3px solid var(--accent); outline-offset: 2px; }
  .hdr-darkbar .menu-btn, .theme-night .menu-btn { background: transparent; color: var(--head-ink, #fff); border-color: rgba(255,255,255,.25); }

  /* header becomes one tidy row: ☰  Site name  …  हिंदी | English */
  .masthead .top, .masthead .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .masthead .brand { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: clamp(20px, 5.6vw, 28px); }
  .masthead .langs { margin-left: auto; flex: none; }
  .masthead .date, .masthead .tagline { display: none; }
  .hdr-centered .mast-center { display: flex; align-items: center; text-align: left; padding-top: 10px; padding-bottom: 10px; }
  .hdr-centered .mast-center .brand { font-size: clamp(24px, 7vw, 36px); text-align: center; }
  .hdr-centered .topline { display: none; }

  /* the long category bar and inline search move into the menu */
  .masthead .cats, .masthead > .wrap > .search, .masthead .bar > .search, .hdr-minimal .search-row { display: none; }
  .hdr-centered .mast-center::after { content: ""; width: 58px; flex: none; }   /* keeps the centred name centred */
  .hdr-centered .mast-center .langs { display: none; }

  /* slide-in panel */
  .m-drawer { display: flex; flex-direction: column; position: fixed; z-index: 1000; top: 0; bottom: 0; left: 0;
    width: min(86vw, 360px); background: var(--card); color: var(--ink); box-shadow: 0 0 40px rgba(0,0,0,.35);
    transform: translateX(-105%); transition: transform .25s ease; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 0 0 max(16px, env(safe-area-inset-bottom)); visibility: hidden; }
  .m-backdrop { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,.45);
    opacity: 0; pointer-events: none; transition: opacity .25s; }
  .menu-toggle:checked ~ .m-drawer { transform: translateX(0); visibility: visible; }
  .menu-toggle:checked ~ .m-backdrop { opacity: 1; pointer-events: auto; }
  .menu-toggle:checked ~ .masthead .mb-icon i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .menu-toggle:checked ~ .masthead .mb-icon i:nth-child(2) { opacity: 0; }
  .menu-toggle:checked ~ .masthead .mb-icon i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .mb-icon i { transition: transform .2s, opacity .2s; }
  @media (max-width: 400px) { .mb-text { display: none; } .menu-btn { padding: 8px 9px; } }

  .md-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); border-bottom: 3px solid var(--accent); }
  .md-head b { font: 800 20px var(--title-font, var(--serif)); }
  .md-close { cursor: pointer; font-size: 22px; line-height: 1; padding: 8px 10px; border-radius: 8px; }
  .md-close:hover { background: var(--bg); }
  .m-drawer .search { display: block; margin: 14px 16px 6px; padding: 0; }
  .m-drawer .search input { width: 100%; font-size: 16px; padding: 10px 14px; }        /* 16px stops iPhone auto-zoom */
  .md-links { display: flex; flex-direction: column; padding: 6px 0; }
  .md-links a { display: block; padding: 13px 20px; text-decoration: none; font-weight: 600; font-size: 17px;
    border-left: 4px solid transparent; color: var(--ink); }
  .md-links a:hover, .md-links a.on { background: var(--bg); color: var(--accent); border-left-color: var(--accent); }
  .md-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line); }
  .md-foot .langs { display: inline-flex; margin: 0; }

  /* no page scrolling behind an open menu (browsers without :has just keep scrolling — harmless) */
  body:has(.menu-toggle:checked) { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .m-drawer, .m-backdrop, .mb-icon i { transition: none; } }

/* =====================================================================
   8. Admin panel ☰ menu on phones
   ===================================================================== */
.admin-menu-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.admin-menu-btn { display: none; }
@media (max-width: 899px) {
  .admin-bar { position: relative; flex-wrap: wrap; }
  .admin-menu-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; cursor: pointer; padding: 8px 12px;
    border: 1px solid rgba(127,127,127,.4); border-radius: 8px; font-weight: 700; min-height: 40px; }
  .admin-bar nav, .admin-bar form { display: none; width: 100%; }
  .admin-menu-toggle:checked ~ .admin-bar nav { display: flex; flex-direction: column; overflow: visible; gap: 2px; }
  .admin-menu-toggle:checked ~ .admin-bar form { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }
  .admin-bar nav a { padding: 11px 12px; border-radius: 8px; font-size: 16px; }
  .layout-side .admin-bar nav a, .layout-side .admin-bar .muted, .layout-side .admin-bar .brand { color: var(--side-ink, var(--ink)); }
  .layout-side .admin-bar nav a.on, .atheme-forest .admin-bar nav a.on { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
  .layout-top:not(.atheme-forest) .admin-bar nav a.on { background: var(--bg); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
}

/* ---------- v1.4 security pages ---------- */
.qr { margin: 10px 0; }
.qr svg { width: 220px; height: 220px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.otp-big { font-size: 24px; letter-spacing: 6px; text-align: center; max-width: 220px; font-family: ui-monospace, monospace; }
.otp-in { max-width: 140px; letter-spacing: 2px; }
pre.codes { font-size: 16px; letter-spacing: 1px; columns: 2; }
.steps2fa li { margin-bottom: 10px; }
.sec-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sec-checks li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.st-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.st-ok .st-icon { background: var(--ok); } .st-bad .st-icon { background: var(--err); }
.st-warn .st-icon { background: #d97706; } .st-info .st-icon { background: var(--info); }
.st-bad { border-color: var(--err) !important; }
.sec-checks .fix { font-size: 14px; margin-top: 2px; }
.score { font-size: 14px; padding: 2px 10px; border-radius: 999px; margin-left: 8px; color: #fff; vertical-align: middle; }
.score.good { background: var(--ok); } .score.bad { background: var(--err); }
.sec-alert form { margin: 6px 6px 0 0; }
tr.row-fail td { color: var(--err); }
.pw-confirm { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- v1.5: notifications bell, pages, contact form ---------- */
.push-bell { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 900;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink, #fff); font: 600 15px var(--font); box-shadow: 0 6px 22px rgba(0,0,0,.25); }
.push-bell[hidden] { display: none; }
.push-bell.on { padding: 10px 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.push-bell.on .pb-text { display: none; }
.push-bell:disabled { opacity: .6; }
@media (max-width: 600px) { .push-bell .pb-text { display: none; } .push-bell { padding: 12px; font-size: 18px; } }
.static-page h1 { margin-bottom: 18px; }
.contact-box { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.contact-form { display: grid; gap: 12px; max-width: 560px; }
.contact-form label { display: grid; gap: 4px; font-weight: 600; font-size: 15px; }
.contact-form input, .contact-form textarea { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.contact-form .btn { justify-self: start; }
.hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 13px; }

/* ---------- v1.5 admin: SEO box, inbox ---------- */
.seo-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--card); display: grid; gap: 10px; }
.seo-box summary { cursor: pointer; }
.serp { font-family: Arial, sans-serif; padding: 12px 14px; border-radius: 8px; background: #fff; color: #202124; border: 1px solid #dadce0; max-width: 620px; }
.serp-url { font-size: 13px; color: #4d5156; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-title { font-size: 20px; color: #1a0dab; line-height: 1.3; margin: 4px 0; }
.serp-desc { font-size: 14px; color: #4d5156; line-height: 1.5; }
.count { font-weight: 400; font-size: 12px; color: var(--muted); } .count.over { color: var(--err); font-weight: 700; }
.seo-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.seo-checks .ok { color: var(--ok); } .seo-checks .no { color: #b45309; }
.push-opt { padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.msg-body { white-space: normal; padding: 14px; background: var(--bg); border-radius: 8px; margin: 10px 0 16px; line-height: 1.6; }
.link-list { padding-left: 18px; line-height: 2; word-break: break-all; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.story figure img { height: auto; }
.story figure img:not([width]) { aspect-ratio: 16 / 9; object-fit: cover; }
.form > *, .seo-box > * { min-width: 0; }
.seo-box, .serp { max-width: 100%; }
.seo-box { display: block; width: 100%; overflow: hidden; }
.seo-box > * + * { margin-top: 10px; }
.seo-box .grid2 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }

/* =====================================================================
   v1.5.1 Admin menu that always fits
   ===================================================================== */
.admin-bar nav a, .nav-group .ng-title { white-space: nowrap; }
.nav-group .ng-title i { font-style: normal; font-size: .75em; margin-left: 4px; opacity: .7; }
.admin-bar .who { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* ---- Top-bar themes on computers: one tidy row, groups open as dropdowns ---- */
@media (min-width: 900px) {
  .layout-top .admin-bar { flex-wrap: nowrap; gap: 14px; }
  .layout-top .admin-bar .brand { white-space: nowrap; }
  .layout-top .admin-bar nav { flex-wrap: nowrap; align-items: center; gap: 2px; min-width: 0; }
  .layout-top .admin-bar form { flex: none; }
  .layout-top .nav-group { position: relative; }
  .layout-top .nav-group .ng-title { display: inline-block; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
  .layout-top .nav-group.has-on .ng-title, .layout-top .nav-group:hover .ng-title, .layout-top .nav-group:focus-within .ng-title { background: var(--bg); color: var(--accent); }
  .layout-top .nav-group .dd { display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 210px; flex-direction: column;
    padding: 6px; margin-top: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.16); }
  .layout-top .nav-group .dd::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }   /* hover bridge */
  .layout-top .nav-group:hover .dd, .layout-top .nav-group:focus-within .dd { display: flex; }
  body.layout-top .admin-bar .nav-group .dd a { color: var(--ink); padding: 8px 12px; border-radius: 6px; }
  body.layout-top .admin-bar .nav-group .dd a:hover, body.layout-top .admin-bar .nav-group .dd a.on { background: var(--bg); color: var(--accent); }
  .atheme-forest .nav-group.has-on .ng-title, .atheme-forest .nav-group:hover .ng-title, .atheme-forest .nav-group:focus-within .ng-title { background: rgba(255,255,255,.14); color: #fff; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .layout-top .admin-bar .who { display: none; }            /* make room on small laptops */
  .layout-top .admin-bar nav a, .layout-top .nav-group .ng-title { padding-left: 8px; padding-right: 8px; }
}

/* ---- Sidebar themes on computers: name on top, menu scrolls, account always at the bottom ---- */
@media (min-width: 900px) {
  .layout-side .admin-bar { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; flex-wrap: nowrap; height: 100vh; height: 100dvh;
    overflow: hidden; gap: 0; padding: 16px 12px 12px; }
  .layout-side .admin-bar .brand { padding: 0 8px 12px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .layout-side .admin-bar nav { display: block; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    margin: 0 -6px; padding: 0 6px 8px; }
  .layout-side .admin-bar nav > a, .layout-side .nav-group .dd a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 15px; }
  .layout-side .nav-group .ng-title { display: block; padding: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .8px;
    text-transform: uppercase; opacity: .55; color: var(--side-ink, var(--ink)); pointer-events: none; }
  .layout-side .nav-group .ng-title i { display: none; }
  .layout-side .nav-group .dd { display: block; }
  .layout-side .nav-group .dd a { color: var(--side-ink, var(--ink)); text-decoration: none; }
  .layout-side .nav-group .dd a.on, .layout-side .nav-group .dd a:hover { background: rgba(255,255,255,.1); color: #fff; }
  .layout-side .nav-group .dd a.on { box-shadow: inset 3px 0 0 var(--accent); }
  .layout-side .admin-bar form { margin: 0; padding: 10px 8px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 4px 10px; border-top: 1px solid rgba(255,255,255,.12); }
  .layout-side .admin-bar .who { max-width: 140px; }
}
/* short laptop screens: a little tighter */
@media (min-width: 900px) and (max-height: 700px) {
  .layout-side .admin-bar nav > a, .layout-side .nav-group .dd a { padding-top: 5px; padding-bottom: 5px; font-size: 14px; }
  .layout-side .nav-group .ng-title { padding-top: 10px; }
}

/* ---- Phones & tablets (☰ menu): everything in one list with small group headings ---- */
@media (max-width: 899px) {
  .admin-menu-toggle:checked ~ .admin-bar nav { display: block; max-height: calc(100dvh - 140px); overflow-y: auto; }
  .admin-bar nav > a, .nav-group .dd a { display: block; }
  .nav-group .ng-title { display: block; padding: 12px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; opacity: .6; }
  .nav-group .ng-title i { display: none; }
  .nav-group .dd { display: block; }
  .nav-group .dd a { padding: 10px 12px; border-radius: 8px; text-decoration: none; }
  .atheme-forest .nav-group .dd a { color: #e3efe6; }
}
