/* ============================================================================
   super — design system
   © 2023–2026 Mridun Gupta (मृदुन गुप्ता). All rights reserved.
   Author: Mridun Gupta · Last updated: 2026-10-27
   See LICENSE · NOTICE · /legal/provenance/ · MG:PROV:TVItU1VQRVItMjAyNg==
   Boxy hairline-grid system inspired by tailwindcss.com.
   ========================================================================== */

/* --------- fonts (self-hosted, OFL: Inter var + Tiro Devanagari Hindi) ---------- */
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter.var.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter.italic.var.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "Tiro Devanagari Hindi";
    src: url("../fonts/TiroDevanagariHindi.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

/* ---------- tokens ---------- */
:root {
    --bg: #ffffff;
    --bg-raised: #f8fafc;
    --bg-sunken: #f1f5f9;
    --ink: #0f172a;
    --ink-dim: #475569;
    --ink-faint: #94a3b8;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --accent: #0284c7;
    --accent-ink: #0369a1;
    --accent-soft: #e0f2fe;
    --brand: #7c5ce0;
    --brand-soft: #ede9fe;
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --grid-dot: rgba(15, 23, 42, 0.06);
    --sans: "Inter", "Tiro Devanagari Hindi", ui-sans-serif, system-ui,
        "Segoe UI", "Nirmala UI", sans-serif;
    --deva: "Tiro Devanagari Hindi", "Nirmala UI", "Mangal", var(--sans);
    --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, monospace;
    --max: 72rem;
    --pad: clamp(1rem, 3vw, 2rem);
    --s1: 0.25rem;
    --s2: 0.5rem;
    --s3: 0.75rem;
    --s4: 1rem;
    --s5: 1.5rem;
    --s6: 2rem;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b1120;
    --bg-raised: #101a2e;
    --bg-sunken: #0d1526;
    --ink: #e2e8f0;
    --ink-dim: #94a3b8;
    --ink-faint: #64748b;
    --line: #1e293b;
    --line-strong: #334155;
    --accent: #38bdf8;
    --accent-ink: #7dd3fc;
    --accent-soft: #082f49;
    --brand: #ad88f2;
    --brand-soft: #2e1065;
    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --grid-dot: rgba(226, 232, 240, 0.07);
    color-scheme: dark;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
* { margin: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
    background-size: 1.5rem 1.5rem;
}

::selection { background: var(--accent); color: #fff; }

img, video { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button { font: inherit; cursor: pointer; }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: 0.25rem; }
code, kbd, pre, .mono { font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- the "sheet" — one bordered page panel ---------- */
.sheet {
    width: min(var(--max), calc(100% - 2rem));
    margin: 1rem auto;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--bg), 0 0 40px rgba(2, 132, 199, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
}
[data-theme="dark"] .sheet { box-shadow: 0 0 0 1px var(--bg), 0 0 60px rgba(56, 189, 248, 0.06); }

/* ---------- header ---------- */
.site-head {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--line-strong);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem var(--pad);
    font-weight: 700;
    color: var(--ink);
    border-right: 1px solid var(--line);
}
.brand:hover { text-decoration: none; }
.brand .mark {
    width: 1.75rem; height: 1.75rem;
    display: block;
}
.brand .deva { font-family: var(--deva); }

.nav {
    display: flex;
    align-items: stretch;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--ink-dim);
    border-right: 1px solid var(--line);
    white-space: nowrap;
}
.nav a:hover { color: var(--ink); text-decoration: none; background: var(--bg-raised); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }

.controls { display: flex; margin-left: auto; }
.controls button {
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-dim);
    font-family: var(--mono);
    font-size: 0.8125rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.75rem;
}
.controls button:hover { background: var(--bg-raised); color: var(--ink); }

/* ---------- generic boxy blocks ---------- */
.section { border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem var(--pad);
    border-bottom: 1px solid var(--line);
    background: var(--bg-raised);
}
.section-head h2 { font-size: 0.9375rem; font-weight: 600; letter-spacing: 0; }
.section-head .kicker { color: var(--ink-faint); }

.kicker {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-faint);
    letter-spacing: 0;
}

.pad { padding: var(--pad); }

