/* ==========================================================================
   Talha Mahamud — shared stylesheet
   One file for every page. Colors live in the tokens below.
   ========================================================================== */

:root {
  /* Original portfolio palette */
  --bg: #FCFCFC;
  --bg-elev: #ffffff;
  --ink: #0f0f0f;
  --ink-2: #3a3a3a;
  --muted: #706e68;
  --line: #d8d6cf;
  --line-2: #d8d6cf;
  --accent: #0f0f0f;
  --accent-soft: #f2f1f1;
  --glass: rgba(252, 252, 252, 0.82);
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 8px 28px -12px rgba(15, 15, 15, 0.12);
  --shadow-lg: 0 2px 4px rgba(15, 15, 15, 0.04), 0 24px 48px -20px rgba(15, 15, 15, 0.2);
  --code-bg: #e6e4dc;
  --grid-dot: rgba(15, 15, 15, 0.07);

  --serif: 'Instrument Serif', 'Noto Serif Bengali', Georgia, serif;
  --sans: 'Inter', 'Noto Serif Bengali', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --radius: 16px;
  --wrap: 1040px;
  --gutter: 28px;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}

::selection { background: #0f0f0f; color: #fafafa; }

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.wrap-narrow { max-width: 760px; }

main { flex: 1; }

/* Soft background glow + dot grid */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 75%);
}


/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 100;
  margin: 14px auto 0;
  width: calc(100% - 2 * 16px);
  max-width: calc(var(--wrap) - 2 * var(--gutter) + 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: var(--shadow);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 15px;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 20px;
  color: var(--ink);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

.logo:hover .logo-mark { transform: rotate(180deg); }

.logo-mark path { stroke: currentColor; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  position: relative;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  transition: color .2s, background-color .2s;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a.active {
  color: var(--ink);
  background: var(--bg-elev);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 0 0 1px var(--line);
}


/* ---------- Type helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: .6;
}

.grad { color: inherit; }

.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: .98;
}

.display em { font-style: italic; }

/* ---------- Page header (inner pages) ---------- */
.page-head {
  padding: 84px 0 40px;
}

.page-head h1 {
  font-size: clamp(52px, 9vw, 96px);
  margin: 18px 0 16px;
}

.page-head .lede {
  font-size: 18px;
  color: var(--muted);
  max-width: 560px;
}

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  color: var(--ink);
  transition: transform .2s, box-shadow .2s, border-color .2s, background-color .2s;
}

.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--muted); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn-primary:hover { box-shadow: var(--shadow-lg); border-color: var(--ink); }

.btn i { font-size: 13px; transition: transform .2s; }
.btn:hover .fa-arrow-right { transform: translateX(3px); }

/* ---------- HOME: hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 72px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  align-items: center;
  gap: 48px;
}

.hero h1 {
  font-size: clamp(64px, 11vw, 132px);
  margin: 22px 0 26px;
}

.hero-bio {
  font-size: 18.5px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 560px;
}

.hero-bio strong { color: var(--ink); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.hero-art {
  position: relative;
  aspect-ratio: 1;
  max-width: 400px;
  width: 100%;
  justify-self: end;
}

.hero-art svg { width: 100%; height: 100%; overflow: visible; }

.orbit-path {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1;
}

.inf-path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 2.4s cubic-bezier(.6, .1, .2, 1) .3s forwards;
}

.inf-ghost { fill: none; stroke: var(--line); stroke-width: 10; stroke-linecap: round; }

.particle { fill: var(--accent); }
.particle-2 { fill: var(--ink); }
.star { fill: var(--muted); opacity: .5; animation: twinkle 3.2s ease-in-out infinite; }
.star:nth-of-type(2n) { animation-delay: 1.1s; }
.star:nth-of-type(3n) { animation-delay: 2.1s; }

.hero-caption {
  position: absolute;
  bottom: -8%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .7; } }

/* Socials row */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.socials a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  text-decoration: none;
  font-size: 15px;
  transition: color .2s, border-color .2s, transform .2s;
}

.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.hero .socials { margin-top: 30px; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.4vw, 44px);
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.section-head h2 em { font-style: italic; color: var(--muted); }

.link-arrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color .2s;
}

.link-arrow i { font-size: 12px; transition: transform .2s; }
.link-arrow:hover { color: var(--accent); }
.link-arrow:hover i { transform: translateX(3px); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--muted);
}

.card-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 8px;
}

.card p { color: var(--ink-2); font-size: 15.5px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* Bento on home */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}

.bento .b-research { grid-column: span 4; }
.bento .b-stat { grid-column: span 2; }
.bento .b-reading { grid-column: span 3; }
.bento .b-writing { grid-column: span 3; }

.b-research {
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--bg-elev);
}

.b-research h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.1; letter-spacing: -0.01em; margin: 6px 0 12px; }

.b-stat { display: flex; flex-direction: column; justify-content: space-between; }

