/* ============================================================
   Arghya Ghosh — personal site
   Academic-minimal: typography-first, single reading column.
   ============================================================ */

:root {
  --bg:        #faf9f7;
  --bg-soft:   #f2f0ec;
  --text:      #1a1a1a;
  --text-soft: #55524d;
  --rule:      #e2ded7;
  --accent:    #7a2e2e;      /* oxblood, links only */
  --accent-soft:#a24545;
  --max:       42rem;        /* ~672px reading column */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #14130f;
    --bg-soft:   #1e1c18;
    --text:      #e8e4dc;
    --text-soft: #a49f95;
    --rule:      #322e28;
    --accent:    #d98c8c;
    --accent-soft:#e6a5a5;
  }
}

:root[data-theme="dark"] {
  --bg:        #14130f;
  --bg-soft:   #1e1c18;
  --text:      #e8e4dc;
  --text-soft: #a49f95;
  --rule:      #322e28;
  --accent:    #d98c8c;
  --accent-soft:#e6a5a5;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Newsreader", Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- layout ---------- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main section {
  padding: 3.25rem 0;
  border-top: 1px solid var(--rule);
}
main section:first-of-type { border-top: 0; }

/* ---------- nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-nav .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.site-nav .brand {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }

#theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--text-soft);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}
#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- typography ---------- */
h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.4rem;
}
h2 {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-soft);
  margin: 0 0 1.6rem;
}
h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
  letter-spacing: -0.01em;
}
p { margin: 0 0 1.1rem; }
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
a:hover { color: var(--accent-soft); border-bottom-color: var(--accent-soft); }

.lede { font-size: 1.28rem; line-height: 1.65; }
.muted { color: var(--text-soft); }
.meta {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-soft);
}

/* ---------- hero ---------- */
.hero { padding-top: 3.5rem; }
.hero-grid {
  display: flex;
  align-items: flex-start;
  gap: 2.75rem;
}
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero-photo {
  width: 200px;
  max-width: 34vw;
  height: auto;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid var(--rule);
}
@media (max-width: 640px) {
  .hero-grid { flex-direction: column-reverse; align-items: flex-start; }
  .hero-photo { width: 160px; max-width: 50vw; }
}
.hero .role {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 1.4rem;
}
.hero .links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1.6rem;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
}

/* ---------- timeline (experience) ---------- */
.entry {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 2.5rem;
}
.entry::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55rem;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.entry::after {
  content: "";
  position: absolute;
  left: 3px; top: 1.2rem; bottom: -2.5rem;
  width: 1px;
  background: var(--rule);
}
.entry:last-child::after { display: none; }
.entry .where { color: var(--text-soft); font-weight: 400; }
.entry .when { display: block; margin: 0.25rem 0 0.7rem; }
.entry ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.entry li { margin-bottom: 0.45rem; }

/* ---------- publications ---------- */
.pub { margin-bottom: 2rem; }
.pub .title { font-weight: 600; }
.pub .venue { color: var(--text-soft); font-style: italic; }
.pub .tags { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--text-soft);
}
a.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- skills ---------- */
.skill-group { margin-bottom: 1.3rem; }
.skill-group .label {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.2rem;
}

/* ---------- empty state (research) ---------- */
.empty {
  border: 1px dashed var(--rule);
  border-radius: 6px;
  padding: 2.5rem 1.75rem;
  text-align: center;
  color: var(--text-soft);
  background: var(--bg-soft);
}
.empty p:last-child { margin-bottom: 0; }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--rule);
  padding: 2.25rem 0 3rem;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-foot a { color: var(--text-soft); border: 0; }
.site-foot a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 34rem) {
  body { font-size: 1.06rem; }
  h1 { font-size: 1.95rem; }
  .lede { font-size: 1.15rem; }
  .site-nav .wrap { flex-direction: column; gap: 0.5rem; }
}

/* ---------- research article ---------- */
.paper { margin-bottom: 2.5rem; }
.paper + .paper {
  border-top: 1px solid var(--rule);
  padding-top: 2.75rem;
  margin-top: 2.75rem;
}
.paper-head { margin-bottom: 1.75rem; }
.paper-head h3 { font-size: 1.55rem; line-height: 1.25; margin-bottom: 0.7rem; }
.status {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 0.7rem;
}
.affil { color: var(--text-soft); font-size: 1rem; line-height: 1.55; margin: 0; }
.affil strong { color: var(--text); font-weight: 600; }

h4 {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 2.25rem 0 0.7rem;
}

/* math blocks scroll rather than overflow the column */
.eq {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
  margin: 0 0 1.15rem;
  font-size: 0.98rem;
}
.katex-display { margin: 0; }

.callout {
  border-left: 2px solid var(--accent);
  padding: 0.15rem 0 0.15rem 1.1rem;
  margin: 0 0 1.3rem;
  color: var(--text-soft);
  font-style: italic;
}

/* fallback while KaTeX loads / if it fails */
.tex { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 0.9em; }

/* figures */
figure { margin: 1.75rem 0; }
figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
figcaption {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: 0.55rem;
  line-height: 1.5;
}

/* figure whose image has a baked-in white background (e.g. a matplotlib
   export) — give it a permanent light card so it reads the same in dark mode */
figure.plot-card img {
  background: #fff;
  padding: 0.75rem;
  border: 1px solid var(--rule);
}

/* a plain stepped list for describing a pipeline */
.steps {
  margin: 0 0 1.2rem;
  padding-left: 1.15rem;
}
.steps li { margin-bottom: 0.4rem; }
.steps code {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.85em;
  background: var(--bg-soft);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

/* compact results table */
.rtable-wrap { overflow-x: auto; margin: 0 0 1.2rem; }
.rtable {
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 22rem;
}
.rtable th, .rtable td {
  text-align: right;
  padding: 0.4rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.rtable th:first-child, .rtable td:first-child { text-align: left; }
.rtable thead th {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  border-bottom-color: var(--text-soft);
}
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable .win { color: var(--accent); font-weight: 600; }

/* bibliographic citation, hanging indent */
.cite {
  font-size: 0.92rem;
  color: var(--text-soft);
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  margin: 1.6rem 0 1rem;
}
.cite a { border-bottom-color: transparent; }
.cite a:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }

/* ---------- reduced motion / print ---------- */
@media print {
  .site-nav, .site-foot, #theme-toggle { display: none; }
  body { color: #000; background: #fff; }
}