/* ---------- hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    border-bottom: 1px solid var(--line-strong);
}
.hero-main { padding: clamp(2rem, 6vw, 4rem) var(--pad); border-right: 1px solid var(--line); }
.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 1rem;
}
.hero h1 .deva { display: block; }
.hero p.lede { font-size: 1.125rem; color: var(--ink-dim); max-width: 34rem; }
.hero-side { display: grid; grid-template-rows: repeat(3, 1fr); }
.spec {
    padding: 1rem var(--pad);
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.spec:last-child { border-bottom: 0; }
.spec .kicker { margin-bottom: 0.125rem; }
.spec .val { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- grid of modules ---------- */
.modules { display: grid; grid-template-columns: repeat(3, 1fr); }
.module {
    padding: 1.25rem var(--pad);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    position: relative;
    min-height: 9rem;
    display: flex;
    flex-direction: column;
}
.module:nth-child(3n) { border-right: 0; }
.module:nth-last-child(-n+3) { border-bottom: 0; }
.module:hover { background: var(--bg-raised); text-decoration: none; }
.module .kicker { display: flex; justify-content: space-between; }
.module h3 { font-size: 1.125rem; font-weight: 700; margin: 0.5rem 0 0.25rem; }
.module p { font-size: 0.875rem; color: var(--ink-dim); flex: 1; }
.module .go { font-family: var(--mono); font-size: 0.75rem; color: var(--accent-ink); margin-top: 0.75rem; }

/* ---------- panels / cards ---------- */
.panel-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.panel {
    padding: 1.25rem var(--pad);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.panel:nth-child(2n) { border-right: 0; }
.panel h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.panel p, .panel li { font-size: 0.9375rem; color: var(--ink-dim); }

/* spec rows — dl rendered as bordered rows */
.spec-list { display: grid; }
.spec-row {
    display: grid;
    grid-template-columns: 12rem 1fr;
    border-bottom: 1px solid var(--line);
}
.spec-row:last-child { border-bottom: 0; }
.spec-row dt {
    padding: 0.625rem var(--pad);
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-faint);
    border-right: 1px solid var(--line);
    display: flex; align-items: center;
    white-space: nowrap;
}
.spec-row dd { padding: 0.625rem var(--pad); font-size: 0.9375rem; }

/* ---------- buttons / chips ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 0.5rem;
    border: 1.5px solid var(--ink);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.15rem;
    padding: 0.5rem 1rem;
    border-radius: 0;
}
.btn:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.brand { border-color: var(--brand); color: var(--brand); }
.btn.brand:hover { background: var(--brand); color: #fff; }
.btn.tiny { font-size: 0.7rem; padding: 0.2rem 0.55rem; border-width: 1px; }

.chip {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--line-strong);
    color: var(--ink-dim);
    border-radius: 0;
}
.chip.lang { border-color: var(--brand); color: var(--brand); }
.chip.accent { border-color: var(--accent); color: var(--accent-ink); }
.chip.ok { border-color: var(--ok); color: var(--ok); }

/* ---------- forms ---------- */
.field { display: grid; gap: 0.375rem; margin-bottom: 1rem; }
.field label { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-dim); }
.field input, .field textarea, .field select {
    font: inherit;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    padding: 0.625rem 0.75rem;
}
.field select { appearance: auto; cursor: pointer; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.field input[readonly] { background: var(--bg-2, var(--bg)); color: var(--ink-dim); }
.field .hint { font-size: 0.75rem; color: var(--ink-faint); }
form > .hint { font-size: 0.75rem; color: var(--ink-faint); margin-top: var(--s3); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; margin-top: var(--s3); }
.btn-row .btn { flex: 0 0 auto; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- article / prose ---------- */
.prose { padding: clamp(1.5rem, 4vw, 3rem) var(--pad); max-width: 46rem; }
.prose h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 0.75rem; }
.prose h2 { font-size: 1.375rem; margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; }
.prose p { color: var(--ink-dim); margin: 0.75rem 0; }
.prose ul { color: var(--ink-dim); }
.prose .meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-faint); }

/* thought / quote treatment */
.thought {
    border: 1px solid var(--line-strong);
    background: var(--bg-raised);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    margin: 1.5rem 0;
    position: relative;
}
.thought::before {
    content: "“";
    position: absolute;
    top: -0.5rem; left: 1rem;
    font-size: 4rem;
    line-height: 1;
    color: var(--brand);
    font-family: Georgia, serif;
}
.thought .body { font-size: 1.125rem; line-height: 1.8; color: var(--ink); }
.thought .body p { color: var(--ink); }
.thought .deva { font-family: var(--deva); }