.stat-num {
  font-family: var(--serif);
  font-size: 76px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-cap { color: var(--muted); font-size: 15px; }

.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 0 rgba(15, 15, 15, .35);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 15, 15, .35); }
  70% { box-shadow: 0 0 0 8px rgba(15, 15, 15, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 15, 15, 0); }
}

.mini-list { list-style: none; display: flex; flex-direction: column; }

.mini-list li { border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }

.mini-list a, .mini-list .mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  text-decoration: none;
}

.mini-list .t { font-weight: 500; line-height: 1.4; }
.mini-list .m { font-size: 13px; color: var(--muted); margin-top: 2px; }
.mini-list .r { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.mini-list a:hover .t { color: var(--accent); }
.mini-list a i { color: var(--muted); font-size: 12px; transition: transform .2s, color .2s; }
.mini-list a:hover i { transform: translate(2px, -2px); color: var(--accent); }

/* Pills / tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  white-space: nowrap;
}

.pill-live { color: var(--ink); border-color: var(--ink); }
.pill-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }


/* Chips (filters) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  transition: all .2s;
}

.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { opacity: .55; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Search */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}

.search {
  position: relative;
  flex: 0 1 300px;
}

.search i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.search input {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  padding: 10px 16px 10px 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.empty {
  display: none;
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
}

/* ---------- BLOG list ---------- */
.post-list { list-style: none; border-top: 1px solid var(--line); }

.post-row { border-bottom: 1px solid var(--line); }

.post-row a {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 26px 8px;
  text-decoration: none;
  border-radius: 12px;
  transition: background-color .2s, padding .25s;
}

.post-row a:hover { background: var(--bg-elev); padding-left: 18px; padding-right: 18px; }

.post-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.post-title {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: color .2s;
}

.post-row a:hover .post-title { color: var(--accent); }

.post-side { display: flex; align-items: center; gap: 14px; }
.post-side i { color: var(--muted); font-size: 13px; transition: transform .25s, color .25s; }
.post-row a:hover .post-side i { transform: translate(3px, -3px); color: var(--accent); }

/* ---------- POST (article) ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 200;
  background: var(--ink);
}

.article-head { padding: 72px 0 36px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 30px;
  transition: color .2s;
}

.back:hover { color: var(--accent); }
.back i { font-size: 12px; transition: transform .2s; }
.back:hover i { transform: translateX(-3px); }

.article-head .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.article-head h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6.4vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 26px;
}

.meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 14px; }
.meta span { display: inline-flex; align-items: center; gap: 8px; }
.meta i { font-size: 12px; }

.article-rule { height: 1px; background: var(--line); margin-bottom: 44px; }

.prose { font-size: 18.5px; line-height: 1.8; color: var(--ink-2); }
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3 { color: var(--ink); letter-spacing: -0.015em; line-height: 1.2; }
.prose h2 { font-family: var(--serif); font-weight: 400; font-size: 1.9em; margin-top: 1.8em; }
.prose h3 { font-size: 1.2em; font-weight: 600; margin-top: 1.6em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }

.prose img { border-radius: 12px; margin-left: auto; margin-right: auto; }
.prose a img { display: inline; border-radius: 4px; vertical-align: middle; }

.prose blockquote {
  position: relative;
  padding: 22px 26px;
  border-radius: 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.15em;
  line-height: 1.55;
  color: var(--ink);
}

.prose blockquote p + p { margin-top: .6em; }
.prose blockquote a { font-family: var(--sans); font-size: .75em; }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); }

.prose code {
  font-family: var(--mono);
  font-size: .82em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  overflow-x: auto;
  line-height: 1.6;
}

.prose pre code { background: none; padding: 0; font-size: .8em; }
.prose pre code.hljs { background: none; padding: 0; }

.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }

.prose table { width: 100%; border-collapse: collapse; font-size: .9em; display: block; overflow-x: auto; }
.prose th { text-align: left; font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--ink); padding: 10px 12px; }
.prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }

.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

.article-foot {
  margin-top: 64px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.article-foot p { font-family: var(--serif); font-size: 24px; line-height: 1.2; }
.article-foot p em { color: var(--muted); }

/* Skeleton while loading */
.skeleton { display: flex; flex-direction: column; gap: 14px; }
.skeleton span {
  height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--line) 0%, var(--code-bg) 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton span:nth-child(3n) { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- PORTFOLIO ---------- */
.port-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 56px;
  align-items: start;
  padding-bottom: 40px;
}

.toc {
  position: sticky;
  top: 108px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--line);
}

.toc a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 0 7px 18px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  transition: color .2s, border-color .2s;
}

.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }

.port-section { padding: 8px 0 56px; }

.port-section > h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -0.015em;
  line-height: 1;
  margin-bottom: 26px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.port-section > h2 .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: .1em;
  transform: translateY(-14px);
}

/* Timeline */
.timeline { position: relative; display: flex; flex-direction: column; gap: 14px; }

