/* ============================================================
   Md. Hafijur Rahman — shared site styles
   Design idea: the name reads as a peptide; bench work is green,
   computational work is blue; calm serif text on a soft paper.
   ============================================================ */

:root {
  --paper: #F3F5F4;
  --card: #FBFCFB;
  --ink: #18212B;
  --muted: #56616C;
  --rule: #D3DAD8;
  --link: #2546C9;
  --wet: #0E9F6E;
  --dry: #2563EB;
  --accent-pos: #C23D36;
  --accent-neg: #8E3A9C;
  --accent-spc: #B87A12;
  --shadow: rgba(24, 33, 43, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171D; --card: #161E25; --ink: #E6ECEF; --muted: #9AA6B0;
    --rule: #2A343D; --link: #8FA6FF; --wet: #2FB488; --dry: #6E97FF;
    --accent-pos: #D9564F; --accent-neg: #A955B6; --accent-spc: #CF931F;
    --shadow: rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --paper: #11171D; --card: #161E25; --ink: #E6ECEF; --muted: #9AA6B0;
  --rule: #2A343D; --link: #8FA6FF; --wet: #2FB488; --dry: #6E97FF;
  --accent-pos: #D9564F; --accent-neg: #A955B6; --accent-spc: #CF931F;
  --shadow: rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.1rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 40px; } }

/* ---------- Top navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar .inner {
  max-width: 1040px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
@media (min-width: 720px) { .topbar .inner { padding: 12px 40px; } }
.brand {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600; font-size: .95rem;
  text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.brand .mark {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--dry); color: #fff;
  display: grid; place-items: center; font-size: .8rem;
}
.topnav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.topnav a {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .82rem; text-decoration: none; color: var(--muted);
  padding: 6px 10px; border-radius: 6px;
}
.topnav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.topnav a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--dry) 14%, transparent); }
.brand { white-space: nowrap; }
@media (max-width: 760px) {
  .topbar .inner { flex-wrap: wrap; row-gap: 6px; padding-bottom: 6px; }
  .topnav {
    order: 3; width: 100%; margin-left: 0;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; margin-right: -16px; padding-right: 16px;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; padding: 6px 9px; }
  .topnav .theme-toggle { position: absolute; top: 9px; right: 16px; }
  .topbar .inner { position: relative; }
}
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px; margin-left: 4px;
  border: 1px solid var(--rule); background: transparent; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.theme-toggle svg { width: 16px; height: 16px; }

/* ---------- Page header ---------- */
.pagehead { padding: 48px 0 10px; }
.pagehead h1 {
  margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 700;
  letter-spacing: -.015em; line-height: 1.1;
}
.pagehead .lede { margin: 12px 0 0; max-width: 62ch; color: var(--muted); font-size: 1.15rem; }
.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .78rem; color: var(--muted); margin: 0 0 6px;
}

