/* ═══════════════════════════════════════════════════════════════
   Ashutosh Dev — ashutoshdev.com.np
   Quiet-academic theme: plain colours, one muted deep-blue accent,
   serif display type, 1px rules, light fade/slide transitions.
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --bg:      #fcfcfa;
  --surface: #ffffff;
  --tint:    #f4f4f1;
  --ink:     #1b1c1e;
  --muted:   #5c5f63;
  --faint:   #9a9c9f;
  --line:    #e4e4e0;
  --accent:       #24586e;
  --accent-dark:  #183f50;
  --accent-tint:  #eef3f5;
  --cat-climate:  #3c6e58;
  --cat-energy:   #8a6431;
  --cat-politics: #6e4356;
  --cat-creative: #4f5680;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
}

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  font-family: var(--sans);
  font-size: 1rem;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.18s var(--ease); }
a:hover { color: var(--accent-dark); }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }

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

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 120;
}

/* ── Reveal-on-scroll (light, respects reduced motion) ──
   Content is fully visible by default; the fade-up only applies when the
   <html class="js"> flag is set AND script.js is running, so a failed or
   cached script can never blank the page. */
html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
html.js .reveal.in { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.12s; }
.reveal-delay-2 { transition-delay: 0.22s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═══════════ NAV ═══════════ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 250, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.site-nav.scrolled { border-bottom-color: var(--line); }

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); }

.nav-menu { display: flex; align-items: center; gap: 1.75rem; }

.nav-menu a:not(.nav-contact) {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.2rem 0;
  border-bottom: 1.5px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.nav-menu a:not(.nav-contact):hover { color: var(--ink); }
.nav-menu a:not(.nav-contact).active { color: var(--ink); border-bottom-color: var(--accent); }

.nav-contact {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--surface) !important;
  background: var(--ink);
  padding: 0.45rem 1.1rem;
  border-radius: 4px;
  transition: background 0.18s var(--ease);
}
.nav-contact:hover { background: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: 0;
  padding: 0.5rem;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--ink);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

.nav-drawer {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  padding: 0.9rem 1.5rem;
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 760px) {
  .nav-menu { display: none; }
  .nav-toggle { display: flex; }
}

/* ═══════════ HERO ═══════════ */
.hero { padding: 5rem 0 4rem; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 4rem;
  align-items: center;
}

.kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero-text h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.15rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 1.5rem;
}

.hero-lede { color: var(--muted); max-width: 56ch; margin-bottom: 2rem; }
.hero-lede strong { color: var(--ink); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.65rem 1.4rem;
  border-radius: 4px;
  border: 1px solid var(--ink);
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
              transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--ink); color: var(--surface); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn-ghost { color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-portrait { justify-self: end; text-align: center; }
.hero-portrait img {
  width: min(320px, 100%);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px -18px rgba(27, 28, 30, 0.35);
}
.hero-portrait figcaption {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--faint);
}

.hero-facts {
  list-style: none;
  margin-top: 2.25rem;
  border-top: 1px solid var(--line);
  max-width: 58ch;
}
.hero-facts li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}
.hero-facts li span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.15rem;
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-portrait { justify-self: start; }
}

/* ═══════════ SECTIONS ═══════════ */
.band { padding: 5.5rem 0; }
.band-tint { background: var(--tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { max-width: 640px; margin-bottom: 3rem; }

.section-no {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.9rem;
}

.section-sub { color: var(--muted); font-size: 0.98rem; }

.loading-note { color: var(--faint); font-size: 0.92rem; padding: 1.5rem 0; }
.loading-note code { background: var(--tint); padding: 0.1em 0.4em; border-radius: 3px; }

/* ═══════════ CONSULTING (slidable gallery) ═══════════ */
.consult-card {
  flex: 0 0 340px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
@media (max-width: 480px) { .consult-card { flex-basis: 86vw; } }
.consult-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px -20px rgba(27, 28, 30, 0.3);
}

.consult-img { width: 100%; height: 190px; object-fit: cover; border-bottom: 1px solid var(--line); }
.consult-img-fallback {
  height: 190px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.consult-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.consult-meta { font-size: 0.8rem; color: var(--faint); }
.consult-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1.35; }
.consult-desc { font-size: 0.92rem; color: var(--muted); }

.consult-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.2rem; }
.mini-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.65rem;
}

.consult-link {
  margin-top: auto;
  padding-top: 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.consult-link.pending { color: var(--faint); }

.sample-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cat-energy);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0.05rem 0.4rem;
  vertical-align: middle;
}

