/* =========================================================
   Debosmita Sarkar — research site
   Clean academic style · responsive · light/dark aware
   ========================================================= */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-faint: #6b6b6b;
  --accent: #1a4d7a;         /* deep astronomical blue */
  --accent-soft: #e8f0f7;
  --border: #e3e3df;
  --highlight: #fff7e6;
  --highlight-border: #f0d9a8;
  --max: 760px;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1b1f26;
    --ink: #e8e8e6;
    --ink-soft: #c2c2be;
    --ink-faint: #9a9a95;
    --accent: #6db3f2;
    --accent-soft: #1e2a38;
    --border: #2c313a;
    --highlight: #2a2416;
    --highlight-border: #574a29;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(6px);
}
.topnav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--sans);
}
.brand a {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
}
.brand-sub {
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.topnav .cta {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.topnav .cta:hover { opacity: 0.9; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding: 40px 24px 80px;
}

/* ---------- Table of contents ---------- */
.toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-family: var(--sans);
  font-size: 0.85rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.toc-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin: 0 0 8px;
  font-weight: 700;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 2px 0; }
.toc a {
  color: var(--ink-soft);
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
}
.toc a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* ---------- Main content ---------- */
main { min-width: 0; max-width: var(--max); }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 8px;
}

h1 {
  font-size: 2.1rem;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.h1-author {
  display: block;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 8px;
}
.alt-title {
  color: var(--ink-faint);
  font-size: 0.95rem;
  font-style: italic;
  margin: 0 0 24px;
}

h2 {
  font-size: 1.55rem;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
h3 {
  font-size: 1.2rem;
  margin: 28px 0 10px;
  color: var(--ink);
}

p { margin: 0 0 16px; }
a { color: var(--accent); }

/* ---------- Byline ---------- */
.byline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--sans);
}
.author-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.author-name { margin: 0; font-size: 1.1rem; }
.author-affil { margin: 2px 0; color: var(--ink-soft); font-size: 0.92rem; }
.author-contact { margin: 2px 0 0; font-size: 0.9rem; }

/* ---------- Action buttons ---------- */
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 8px;
  font-family: var(--sans);
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { opacity: 0.9; }

.license { font-size: 0.85rem; color: var(--ink-faint); font-family: var(--sans); }

/* ---------- Highlights list ---------- */
.highlights {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.highlights li {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 0.96rem;
}

/* ---------- Equations ---------- */
.equation {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
  text-align: center;
}

/* ---------- Theorem boxes ---------- */
.theorem-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 20px 0;
}
.theorem-box.highlight {
  background: var(--highlight);
  border-color: var(--highlight-border);
  border-left-color: #d99a00;
}
.theorem-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0 0 8px;
}
.theorem-box.highlight .theorem-label { color: #b37700; }
@media (prefers-color-scheme: dark) {
  .theorem-box.highlight .theorem-label { color: #e0b060; }
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  background: var(--surface);
}
.data-table caption {
  caption-side: bottom;
  font-size: 0.82rem;
  color: var(--ink-faint);
  padding-top: 8px;
  text-align: left;
  font-style: italic;
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.data-table thead th {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
}
.data-table tbody tr:nth-child(even) { background: rgba(128,128,128,0.04); }

/* ---------- Figures ---------- */
figure {
  margin: 24px 0;
  text-align: center;
}
figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}
figcaption {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 8px;
  font-style: italic;
}

/* ---------- Author section ---------- */
.author-section {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 24px 28px;
  margin-top: 48px;
}
.author-section h2 { border-bottom: none; margin-top: 0; }
.author-section .links { font-family: var(--sans); font-size: 0.9rem; }

/* ---------- FAQ ---------- */
#faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 10px 0;
  padding: 4px 18px;
}
#faq summary {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  padding: 12px 0;
  color: var(--ink);
}
#faq summary:hover { color: var(--accent); }
#faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
#faq details p { margin: 8px 0 12px; font-size: 0.96rem; }