/* ---------- Generic section ---------- */
main { padding-bottom: 72px; }
.section { padding: 34px 0; border-top: 1px solid var(--rule); }
.section:first-of-type { border-top: none; }
.section h2 { margin: 0 0 14px; font-size: 1.4rem; font-weight: 600; }
.section h3 { margin: 0; font-size: 1.15rem; font-weight: 600; line-height: 1.35; }
.prose { max-width: 66ch; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.meta { color: var(--muted); font-size: .98rem; }
.tag { display: inline-block; width: .7em; height: .7em; border-radius: .15em; margin-right: .45em; vertical-align: .04em; }
.tag.wet { background: var(--wet); } .tag.dry { background: var(--dry); }

/* ---------- Cards & grids ---------- */
.cards { display: grid; gap: 16px; }
@media (min-width: 680px) { .cards.two { grid-template-columns: 1fr 1fr; } }
.card {
  border: 1px solid var(--rule); border-radius: 12px; padding: 20px 22px;
  background: var(--card); box-shadow: 0 1px 2px var(--shadow);
}
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .meta { margin-top: 2px; }
.card p { margin: 10px 0 0; }
.find { margin: 12px 0 0; padding-left: 14px; border-left: 3px solid var(--dry); font-size: 1rem; }
.find.wet { border-left-color: var(--wet); }
.lock { font-size: .92rem; color: var(--muted); margin-top: 10px; }
.chip {
  display: inline-block; font-family: "IBM Plex Mono", monospace; font-size: .72rem;
  padding: 3px 9px; border-radius: 999px; margin: 10px 6px 0 0;
  border: 1px solid var(--rule); color: var(--muted);
}

/* two-column split (bench / computer) */
.split { display: grid; gap: 20px; }
@media (min-width: 620px) { .split { grid-template-columns: 1fr 1fr; gap: 30px; } }
.split h3 { font-size: 1.05rem; margin-bottom: 8px; }
.split ul { margin: 0; padding-left: 1.1em; } .split li { margin-bottom: 5px; }

/* numbered process */
ol.steps { list-style: none; counter-reset: step; margin: 16px 0 0; padding: 0; display: grid; gap: 0; }
ol.steps li { counter-increment: step; position: relative; padding: 0 0 18px 46px; }
ol.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: var(--wet); color: #fff;
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: .95rem;
}
ol.steps li::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 2px; width: 2px; background: var(--rule); }
ol.steps li:last-child::after { display: none; }
ol.steps b { display: block; } ol.steps span { color: var(--muted); font-size: .96rem; }
@media (min-width: 820px) {
  ol.steps { grid-template-columns: repeat(3, 1fr); gap: 22px 26px; }
  ol.steps li { padding: 40px 0 0 0; }
  ol.steps li::after { left: 38px; right: -22px; top: 14px; bottom: auto; width: auto; height: 2px; }
  ol.steps li:nth-child(3n)::after { display: none; }
}

/* colour-coded technique cards */
.techgrid { display: grid; gap: 14px; }
@media (min-width: 560px) { .techgrid { grid-template-columns: 1fr 1fr; } }
.techcard { border: 1px solid var(--rule); border-left: 4px solid var(--c); border-radius: 10px; padding: 14px 16px; background: color-mix(in srgb, var(--c) 6%, transparent); }
.techcard h4 { margin: 0 0 8px; font-size: 1rem; font-weight: 600; color: var(--c); }
.techcard ul { margin: 0; padding-left: 1.05em; } .techcard li { font-size: .97rem; margin-bottom: 3px; }

/* dated lists (pubs, timeline) */
ol.dated, ul.dated { list-style: none; margin: 0; padding: 0; }
.dated li { display: grid; grid-template-columns: 6rem 1fr; gap: 16px; padding: 0 0 18px; }
@media (max-width: 520px) { .dated li { grid-template-columns: 4.6rem 1fr; gap: 12px; } }
.dated .yr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 1rem; padding-top: .1em; }
.dated .t { font-weight: 600; }
.dated p { margin: 4px 0 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: "IBM Plex Mono", monospace; font-size: .8rem;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule);
  color: var(--ink); background: var(--card); text-decoration: none;
}
.pill:hover { border-color: var(--link); color: var(--link); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "IBM Plex Mono", monospace; font-size: .85rem; font-weight: 500;
  padding: 10px 18px; border-radius: 8px; text-decoration: none;
  background: var(--dry); color: #fff; border: 1px solid transparent;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--link); color: var(--link); filter: none; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid var(--rule); padding: 30px 0 48px;
  color: var(--muted); font-size: .95rem;
}
footer.site .inner { max-width: 1040px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
@media (min-width: 720px) { footer.site .inner { padding: 0 40px; } }
footer.site a { color: var(--muted); }
footer.site .spacer { margin-left: auto; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- live sections (filled by live.js) ---------- */
.live-bar { height: 6px; border-radius: 3px; margin-top: 12px; background: color-mix(in srgb, var(--dry, #2563EB) 15%, transparent); overflow: hidden; }
.live-bar i { display: block; height: 100%; border-radius: 3px; background: var(--dry, #2563EB); }
.live-note { margin-top: 12px; font-size: .9rem; }
.live-repos:not(:empty) { margin: 16px 0 4px; }
.meta.small { font-size: .85rem; margin-top: 4px !important; }