/* ═══════════ SCROLLERS (publications + substack) ═══════════ */
.scroller {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.25rem 0.25rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.scroller::-webkit-scrollbar { height: 6px; }
.scroller::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.scroller-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.scroll-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.scroll-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.subscribe-link { margin-left: auto; font-size: 0.9rem; font-weight: 500; }

/* ═══════════ LIVE PROJECTS ═══════════ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px -20px rgba(27, 28, 30, 0.3);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.project-updated { font-size: 0.78rem; color: var(--faint); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--tint);
  color: var(--muted);
}
.status-badge .dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: currentColor;
}
.status-live { color: var(--cat-climate); border-color: currentColor; background: #f0f5f2; }
.status-live .dot { animation: pulse 1.8s ease-in-out infinite; }
.status-ongoing { color: var(--cat-energy); border-color: currentColor; background: #f7f2ea; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.project-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.35; }
.project-desc { font-size: 0.93rem; color: var(--muted); }
.project-link { margin-top: auto; padding-top: 0.6rem; font-size: 0.92rem; font-weight: 500; }

/* ═══════════ BIBBASE PUBLICATION LIST ═══════════ */
.bibbase-scroller {
  max-height: 560px;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem 1.75rem;
  font-size: 0.94rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.bibbase-scroller::-webkit-scrollbar { width: 8px; }
.bibbase-scroller::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* Gentle overrides so the BibBase widget inherits the site's look */
.bibbase-scroller, .bibbase-scroller td, .bibbase-scroller div {
  font-family: var(--sans) !important;
  color: var(--ink);
  line-height: 1.6;
}
.bibbase-scroller a { color: var(--accent); }
.bibbase-scroller a:hover { color: var(--accent-dark); }
.bibbase-scroller img { display: inline; }

/* ═══════════ WRITING ═══════════ */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.55rem 0.15rem;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* Featured piece */
.oped-feature {
  display: grid;
  grid-template-columns: minmax(0, 240px) 1fr;
  gap: 2rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1.75rem;
  margin-bottom: 2rem;
}
.oped-feature-img { border-radius: 4px; border: 1px solid var(--line); }
.oped-quote {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 0.7rem;
}
.oped-quote-src { font-size: 0.85rem; color: var(--faint); }

@media (max-width: 700px) {
  .oped-feature { grid-template-columns: 1fr; }
}

/* Article rows */
.article-list { display: flex; flex-direction: column; }

.article-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1.1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  border-radius: 4px;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.article-row:first-child { border-top: 1px solid var(--line); }
.article-row:hover { background: var(--surface); transform: translateX(4px); color: var(--ink); }

.article-thumb {
  width: 84px; height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.article-thumb-fallback {
  width: 84px; height: 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-info h3 { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.article-outlet { font-size: 0.82rem; color: var(--faint); margin-top: 0.15rem; }

.article-cat {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.22rem 0.75rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.cat-climate  { color: var(--cat-climate); }
.cat-energy   { color: var(--cat-energy); }
.cat-politics { color: var(--cat-politics); }
.cat-creative { color: var(--cat-creative); }

@media (max-width: 560px) {
  .article-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .article-thumb, .article-thumb-fallback { display: none; }
}

.archive-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}
.archive-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  background: var(--surface);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.archive-links a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ═══════════ SUBSTACK ═══════════ */
.sub-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.sub-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px -20px rgba(27, 28, 30, 0.3);
  color: var(--ink);
}

.sub-card-img { width: 100%; height: 160px; object-fit: cover; border-bottom: 1px solid var(--line); }
.sub-card-fallback {
  height: 160px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.sub-card-body { padding: 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; }
.sub-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.sub-card-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.sub-card-sub {
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════ TOPIC SUB-PAGES ═══════════ */
.topic-hero {
  padding: 4.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}
.breadcrumb { font-size: 0.85rem; color: var(--faint); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.topic-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 0.7rem;
}
.topic-hero p { color: var(--muted); max-width: 60ch; }

.topic-main { padding: 3rem 0 5rem; }

/* ═══════════ FOOTER ═══════════ */
.footer {
  background: var(--ink);
  color: #c9cbce;
  margin-top: 0;
}
.footer a { color: #c9cbce; }
.footer a:hover { color: #ffffff; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 3rem;
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.footer-about h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.8rem;
}
.footer-about p { font-size: 0.92rem; max-width: 38ch; margin-bottom: 1.2rem; }
.footer-mail { font-weight: 500; border-bottom: 1px solid rgba(255, 255, 255, 0.25); padding-bottom: 1px; }

.footer-col h4 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b8e93;
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.footer-col a { font-size: 0.92rem; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1.4rem;
  padding-bottom: 1.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  color: #8b8e93;
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* ═══════════ UTILITIES ═══════════ */
.to-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  box-shadow: 0 6px 18px -8px rgba(27, 28, 30, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 90;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