/* ---------- blog index ---------- */
.post-row {
    display: grid;
    grid-template-columns: 3.5rem 5rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem var(--pad);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--bg-raised); text-decoration: none; }
.post-row .num { font-family: var(--mono); color: var(--ink-faint); font-size: 0.8125rem; }
.post-row .date { font-family: var(--mono); color: var(--ink-faint); font-size: 0.75rem; }
.post-row .title { font-weight: 600; }
.post-row .title .deva { font-family: var(--deva); }

/* ---------- links directory ---------- */
.link-row {
    display: grid;
    grid-template-columns: 8rem 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem var(--pad);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.link-row:hover { background: var(--bg-raised); text-decoration: none; }
.link-row .slug { font-family: var(--mono); font-size: 0.8125rem; color: var(--accent-ink); }
.link-row .dest { font-size: 0.8125rem; color: var(--ink-faint); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .title { font-weight: 600; }
.searchbar {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem var(--pad);
    border-bottom: 1px solid var(--line);
    background: var(--bg-raised);
}
.searchbar input {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.875rem;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    color: var(--ink);
    padding: 0.5rem 0.75rem;
    border-radius: 0;
}

/* ---------- redirect stage ---------- */
.stage {
    min-height: 55vh;
    display: grid;
    place-items: center;
    padding: var(--pad);
    text-align: center;
}
.stage .box { max-width: 32rem; width: 100%; }
.stage h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stage .dest {
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--accent-ink);
    border: 1px solid var(--line-strong);
    background: var(--bg-raised);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    word-break: break-all;
}

/* ---------- contact channel grid ---------- */
.channels { display: grid; grid-template-columns: repeat(3, 1fr); }
.channel {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 1.25rem var(--pad);
    color: var(--ink);
    display: flex; flex-direction: column; gap: 0.25rem;
    background: transparent; text-align: left; font: inherit; cursor: pointer;
}
.channel:nth-child(3n) { border-right: 0; }
.channel:hover { background: var(--bg-raised); text-decoration: none; }
.channel .kicker { color: var(--ink-faint); }
.channel .handle { font-family: var(--mono); font-size: 0.875rem; color: var(--accent-ink); }
.channel .name { font-weight: 700; font-size: 1.0625rem; }
.channel .c-ic { width: 1.4rem; height: 1.4rem; margin-bottom: 0.35rem; }

/* project rows + sort bar */
.sort-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem var(--pad); border-top: 1px solid var(--line); flex-wrap: wrap; }
.sort-bar .chip { cursor: pointer; background: none; font: inherit; color: var(--ink-dim); }
.sort-bar .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.proj-row { grid-template-columns: 3.5rem 6.5rem 1fr auto auto; }
.proj-acts { display: inline-flex; gap: 0.4rem; align-items: center; }
.proj-row .title { font-weight: 500; }
@media (max-width: 720px) { .proj-row { grid-template-columns: 2.2rem 1fr; grid-auto-rows: auto; } .proj-row .num { grid-row: span 3; } .proj-acts { grid-column: 2; } }

/* grouped channel — one container per mode, list of handles inside */
.channel.group { cursor: default; }
.channel.group:hover { border-color: var(--line-strong); }
.handle-list { margin-top: 0.5rem; border-top: 1px solid var(--line); }
.handle-list a, .handle-list button {
    display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
    width: 100%; padding: 0.5rem 0.25rem; border: 0; border-bottom: 1px solid var(--line);
    background: none; color: var(--accent-ink); font: inherit; text-align: left; cursor: pointer;
    font-size: 0.85rem; transition: padding-left 0.15s, color 0.15s;
}
.handle-list a:last-child, .handle-list button:last-child { border-bottom: 0; padding-bottom: 0; }
.handle-list a:hover, .handle-list button:hover { color: var(--accent); padding-left: 0.5rem; }
.handle-list .sub { color: var(--ink-faint); font-size: 0.72rem; font-family: var(--mono); white-space: nowrap; }

