/* ===== Theme ===== */
:root {
  --navy: #22313f;
  --navy-2: #2c3e50;
  --blue: #3a9ad9;
  --blue-dark: #2b82bd;
  --blue-soft: #eaf4fb;
  --coral: #f26b5b;
  --text: #33414e;
  --muted: #7a8794;
  --line: #e3e8ee;
  --bg: #ffffff;
  --bg-alt: #f7f9fb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(34, 49, 63, .10);
  --shadow-lg: 0 18px 45px rgba(34, 49, 63, .16);
  --card: #ffffff;
  --heading: #22313f;
  --ring: #ffffff;
  --nav-bg: rgba(214, 228, 238, .92);
  --nav-bg-scrolled: rgba(255, 255, 255, .96);
  --footer-bg: #2c3e50;
  color-scheme: light;
}

/* ===== Dark theme ===== */
:root[data-theme="dark"] {
  --bg: #111921;
  --bg-alt: #16202a;
  --card: #1d2934;
  --text: #c9d4de;
  --muted: #8f9dab;
  --heading: #eef3f7;
  --line: #2e3d4b;
  --blue-soft: #1a3346;
  --ring: #1d2934;
  --nav-bg: rgba(29, 41, 52, .9);
  --nav-bg-scrolled: rgba(22, 32, 42, .96);
  --footer-bg: #0b1218;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 45px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
body, .section, .navbar, .footer, .research-body, .course-body, .article-card, .stats div, .taken-list li, .pub-callout, .tabs, .contact-form input, .contact-form textarea { transition: background-color .3s, color .3s, border-color .3s; }

/* Theme toggle */
.nav-right { display: flex; align-items: center; gap: 14px; }
.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--heading); display: grid; place-items: center; cursor: pointer; transition: transform .3s, background .3s; }
.theme-toggle:hover { transform: rotate(20deg); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: block; } .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .b-facebook { background: #2a3c4c; color: var(--heading); }
:root[data-theme="dark"] .b-orcid { background: #2f3d22; color: var(--heading); }
:root[data-theme="dark"] .hero-photo { border-color: #fff; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { font-family: "Lato", system-ui, sans-serif; color: var(--text); background: var(--bg); line-height: 1.7; font-size: 16px; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.3; }
h2 { font-size: clamp(1.7rem, 3vw, 2.1rem); font-weight: 700; margin-bottom: .6rem; }
.container { width: min(1100px, 100% - 32px); margin-inline: auto; }
.section { padding: 80px 0; }
.section:nth-of-type(even) { background: var(--bg-alt); }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head > p { color: var(--muted); }
.meta { font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.sub-title { font-size: 1.25rem; margin: 10px 0 24px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; padding: 11px 24px; border-radius: 999px; font-weight: 700; font-size: .92rem; border: 0; cursor: pointer; box-shadow: 0 6px 18px rgba(58,154,217,.35); transition: transform .2s, background .2s; font-family: inherit; }
.btn:hover { background: var(--blue-dark); color: #fff; transform: translateY(-2px); }
.btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm { padding: 7px 18px; font-size: .82rem; }

/* ===== Navbar ===== */
.nav-wrap { position: fixed; top: 14px; left: 0; right: 0; z-index: 100; }
.navbar { width: min(1100px, 100% - 32px); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; background: var(--nav-bg); backdrop-filter: blur(10px); border-radius: 16px; padding: 12px 22px; box-shadow: var(--shadow); transition: background .3s; }
.nav-wrap.scrolled .navbar { background: var(--nav-bg-scrolled); }
.logo { font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 700; font-style: normal; color: var(--heading); font-size: 1.22rem; letter-spacing: .2px; }
.nav-links { list-style: none; display: flex; gap: 22px; }
.nav-links a { color: var(--heading); font-size: .9rem; font-weight: 400; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 0; background: var(--blue); transition: width .25s; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--heading); margin: 5px 0; transition: .3s; }

/* ===== Hero ===== */
.hero { position: relative; min-height: 640px; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; padding: 140px 16px 150px; background: linear-gradient(rgba(22,32,43,.72), rgba(22,32,43,.78)), url("../images/hero-bg.svg") center/cover no-repeat; }
.hero-inner { max-width: 720px; }
.hero-photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; object-position: center top; margin: 0 auto 22px; border: 5px solid var(--ring); box-shadow: 0 0 0 6px rgba(58,154,217,.55); }
.hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 700; }
.hero-role { color: #6ec0f2; font-size: 1.02rem; margin-bottom: 22px; }
.hero-intro { color: #dfe7ee; font-size: .98rem; margin-bottom: 0; }
.hero-wave { position: absolute; bottom: -1px; left: 0; width: 100%; height: 110px; fill: var(--bg); transition: fill .3s; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 56px; align-items: start; }
.about-photo { position: relative; }
.about-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: top; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.about-photo::before { content: ""; position: absolute; inset: 18px -18px -18px 18px; border: 2px solid var(--blue); border-radius: var(--radius); z-index: -1; }
.about-grid p { margin-bottom: 1rem; }
blockquote { border-left: 4px solid var(--blue); background: var(--blue-soft); padding: 16px 20px; border-radius: 0 10px 10px 0; margin: 20px 0 26px; font-size: .95rem; box-shadow: var(--shadow); }
.skills { display: grid; gap: 18px; }
.skills h4 { font-size: .95rem; margin-bottom: 8px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.skills .tags { margin-top: 0; }
.tags li { background: var(--card); border: 1px solid var(--line); color: var(--heading); padding: 4px 14px; border-radius: 999px; font-size: .82rem; }
.section-head .tags li { background: var(--blue-soft); border-color: transparent; color: var(--blue-dark); font-weight: 700; }

/* ===== Research ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 50px; }
.stats div { background: var(--card); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--blue); }
.stats strong { display: block; font-size: 2rem; color: var(--heading); font-weight: 900; line-height: 1.1; }
.stats span { font-size: .85rem; color: var(--muted); }
.research-card { position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: center; margin-bottom: 40px; }
.research-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); }
.research-body { background: var(--card); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow-lg); margin-left: -60px; position: relative; }
.research-body h3 { font-size: 1.12rem; margin-bottom: 4px; }
.research-body p { font-size: .93rem; }
.research-body .btn { margin-top: 14px; }
.pub-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 36px; margin-top: 20px; }
.pub-list h3 { margin-bottom: 18px; }
.pub-list ol { padding-left: 22px; display: grid; gap: 14px; }
.pub-list li { font-size: .92rem; padding-left: 6px; }
.pub-list li::marker { color: var(--blue); font-weight: 700; }
.pub-list a { word-break: break-all; }

/* ===== Education & Experience ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; }
.col-title { font-size: 1.2rem; margin-bottom: 22px; }
.timeline-item { position: relative; padding: 0 0 22px 22px; border-left: 2px solid var(--line); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 3px solid var(--blue); }
.timeline-item .when { color: var(--blue); font-weight: 700; font-size: .9rem; }
.timeline-item .when span { font-weight: 400; }
.timeline-item .what { color: var(--heading); font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.timeline-item p:not(.when):not(.what) { font-size: .9rem; color: var(--muted); }

/* ===== Trainings ===== */
.tabs { display: inline-flex; background: var(--card); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); margin-bottom: 34px; }
.tab { border: 0; background: none; padding: 9px 22px; border-radius: 999px; font-family: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); cursor: pointer; transition: .25s; }
.tab.active { background: var(--blue); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 34px 30px; }
.course-card { display: flex; flex-direction: column; }
.course-card img { width: 100%; aspect-ratio: 16/8; object-fit: cover; border-radius: var(--radius); }
.course-body { background: var(--card); margin: -50px 16px 0; padding: 22px 24px; border-radius: var(--radius); box-shadow: var(--shadow-lg); position: relative; flex: 1; }
.course-body h3 { font-size: 1.05rem; margin-bottom: 2px; }
.course-body p { font-size: .9rem; }
.taken-list { list-style: none; display: grid; gap: 14px; max-width: 820px; }
.taken-list li { display: flex; gap: 18px; align-items: center; background: var(--card); border-radius: 12px; padding: 16px 20px; box-shadow: var(--shadow); }
.taken-list .when { flex: 0 0 86px; text-align: center; font-size: .78rem; font-weight: 700; color: var(--blue-dark); background: var(--blue-soft); border-radius: 8px; padding: 6px 4px; }
.taken-list strong { color: var(--heading); }
.taken-list p { font-size: .85rem; color: var(--muted); }

/* ===== Articles ===== */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.article-card { display: block; background: var(--card); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); color: var(--text); border-top: 4px solid var(--coral); transition: transform .25s, box-shadow .25s; }
a.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); color: var(--text); }
.article-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.article-card p { font-size: .9rem; }
.article-card .link { display: inline-block; margin-top: 12px; color: var(--blue); font-weight: 700; font-size: .88rem; }
.article-card.empty { grid-column: 1 / -1; text-align: center; border-top-color: var(--blue); padding: 40px 26px; }