/* ---------- References ---------- */
.refs { font-size: 0.9rem; color: var(--ink-soft); }
.refs li { margin: 6px 0; }
.cite-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-family: var(--sans);
  font-size: 0.88rem;
  margin-top: 20px;
}
.cite-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 18px 0 6px;
}
.bibtex {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}
.bibtex code {
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  color: var(--ink-soft);
  white-space: pre;
}

/* ---------- Glossary ---------- */
.glossary { margin: 16px 0 0; }
.glossary dt {
  font-weight: 700;
  margin-top: 16px;
  color: var(--ink);
}
.glossary dt dfn {
  font-style: normal;
  border-bottom: 2px solid var(--accent-soft);
}
.glossary dd {
  margin: 4px 0 0;
  padding-left: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 24px;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.site-footer p { margin: 6px 0; }
.site-footer .copyright { color: var(--ink-faint); font-size: 0.82rem; }

/* ---------- Multi-page nav ---------- */
.mainnav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--sans);
}
.mainnav .brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
}
.mainnav .navlinks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-left: auto;
}
.mainnav .navlinks a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.mainnav .navlinks a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.mainnav .navlinks a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Single-column page wrapper ---------- */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 24px 72px;
}
.crumbs {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin-bottom: 20px;
}
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.lede { font-size: 1.1rem; color: var(--ink-soft); margin-bottom: 24px; }
.readmore {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.95rem;
}

/* ---------- Homepage hero ---------- */
.hero { text-align: center; padding: 24px 0 12px; }
.hero-photo {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--border); margin-bottom: 12px;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 4px; }
.hero-role {
  font-family: var(--sans); color: var(--accent);
  font-weight: 600; font-size: 1.05rem; margin: 0 0 16px;
}
.hero-lede { font-size: 1.1rem; max-width: 620px; margin: 0 auto 20px; color: var(--ink-soft); }
.hero .actions { justify-content: center; }

/* ---------- Card grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; color: var(--accent); font-size: 1.05rem; }
.card p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }

/* ---------- Profile links ---------- */
.profile-links { list-style: none; padding: 0; font-family: var(--sans); font-size: 0.95rem; }
.profile-links li { margin: 8px 0; }

/* ---------- Pull quote / endorsement ---------- */
.pull-quote {
  margin: 0;
  padding: 20px 24px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
}
.pull-quote p { font-size: 1.08rem; font-style: italic; margin: 0 0 12px; }
.pull-quote footer { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); font-style: normal; }

/* ---------- Recommendation letter ---------- */
.letter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
}
.letter .signoff { margin-bottom: 0; }
.recommender .contact { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); line-height: 1.8; }
.letter-image { margin: 0 0 28px; text-align: center; }
.letter-image img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.letter-image figcaption {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 10px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 24px 20px 60px; }
  .toc { display: none; }
  h1 { font-size: 1.7rem; }
  body { font-size: 17px; }
}

@media (max-width: 480px) {
  .topnav { padding: 10px 16px; }
  .brand-sub { display: none; }
  .byline { flex-direction: column; text-align: center; }
  .actions { flex-direction: column; }
  .btn { text-align: center; }
}

/* ---------- Print ---------- */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --ink: #000; --ink-soft: #222;
    --ink-faint: #555; --accent: #1a4d7a; --border: #ccc;
    --accent-soft: #f2f2f2; --highlight: #f7f7f7;
  }
  .site-header, .toc, .actions, .topnav .cta, .skip-link { display: none; }
  .layout { grid-template-columns: 1fr; padding: 0; max-width: 100%; }
  body { font-size: 11pt; }
  main { max-width: 100%; }
  a { color: #000; text-decoration: underline; }
  /* Show link targets so a printed copy is self-contained */
  .actions a[href]::after, .byline a[href]::after { content: ""; }
  figure, .theorem-box, .data-table, .bibtex { break-inside: avoid; page-break-inside: avoid; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  figure img { border: none; }
  .site-footer { border-top: 1px solid #ccc; }
}