/* ---------- modal (contact email overlay, modern <dialog>) ---------- */
dialog.mg-modal {
    border: 1px solid var(--line-strong);
    background: var(--bg);
    color: var(--ink);
    padding: 0;
    max-width: 30rem;
    width: calc(100% - 2rem);
    border-radius: 0;
}
dialog.mg-modal::backdrop { background: rgba(2, 6, 23, 0.6); }
.mg-modal .modal-head {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
    font-weight: 700;
}
.mg-modal .modal-body { padding: 1rem; display: grid; gap: 0.75rem; }
.mg-modal .close-x { border: 0; background: none; font-family: var(--mono); color: var(--ink-dim); font-size: 1rem; }

/* ---------- footer ---------- */
.site-foot {
    border-top: 1px solid var(--line-strong);
    display: grid;
    grid-template-columns: 1fr auto;
    background: var(--bg-raised);
    margin-top: auto;
}
.site-foot .cell { padding: 0.75rem var(--pad); font-size: 0.8125rem; color: var(--ink-dim); }
.site-foot .cell + .cell { border-left: 1px solid var(--line); font-family: var(--mono); font-size: 0.75rem; display: flex; align-items: center; gap: 1rem; }
.site-foot a { color: var(--ink); font-weight: 600; }

/* ---------- 404 ---------- */
.e404 { font-family: var(--mono); font-size: clamp(4rem, 15vw, 10rem); font-weight: 700; color: var(--accent); line-height: 1; }

/* ---------- go-404 note ---------- */
.go-note {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--line-strong);
    background: var(--accent-soft);
    font-family: var(--mono); font-size: 0.8rem; color: var(--accent-ink);
}
.go-note button {
    background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
}

/* ---------- accessible tooltip (.tip) — hover + focus + tap ----------
   <button class="tip">text<span class="tip-bubble">explanation</span></button> */
.tip {
    background: none; border: 0; border-bottom: 1px dashed var(--ink-faint);
    font: inherit; color: inherit; padding: 0; cursor: help;
    position: relative; text-align: inherit;
}
.tip .tip-bubble {
    position: absolute; left: 0; bottom: calc(100% + 0.5rem); z-index: 40;
    width: max-content; max-width: 16rem;
    background: var(--ink); color: var(--bg);
    font-family: var(--mono); font-size: 0.75rem; line-height: 1.45;
    padding: 0.5rem 0.75rem; text-align: left; white-space: normal;
    border: 1px solid var(--line-strong);
    opacity: 0; visibility: hidden; transform: translateY(2px);
    transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
    pointer-events: none;
}
.tip:hover .tip-bubble, .tip:focus-visible .tip-bubble, .tip.on .tip-bubble {
    opacity: 1; visibility: visible; transform: none;
    transition-delay: 0s;
}

/* ---------- stacked toast cards (layered alerts) ---------- */
.toasts {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
    display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem;
    pointer-events: none; max-width: min(24rem, calc(100vw - 2rem));
}
.toast {
    pointer-events: auto;
    display: grid; grid-template-columns: 1.5rem 1fr auto; gap: 0.5rem;
    align-items: start;
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--line-strong); border-left-width: 4px;
    padding: 0.625rem 0.75rem; width: 100%;
    font-size: 0.85rem;
    box-shadow: 0 4px 0 -1px var(--bg), 0 4px 0 0 var(--line-strong),
                0 8px 0 -2px var(--bg), 0 8px 0 -1px var(--line); /* stacked-card edge */
    opacity: 0; transform: translateY(8px) scale(0.98);
    transition: opacity 0.2s, transform 0.2s;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateX(12px); }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--accent); }
.toast .t-ic {
    font-family: var(--mono); font-weight: 700; text-align: center;
    border: 1px solid var(--line-strong); line-height: 1.4; margin-top: 1px;
}
.toast.ok .t-ic { color: var(--ok); } .toast.err .t-ic { color: var(--danger); }
.toast.warn .t-ic { color: var(--warn); } .toast.info .t-ic { color: var(--accent); }
.toast .t-title { font-weight: 700; font-size: 0.85rem; line-height: 1.3; }
.toast .t-msg { color: var(--ink-dim); font-size: 0.8rem; margin-top: 0.125rem; }
.toast .t-x {
    border: 0; background: none; font: inherit; color: var(--ink-faint);
    font-size: 1.1rem; line-height: 1; padding: 0 0.25rem;
}
.toast .t-x:hover { color: var(--ink); }