/* ===== Contact ===== */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 60px; align-items: center; }
.bubbles { position: relative; height: 410px; max-width: 380px; width: 100%; margin-inline: auto; }
.bubble { position: absolute; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; transition: transform .3s; }
.bubble:hover { transform: scale(1.06); }
.bubble svg { width: 30px; height: 30px; fill: currentColor; background: rgba(255,255,255,.9); border-radius: 50%; padding: 12px; box-sizing: content-box; }
.b-linkedin { width: 210px; height: 210px; left: 70px; top: 120px; background: var(--coral); color: var(--navy); z-index: 1; }
.b-linkedin svg { color: #0a66c2; }
.b-facebook { width: 150px; height: 150px; right: 10px; top: 0; background: #d6e1ea; color: var(--navy); border: 6px solid var(--ring); z-index: 2; box-shadow: var(--shadow); }
.b-facebook svg { color: #1877f2; }
.b-scholar { width: 130px; height: 130px; left: 0; top: 150px; background: var(--blue); color: var(--navy); border: 6px solid var(--ring); z-index: 2; box-shadow: var(--shadow); }
.b-scholar svg { color: #4285f4; }
.contact-grid > div > p { color: var(--muted); }
.contact-line { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.contact-line svg { width: 20px; height: 20px; fill: var(--blue); }
.contact-form { display: grid; gap: 14px; margin-top: 20px; }
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form input, .contact-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-family: inherit; font-size: .92rem; color: var(--text); background: var(--card); transition: border .2s, box-shadow .2s; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,154,217,.15); }
.contact-form textarea { resize: vertical; }
.contact-form .btn { justify-self: start; }

/* ===== Footer ===== */
.footer { background: var(--footer-bg); color: #c5d0da; padding: 60px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 1.1fr 1fr 1.4fr 1fr; gap: 30px; padding-bottom: 36px; border-bottom: 1px solid rgba(255,255,255,.15); }
.footer h4 { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.footer p { font-size: .88rem; }
.logo-box { display: inline-block; background: #fff; color: #2c3e50; padding: 12px 18px; border-radius: 4px; }
.quick-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.quick-links a { color: #c5d0da; font-size: .88rem; }
.quick-links a:hover { color: #fff; }
.quick-links .pill { background: var(--blue); color: #fff; padding: 3px 12px; border-radius: 6px; }
.socials { display: flex; gap: 10px; }
.socials a { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); transition: background .2s; }
.socials a:hover { background: var(--blue); }
.socials svg { width: 17px; height: 17px; fill: #fff; }
.copyright { text-align: center; font-size: .82rem; padding-top: 22px; color: #9fb0bf; }

/* ===== Reveal animation ===== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .nav-links { position: absolute; top: calc(100% + 8px); left: 0; right: 0; flex-direction: column; gap: 0; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; display: none; }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 10px 14px; }
  .nav-links a::after { display: none; }
  .navbar { position: relative; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .section { padding: 60px 0; }
  .about-grid, .two-col, .contact-grid, .card-grid, .article-grid { grid-template-columns: 1fr; }
  .about-grid { gap: 40px; }
  .about-photo { max-width: 320px; margin-inline: auto; }
  .research-card { grid-template-columns: 1fr; }
  .research-body { margin: -40px 14px 0; padding: 22px; }
  .pub-list { padding: 24px 20px; }
  .contact-form .row { grid-template-columns: 1fr; }
  .hero { min-height: 560px; padding: 120px 16px 130px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stats strong { font-size: 1.6rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .taken-list li { flex-direction: column; align-items: flex-start; gap: 8px; }
  .taken-list .when { flex: none; padding: 4px 10px; }
}

/* ===== Publications callout & ORCID ===== */
.pub-callout { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-left: 4px solid var(--blue); }
.pub-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-outline { background: var(--card); color: var(--blue); border: 2px solid var(--blue); box-shadow: none; }
.btn-outline:hover { background: var(--blue-soft); color: var(--blue-dark); }
.article-card { display: flex; flex-direction: column; }
.article-card > p:not(.meta) { color: var(--muted); font-size: .84rem; flex: 1; }
.b-linkedin svg { color: #0a66c2; }
.b-orcid { width: 112px; height: 112px; left: 215px; top: 292px; background: #e9f3d3; color: var(--navy); border: 6px solid var(--ring); z-index: 2; box-shadow: var(--shadow); }
.b-orcid svg { color: #a6ce39; width: 24px; height: 24px; padding: 10px; }
.b-scholar svg { color: var(--blue); }

/* ===== Opinion articles & Nepali text ===== */
[lang="ne"] { font-family: "Noto Sans Devanagari", "Lato", sans-serif; line-height: 1.6; }
.article-card.opinion { border-top-color: var(--blue); background: linear-gradient(180deg, var(--blue-soft), var(--card) 60%); }
.article-card.opinion h3 { font-size: 1.15rem; }


/* ===== Show more ===== */
.show-more-wrap { text-align: center; margin-top: 30px; }
.collapsible.is-collapsed > :nth-child(n+7) { display: none; }

/* ===== Mobile-first polish ===== */
.btn { min-height: 44px; }
.btn-sm { min-height: 38px; }
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .section { padding: 52px 0; }
  .section-head { margin-bottom: 28px; }
  h2 { font-size: 1.6rem; }
  /* hero */
  .hero { min-height: auto; padding: 110px 16px 110px; }
  .hero-photo { width: 124px; height: 124px; }
  .hero-role { font-size: .92rem; }
  .hero-intro { font-size: .93rem; }
  .hero-wave { height: 60px; }
  /* about */
  .about-photo { max-width: 250px; }
  .about-photo::before { inset: 12px -12px -12px 12px; }
  /* research & trainings: drop decorative images, keep compact cards */
  .research-card img, .course-card img { display: none; }
  .research-card { margin-bottom: 18px; }
  .research-body, .course-body { margin: 0; padding: 20px; border-left: 4px solid var(--blue); box-shadow: var(--shadow); }
  .card-grid { gap: 16px; }
  .stats { margin-bottom: 36px; }
  .stats div { padding: 16px 10px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; padding: 10px 8px; }
  /* articles */
  .article-grid { gap: 16px; }
  .article-card { padding: 20px; }
  .collapsible.is-collapsed > :nth-child(n+5) { display: none; }
  /* contact: bubbles become a tidy row of round buttons */
  .contact-grid { gap: 30px; }
  .bubbles { order: 2; height: auto; max-width: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; transform: none; margin: 0; }
  .bubble { position: static; width: auto !important; height: auto !important; aspect-ratio: 1; border: 0 !important; box-shadow: var(--shadow); font-size: .62rem; letter-spacing: .4px; gap: 4px; }
  .bubble svg { width: 20px; height: 20px; padding: 9px; }
  .contact-form input, .contact-form textarea { font-size: 16px; } /* stops iPhone zooming in */
  .contact-form .btn { justify-self: stretch; justify-content: center; }
  /* footer */
  .footer { padding-top: 44px; }
  .footer-grid { text-align: center; gap: 26px; }
  .quick-links, .socials { justify-content: center; }
  .socials a { width: 42px; height: 42px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .nav-links a { padding: 12px 14px; }
  .pub-callout { padding: 20px; }
  .pub-actions { width: 100%; flex-direction: column; }
  .pub-actions .btn { justify-content: center; white-space: nowrap; }
}
@media (max-width: 360px) {
  .logo { font-size: 1rem; }
  .bubble span { display: none; }
}

/* Dark mode: soften the pastel decorative images */
:root[data-theme="dark"] .research-card img, :root[data-theme="dark"] .course-card img { opacity: .22; }

/* ResearchGate bubble */
.b-rg { width: 100px; height: 100px; left: 30px; top: 300px; background: #d9f2ee; color: var(--navy); border: 6px solid var(--ring); z-index: 2; box-shadow: var(--shadow); font-size: .6rem; }
.b-rg svg { color: #00a294; width: 22px; height: 22px; padding: 9px; }
:root[data-theme="dark"] .b-rg { background: #1d3b38; color: var(--heading); }
@media (max-width: 760px) {
  .bubbles { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .bubble { font-size: .5rem; }
  .bubble svg { width: 18px; height: 18px; padding: 8px; }
}
@media (max-width: 430px) { .bubble span { display: none; } }

/* Google Scholar bubble */
.b-gs { width: 104px; height: 104px; left: 10px; top: 14px; background: #e3ecfb; color: var(--navy); border: 6px solid var(--ring); z-index: 2; box-shadow: var(--shadow); font-size: .62rem; }
.b-gs svg { color: #4285f4; width: 22px; height: 22px; padding: 9px; }
:root[data-theme="dark"] .b-gs { background: #22334d; color: var(--heading); }
@media (max-width: 760px) { .bubbles { grid-template-columns: repeat(6, 1fr); gap: 6px; } }