.tl-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; }
.tl-item .tl-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.tl-item .tl-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-top: 4px; }
.tl-item .tl-sub { grid-column: 1 / -1; color: var(--muted); font-size: 15px; }
.tl-item ul { grid-column: 1 / -1; margin-top: 10px; padding-left: 1.1em; color: var(--ink-2); font-size: 15.5px; }
.tl-item ul li::marker { color: var(--accent); }
.tl-item p { grid-column: 1 / -1; margin-top: 10px; color: var(--ink-2); font-size: 15.5px; }
.tl-item p strong { color: var(--ink); font-weight: 600; }
.tl-item .links { grid-column: 1 / -1; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  transition: all .2s;
}

.links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.links a i { font-size: 12.5px; }

/* Skills */
.skill-groups { display: flex; flex-direction: column; gap: 22px; }

.skill-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.skill-group-head strong { color: var(--ink); font-weight: 600; }

.level { display: inline-flex; gap: 3px; }
.level i { width: 14px; height: 4px; border-radius: 2px; background: var(--line-2); }
.level.l3 i, .level.l2 i:nth-child(-n+2), .level.l1 i:first-child { background: var(--ink); }

.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.skill-tags span {
  font-size: 14.5px;
  font-weight: 500;
  padding: 8px 15px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: border-color .2s, transform .2s;
}

.skill-tags span:hover { border-color: var(--accent); transform: translateY(-2px); }

.research-lede { font-size: 17.5px; color: var(--ink-2); margin-bottom: 22px; max-width: 660px; }
.research-lede strong { color: var(--ink); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.card-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 12px; letter-spacing: .02em; }

.card-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 18px;
  font-size: 16px;
}

/* ---------- READING LIST ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}

.stats .card { padding: 20px 22px; }
.stats .stat-num { font-size: 48px; }
.stats .stat-cap { font-size: 13.5px; margin-top: 4px; }

.book-list { list-style: none; border-top: 1px solid var(--line); counter-reset: none; }

.book-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 8px;
  border-bottom: 1px solid var(--line);
  transition: background-color .2s;
  border-radius: 10px;
}

.book-row:hover { background: var(--bg-elev); }

.book-num { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.book-main { display: flex; flex-direction: column; min-width: 0; }
.book-title { font-family: var(--serif); font-size: 21px; line-height: 1.25; }
.book-author { font-size: 14px; color: var(--muted); }

.book-right { display: flex; align-items: center; gap: 14px; }
.book-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); min-width: 36px; text-align: right; }

.book-cat {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  white-space: nowrap;
}

.year-divider {
  list-style: none;
  font-family: var(--serif);
  font-size: 30px;
  padding: 34px 8px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.year-divider span { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 90;
}

.to-top.visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  padding: 44px 0 36px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.footer-cta {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.footer-cta a { text-decoration: none; }
.footer-cta a:hover .grad { color: inherit; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

.fade-up { opacity: 0; animation: fadeUp .8s cubic-bezier(.2, .8, .2, 1) forwards; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .18s; } .d3 { animation-delay: .28s; } .d4 { animation-delay: .38s; } .d5 { animation-delay: .48s; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .inf-path { stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .bento .b-research, .bento .b-stat, .bento .b-reading, .bento .b-writing { grid-column: span 6; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .port-layout { grid-template-columns: 1fr; gap: 0; }
  .toc {
    position: sticky;
    top: 78px;
    z-index: 50;
    flex-direction: row;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    margin: 0 calc(-1 * var(--gutter)) 32px;
    padding: 0 var(--gutter);
    scrollbar-width: none;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { padding: 12px 12px; margin: 0 0 -1px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .toc a.is-active { border-bottom-color: var(--accent); }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .site-header { top: 10px; margin-top: 10px; width: calc(100% - 20px); padding: 6px 6px 6px 12px; gap: 4px; }
  .logo-text { display: none; }
  .nav-links a { padding: 7px 10px; font-size: 13.5px; }
  .hero { padding: 64px 0 40px; }
  .hero-bio { font-size: 17px; }
  .page-head { padding: 56px 0 28px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .post-row a { grid-template-columns: 1fr; gap: 8px; padding: 22px 4px; }
  .post-row a:hover { padding-left: 12px; padding-right: 12px; }
  .post-title { font-size: 23px; }
  .post-side { order: -1; justify-content: space-between; }
  .post-side i { display: none; }
  .post-row .post-date { display: none; }
  .post-side .post-date-m { display: inline; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { flex: 1 1 auto; }
  .prose { font-size: 17px; }
  .article-head { padding: 48px 0 28px; }
  .tl-item { grid-template-columns: 1fr; }
  .tl-item .tl-date { padding-top: 0; }
  .book-row { grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 4px; }
  .book-right { grid-column: 2; gap: 10px; }
  .book-title { font-size: 19px; }
  .book-row .book-date { display: none; }
  .port-section > h2 { font-size: 34px; }
}

@media (max-width: 380px) {
  .nav-links a { padding: 7px 8px; font-size: 13px; }
}

.post-date-m { display: none; font-family: var(--mono); font-size: 12px; color: var(--muted); }