/* ---------- a11y menu ---------- */
.a11y-wrap { position: fixed; left: 1rem; bottom: 1rem; z-index: 60; }
.a11y-fab {
    font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
    border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink);
    padding: 0.4rem 0.75rem; cursor: pointer;
}
.a11y-fab:hover, .a11y-fab[aria-expanded="true"] { background: var(--ink); color: var(--bg); }
.a11y-panel {
    position: absolute; left: 0; bottom: calc(100% + 0.5rem);
    display: flex; flex-direction: column; gap: 0;
    background: var(--bg); border: 1px solid var(--line-strong); min-width: 12rem;
}
.a11y-panel[hidden] { display: none; }
.a11y-opt {
    font-family: var(--mono); font-size: 0.78rem; text-align: left;
    border: 0; border-bottom: 1px solid var(--line); background: var(--bg);
    color: var(--ink); padding: 0.55rem 0.75rem;
}
.a11y-opt:last-child { border-bottom: 0; }
.a11y-opt:hover { background: var(--bg-raised); }
.a11y-opt[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }

/* ---------- admin gate ---------- */
.gate-card { max-width: 22rem; margin: var(--s4) auto; }
.gate-mark { width: 2.25rem; height: 2.25rem; display: block; margin: 0 auto 0.6rem; }
.gate-card form { margin-top: 0.6rem; }
.gate-card .gate-submit { width: 100%; margin-top: var(--s2); }

/* a11y state classes on <html> */
html.a11y-lg { font-size: 18px; }
html.a11y-sm { font-size: 14px; }
html.a11y-rm *, html.a11y-rm *::before, html.a11y-rm *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
}
html.a11y-hc {
    --line: var(--line-strong); --ink-dim: var(--ink); --ink-faint: var(--ink-dim);
}

/* ---------- brand icons ---------- */
.b-ic { display: inline-flex; align-items: center; gap: 0.5rem; }
.b-ic img, .b-ic svg { width: 1.15rem; height: 1.15rem; display: block; }
.btn .b-ic img, .btn .b-ic svg { width: 1em; height: 1em; } /* icon scales with btn font — uniform btn heights */
.b-ic.lg img { width: 2rem; height: 2rem; }
.channel .b-ic img { width: 1.35rem; height: 1.35rem; margin-bottom: 0.35rem; }
.icon-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.icon-row a { display: inline-flex; }
.icon-row > a > img { width: 1.5rem; height: 1.5rem; }
.logo-strip { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: 0.75rem var(--pad); }

/* community role cards — logo + context per program */
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.role-card { padding: 0.85rem var(--pad); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.3rem; }
.role-card:last-child { border-right: 0; }
.role-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.15rem; }
.role-brand img { height: 1.15rem; width: auto; }
.role-brand span { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.role-title { font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.role-title .chip { margin-left: 0.15rem; }
.role-meta { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.45; }
.role-meta .mini { height: 0.9rem; width: auto; vertical-align: -0.12em; }
@media (max-width: 720px) { .role-grid { grid-template-columns: 1fr; } .role-card { border-right: 0; border-bottom: 1px solid var(--line); } .role-card:last-child { border-bottom: 0; } }
.logo-strip img { height: 1.35rem; width: auto; opacity: 0.75; }
.logo-strip img:hover { opacity: 1; }
.logo-strip img.lite { padding: 0.3rem 0.7rem; }

/* fixed-color brand marks (redmi=pure black, poco=#000+#FFD400) get a light
   pill so they stay visible in dark mode — used wherever .lite is set */
img.lite { background: #fff; border: 1px solid var(--line); opacity: 0.95; }

/* ---------- masked brand icons ----------
   .bm renders the SVG file as a mask → icon inherits currentColor (theme-aware
   monochrome); on parent card/btn hover it switches to the brand colour via
   --bc. Per-brand classes set --ic (mask source), --bc, and aspect-ratio for
   wordmarks. */
.bm {
    display: inline-block; background: currentColor;
    -webkit-mask: var(--ic) center / contain no-repeat;
            mask: var(--ic) center / contain no-repeat;
    transition: background 0.18s ease;
    flex: 0 0 auto;
}
.ic-x         { --ic: url("/assets/img/brands/x.svg");         --bc: #000000; }
.ic-instagram { --ic: url("/assets/img/brands/instagram.svg"); --bc: #E4405F; }
.ic-linkedin  { --ic: url("/assets/img/brands/linkedin.svg");  --bc: #0A66C2; }
.ic-github    { --ic: url("/assets/img/brands/github.svg");    --bc: #181717; }
.ic-discord   { --ic: url("/assets/img/brands/discord.svg");   --bc: #5865F2; }
.ic-telegram  { --ic: url("/assets/img/brands/telegram.svg");  --bc: #26A5E4; }
.ic-snapchat  { --ic: url("/assets/img/brands/snapchat.svg");  --bc: #D4A900; }
.ic-whatsapp  { --ic: url("/assets/img/brands/whatsapp.svg");  --bc: #25D366; }
/* company logos as real images (.webp) — desaturated at rest, true brand
   colour on card hover; same mono→brand behaviour as the .bm masks */
.role-brand .co { height: 1.15rem; width: auto; filter: grayscale(1); transition: filter 0.18s ease; }
.role-brand .co.wm { height: 0.9rem; }
.role-brand .co.tile { height: 1rem; }
.role-card:hover .co, .role-brand:hover .co { filter: none; }
.ic-mail      { --ic: url("/assets/img/brands/mail.svg");      --bc: var(--accent); }
.ic-cal       { --ic: url("/assets/img/brands/cal.svg");       --bc: var(--accent); }
.ic-phone     { --ic: url("/assets/img/brands/phone.svg");     --bc: var(--ok); }
.ic-cv        { --ic: url("/assets/img/brands/cv.svg");        --bc: var(--accent-ink); }
[data-theme="dark"] .ic-x      { --bc: #ffffff; }
[data-theme="dark"] .ic-github { --bc: #e6edf3; }

/* hover → brand colour on the containing card/button/link */
.channel:hover .bm, .panel:hover > .bm, .panel:hover .b-ic .bm,
.role-card:hover .bm, .btn:hover .bm, .handle-list a:hover .bm,
.logo-strip a:hover .bm {
    background: var(--bc, currentColor);
}

/* .bm sizing in existing slots (replaces the old <img> rules) */
.b-ic .bm { width: 1.15rem; height: 1.15rem; }
.btn .b-ic .bm { width: 0.95rem; height: 0.95rem; }
.channel .bm.c-ic { width: 1.4rem; height: 1.4rem; margin-bottom: 0.35rem; }
.kicker .bm, .b-ic.kicker .bm { width: 1.1rem; height: 1.1rem; vertical-align: -0.15rem; }
/* icon-bearing contexts: flex-centre so Devanagari baseline/line-height
   differences can't shift icons relative to Latin runs */
.kicker { line-height: 1.4; }
.role-brand { line-height: 1.2; }
.role-meta .bm { vertical-align: -0.12rem; }
.role-brand .bm { height: 1.15rem; width: 1.15rem; }
.role-brand .bm.ic-redmi,
.role-brand .bm.mini { width: auto; height: 0.85rem; align-self: center; }
/* POCO is a two-tone tile (black on yellow) — rendered as a real image,
   always brand-coloured; masks can only do one tone. */
.role-brand .poco-mark { height: 1rem; width: auto; align-self: center; }
.role-meta .bm { height: 0.95rem; width: auto; vertical-align: -0.12em; }

/* ---------- QR pay box ---------- */
.qr-box {
    display: inline-block; border: 1px solid var(--line-strong);
    background: #fff; padding: 0.75rem; line-height: 0;
}
.qr-box canvas, .qr-box img { display: block; width: 180px; height: 180px; }
.upi-id { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }

/* ---------- per-article language toggle ---------- */
.lang-toggle {
    display: inline-flex; border: 1px solid var(--line-strong); overflow: hidden;
}
.lang-toggle a {
    font-family: var(--mono); font-size: 0.75rem; padding: 0.25rem 0.75rem;
    color: var(--ink-dim); border-right: 1px solid var(--line);
}
.lang-toggle a:last-child { border-right: 0; }
.lang-toggle a[aria-current="true"] { background: var(--ink); color: var(--bg); }
.lang-toggle a:hover { text-decoration: none; background: var(--bg-raised); }
.lang-toggle a[aria-current="true"]:hover { background: var(--ink); }

/* ---------- shayari polish ---------- */
.shayari-box { position: relative; }
.shayari-box .body.deva { line-height: 2.1; font-size: 1.15rem; }
.shayari-refresh {
    position: absolute; top: 0.75rem; right: 0.75rem;
    border: 1px solid var(--line-strong); background: var(--bg);
    font-family: var(--mono); font-size: 0.75rem; color: var(--ink-dim);
    padding: 0.25rem 0.6rem; cursor: pointer;
}
.shayari-refresh:hover { background: var(--ink); color: var(--bg); }

/* ---------- utility ---------- */
.center { text-align: center; }
.dim { color: var(--ink-dim); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.01em; }
.faint { color: var(--ink-faint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.upi-logo { display: block; height: 1.75rem; width: auto; margin: 0.2rem 0 0.55rem; }
.accent { color: var(--accent-ink); }
.brand-c { color: var(--brand); }
.blink { animation: mg-blink 1.2s infinite; }
@keyframes mg-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mr-2 { margin-right: var(--s2); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 56rem) {
    .hero { grid-template-columns: 1fr; }
    .hero-main { border-right: 0; border-bottom: 1px solid var(--line); }
    .hero-side { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); }
    .spec { border-bottom: 0; border-right: 1px solid var(--line); }
    .spec:last-child { border-right: 0; }
    .modules { grid-template-columns: repeat(2, 1fr); }
    .module:nth-child(3n) { border-right: 1px solid var(--line); }
    .module:nth-child(2n) { border-right: 0; }
    .module:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
    .module:nth-last-child(-n+2) { border-bottom: 0; }
    .panel-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
    .panel { border-right: 0; }
    .channels { grid-template-columns: repeat(2, 1fr); }
    .channel:nth-child(3n) { border-right: 1px solid var(--line); }
    .channel:nth-child(2n) { border-right: 0; }
}
@media (max-width: 36rem) {
    .modules { grid-template-columns: 1fr; }
    .module { border-right: 0 !important; }
    .module:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
    .module:last-child { border-bottom: 0; }
    .channels { grid-template-columns: 1fr; }
    .channel { border-right: 0 !important; }
    .post-row { grid-template-columns: 2.5rem 1fr auto; }
    .post-row .date { display: none; }
    .link-row { grid-template-columns: 1fr auto; }
    .link-row .dest { display: none; }
    .spec-row { grid-template-columns: 8rem 1fr; }
    .site-foot { grid-template-columns: 1fr; }
    .site-foot .cell + .cell { border-left: 0; border-top: 1px solid var(--line); }
    .toasts { right: 0.5rem; bottom: 0.5rem; left: 0.5rem; max-width: none; align-items: stretch; }
    .a11y-wrap { left: 0.5rem; bottom: 0.5rem; }
    .shayari-refresh { position: static; margin-top: 0.75rem; }
    .logo-strip { gap: 0.75rem; }
    .logo-strip img { height: 1.1rem; }
}

/* ---------- tasteful motion (reduced-motion aware via global guard) ---------- */
@keyframes mg-page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sheet { animation: mg-page-in 0.28s ease-out; }
.post-row, .panel, .channel, .role-card { transition: background 0.18s ease, border-color 0.18s ease; }
.btn { transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.channel { transition: border-color 0.18s ease, transform 0.18s ease; }
.channel:hover { transform: translateY(-2px); }
a { transition: color 0.15s ease; }
.chip { transition: background 0.15s ease, color 0.15s ease; }
.proj-acts .btn { transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease; }
.proj-acts .btn:hover { transform: translateY(-1px); }
.nav a { transition: color 0.15s ease; }

/* ---------- small utilities (moved off inline styles) ---------- */
.measure { max-width: 34rem; }
.right { float: right; }
.fs-sm { font-size: 0.8125rem; }
.qr-fallback { line-height: 1.4; font-size: 0.75rem; }
#shayari-display { white-space: pre-line; }
.val-line { display: block; }

/* ── dual-language long-form blocks (legal/docs) ─────────── */
html[lang="en"] .lang-hi { display: none; }
html[lang="hi"] .lang-en { display: none; }
.lang-hi { font-family: var(--deva); }

/* ── site banner (cloud site_config.banner) ─────────────────────────────── */
.site-banner {
    display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
    padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line);
    background: var(--ink); color: var(--bg);
    font-family: var(--mono); font-size: 0.78rem;
}
.site-banner a { color: var(--accent); }
.site-banner-x {
    margin-left: auto; background: none; border: 1px solid var(--bg-2, #444);
    color: inherit; font: inherit; padding: 0 0.5rem; cursor: pointer;
}

/* ── admin dash cards ───────────────────────────────────────────────────── */
.dash-num { display: block; font-size: 1.8rem; font-weight: 700; margin: var(--s2) 0; }
a.panel { display: block; text-decoration: none; }
a.panel:hover { border-color: var(--accent); }
.reg-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.reg-table th, .reg-table td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.reg-table td.url { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-form { display: grid; gap: var(--s3); }
.adm-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s3); }
.filter-tabs { display: flex; gap: var(--s2); flex-wrap: wrap; }
.filter-tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* ── blog post prev/next ────────────────────────────────────────────────── */
.post-nav { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s4, 2rem); padding-top: var(--s2); border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.8rem; }
.post-nav a { color: var(--ink); }
.post-nav a:hover { color: var(--accent); }
.post-nav span:last-child { margin-left: auto; text-align: right; }

/* ── admin misc ─────────────────────────────────────────────────────────── */
.kv-list { display: grid; }
.kv { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: var(--s3); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--faint); font-family: var(--mono); font-size: 0.78rem; word-break: break-all; }
.kv .v { word-break: break-word; }
.kv a.k { color: var(--ink); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.narrow { max-width: 34rem; }
.mb-2 { margin-bottom: var(--s2); }
#sess-clock { min-width: 3.2rem; text-align: center; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 0.15rem; } }

/* ── v16 motion pass ─────────────────────────────────────────────────────
   transform/opacity only · ≤0.25s standard · everything collapses under
   prefers-reduced-motion (global rule above). Never animate layout props.
   ------------------------------------------------------------------------ */

/* cards & rows — lift + border deepen on hover */
.panel, .post-row, .link-row, .role-card {
    transition: background 0.18s ease, border-color 0.18s ease,
                transform 0.18s ease;
}
.panel:hover, .post-row:hover, .role-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
}
.link-row:hover { transform: none; }   /* rows highlight, don't lift */

/* buttons — press down on click */
.btn { transition: background 0.15s ease, color 0.15s ease,
                   border-color 0.15s ease, transform 0.1s ease; }
.btn:active { transform: scale(0.98); }

/* links — underline slides in (no layout shift) */
.prose a, .post-nav a, .site-foot a, .site-banner a {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px; background-repeat: no-repeat;
    background-position: 0 100%;
    transition: color 0.15s ease, background-size 0.18s ease;
}
.prose a:hover, .post-nav a:hover, .site-foot a:hover, .site-banner a:hover {
    background-size: 100% 1px;
}

/* post-nav arrows nudge outward on hover */
.post-nav a { transition: color 0.15s ease, transform 0.15s ease; display: inline-block; }
.post-nav span:first-child a:hover { transform: translateX(-3px); }
.post-nav span:last-child  a:hover { transform: translateX(3px); }

/* banner — slide down when injected */
@keyframes mg-banner-in { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
.site-banner { animation: mg-banner-in 0.22s ease-out; }

/* toast — slide up on entry */
@keyframes mg-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { animation: mg-toast-in 0.2s ease-out; }

/* details/accordion — smooth open (grid-rows trick, no max-height hacks) */
details.acc > .acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; }
details.acc[open] > .acc-body { grid-template-rows: 1fr; }
details.acc > .acc-body > div { overflow: hidden; }
details.acc summary { transition: color 0.15s ease; }
details.acc summary:hover { color: var(--accent); }

/* theme crossfade — body surfaces only, never * */
body { transition: background-color 0.2s ease, color 0.2s ease; }
.panel, .channel, .post-row, .link-row, .field input, .field textarea, .field select {
    transition-property: background, background-color, border-color, color, transform;
}

/* focus ring fades in */
:focus-visible { transition: outline-color 0.15s ease; }

/* skeleton shimmer — loading rows (pairs with .dim placeholders) */
@keyframes mg-shimmer { from { background-position: -8rem 0; } to { background-position: 8rem 0; } }
.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-raised) 50%, var(--bg-sunken) 75%);
    background-size: 16rem 100%;
    animation: mg-shimmer 1.1s linear infinite;
    border: 1px solid var(--line); min-height: 2.5rem;
}
