/* Pallab Ghosh academic site. Custom theme, no framework. */

@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/source-serif-4-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2"); }

:root {
  --bg: #fbfaf7;
  --bg-elev: #ffffff;
  --bg-soft: #f2efe8;
  --text: #1f1d1a;
  --text-muted: #5d5851;
  --line: #e2ddd3;
  --line-strong: #8a8275;
  --accent: #7a1f1f;         /* OU crimson, muted */
  --accent-strong: #5e1414;
  --accent-soft: #f6e9e9;
  --link: #7a1f1f;
  --chip: #eee9df;
  --chip-text: #3f3a33;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 10px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 980px;
}

[data-theme="dark"] {
  --bg: #15161a;
  --bg-elev: #1d1f25;
  --bg-soft: #23262e;
  --text: #ebe8e1;
  --text-muted: #a9a49b;
  --line: #2f333c;
  --line-strong: #707784;
  --accent: #e3a3a3;
  --accent-strong: #f2c1c1;
  --accent-soft: #3a2526;
  --link: #e3a3a3;
  --chip: #2b2e36;
  --chip-text: #d5d1c9;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
[id] { scroll-margin-top: calc(64px + 1rem); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.5rem; margin-top: 2.2rem; }
h3 { font-size: 1.15rem; margin-top: 1.6rem; }
p { margin: 0 0 1em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
main.container { padding-top: 2rem; padding-bottom: 3rem; min-height: 60vh; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; }
.muted { color: var(--text-muted); }
.small { font-size: .9rem; }
.lede { font-size: 1.1rem; color: var(--text-muted); max-width: 60ch; }

/* Header and nav */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg-elev); position: sticky; top: 0; z-index: 50; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand { display: flex; flex-direction: column; line-height: 1.15; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.brand-sub { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.site-nav ul { list-style: none; display: flex; gap: .15rem; margin: 0; padding: 0; align-items: center; }
.site-nav a { display: inline-block; padding: .45rem .7rem; border-radius: 6px; color: var(--text); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-controls { display: flex; align-items: center; gap: .5rem; order: 3; }
.theme-toggle { background: transparent; border: 1px solid var(--line-strong); color: var(--text); border-radius: 999px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.theme-toggle:hover { background: var(--bg-soft); }
.theme-toggle svg { display: none; }
[data-theme-mode="auto"] .icon-auto { display: inline; }
[data-theme-mode="light"] .icon-sun { display: inline; }
[data-theme-mode="dark"] .icon-moon { display: inline; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong); border-radius: 6px; width: 40px; height: 36px; padding: 6px; cursor: pointer; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

.site-nav { order: 2; }
@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--bg-elev); border-bottom: 1px solid var(--line); padding: .5rem 1.25rem 1rem; box-shadow: var(--shadow); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .site-nav a { display: block; padding: .6rem .7rem; }
}
@media (max-width: 420px) { .brand-sub { display: none; } }

/* Home */
.hero { display: grid; grid-template-columns: 240px 1fr; gap: 2.2rem; align-items: start; margin-top: .5rem; }
.hero-photo img { border-radius: 14px; box-shadow: var(--shadow); width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.hero h1 { font-size: 2.4rem; margin-bottom: .2rem; }
.hero .titles { color: var(--text-muted); margin-bottom: 1rem; font-size: 1.02rem; }
.hero .titles span { display: block; }
.hero .bio p { font-family: var(--serif); font-size: 1.08rem; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .5rem; }
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; gap: 1.2rem; }
  .hero-photo { max-width: 220px; }
  .hero h1 { font-size: 2rem; }
}

.profile-icons { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: .75rem 0 0; }
.profile-icons a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: .85rem; background: var(--bg-elev); }
.profile-icons a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.footer-right .profile-icons a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.footer-right .profile-icons a { padding: .4rem; }

.btn { display: inline-flex; align-items: center; gap: .4rem; line-height: 1.25; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); font-weight: 500; font-size: .92rem; background: transparent; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--accent-soft); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
[data-theme="dark"] .btn-primary { color: #15161a; }
[data-theme="dark"] .btn-primary:hover { color: #15161a; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; border-radius: 6px; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 0; }
.glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1.5rem 0 0; }
@media (max-width: 700px) { .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.glance .metric { text-align: left; display: block; color: var(--text); }
.glance a.metric:hover { border-color: var(--accent); text-decoration: none; }
.glance a.metric:hover .lbl { color: var(--accent); }
.glance .num { font-size: 1.5rem; }
.metric { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-align: center; }
.metric .num { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.metric .lbl { font-size: .8rem; color: var(--text-muted); }
.metrics-note { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; margin-top: 2.5rem; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .9rem; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: start; }
.two-col aside { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow-y: auto; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } .two-col aside { position: static; } }

/* News */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { display: grid; grid-template-columns: 96px 1fr; gap: .8rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.news-list time { color: var(--text-muted); font-size: .85rem; font-variant-numeric: tabular-nums; padding-top: .1rem; }
.news-archive li { grid-template-columns: 130px 1fr; }

/* Papers */
.paper { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.paper:last-child { border-bottom: 0; }
.paper-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin: 0 0 .15rem; line-height: 1.3; }
.paper-title a { color: var(--text); }
.paper-title a:hover { color: var(--accent); }
.paper-authors { font-size: .95rem; margin: 0 0 .15rem; }
.paper-authors .me { font-weight: 600; }
.paper-venue { font-size: .92rem; color: var(--text-muted); margin: 0 0 .5rem; }
.paper-venue em { color: var(--text); font-style: italic; }
.paper-links { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.paper-links .btn { border-color: var(--line-strong); color: var(--text); }
.paper-links .btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.paper-links .btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.paper-panel { display: none; margin-top: .75rem; background: var(--bg-soft); border-radius: 8px; padding: .9rem 1rem; font-size: .95rem; }
.paper-panel.open { display: block; }
.paper-panel p { margin: 0; }
.paper-panel pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: .8rem; line-height: 1.45; }
.paper-panel .panel-actions { display: flex; justify-content: flex-end; margin-bottom: .4rem; }
.paper-badges { margin: 0 0 .3rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.badge { display: inline-block; font-size: .76rem; padding: .12rem .55rem; border-radius: 999px; background: var(--chip); color: var(--chip-text); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.badge-cite { background: var(--accent-soft); color: var(--accent); }
.paper-note { font-size: .85rem; color: var(--text-muted); margin: .3rem 0 0; }
.paper-summary { font-size: .92rem; color: var(--text-muted); margin: .2rem 0 0; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0 1.5rem; }
.filters .label { font-size: .85rem; color: var(--text-muted); margin-right: .2rem; }
.chip { border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .chip[aria-pressed="true"] { color: #15161a; }
@media (max-width: 700px) { .search-box { font-size: 16px; } }
.search-box { flex: 1 1 220px; min-width: 200px; padding: .45rem .7rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-elev); color: var(--text); font: inherit; font-size: .9rem; }
.filter-count { font-size: .85rem; color: var(--text-muted); width: 100%; }
.paper[hidden], .research-section[hidden], .no-match[hidden] { display: none; }
.no-match { color: var(--text-muted); padding: 1rem 0; }
.research-tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin: 0 0 .5rem; }
.toc { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.section-intro { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-intro h2 { margin-bottom: .3rem; }

/* Tables and CV */
table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: .5rem 0 1.5rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 480px; }
.table-wrap td:last-child { white-space: nowrap; }
.cv-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.cv-row .when { color: var(--text-muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv-row .what strong { font-weight: 600; }
.cv-row .what .sub { display: block; color: var(--text-muted); font-size: .9rem; }
@media (max-width: 560px) { .cv-row { grid-template-columns: 1fr; gap: .1rem; } }
.cv-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.numbered { padding-left: 1.4rem; }
.numbered li { margin-bottom: .45rem; }
.year-list { list-style: none; padding: 0; }
.year-list li { display: grid; grid-template-columns: 64px 1fr; gap: .8rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.year-list .yr { font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0; }
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; font-size: 1.05rem; }
.card p { font-size: .93rem; margin-bottom: .4rem; }
.card .meta { color: var(--text-muted); font-size: .85rem; }
.callout { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 6px; padding: .9rem 1.1rem; margin: 1.2rem 0; }
.callout p:last-child { margin-bottom: 0; }

/* Teaching */
.course { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.course .code { font-family: var(--mono); font-size: .8rem; color: var(--text-muted); }
.course h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.course p { font-size: .93rem; margin: 0; color: var(--text-muted); }
.course .when { font-size: .88rem; color: var(--text-muted); text-align: right; max-width: 220px; }
@media (max-width: 560px) { .course { grid-template-columns: 1fr; } .course .when { text-align: left; } }

/* Students */
.student { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.student strong { font-weight: 600; }
.student .meta { color: var(--text-muted); font-size: .9rem; }
.student .placement { display: block; font-size: .95rem; margin-top: .15rem; }
.name-grid { columns: 2; column-gap: 2rem; font-size: .95rem; padding-left: 1.2rem; }
@media (max-width: 560px) { .name-grid { columns: 1; } }

/* Books */
.book-cats { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.book-list { columns: 2; column-gap: 2.5rem; font-size: .93rem; padding-left: 1.2rem; }
.book-list li { break-inside: avoid; margin-bottom: .3rem; }
.book-list .by { color: var(--text-muted); }
@media (max-width: 640px) { .book-list { columns: 1; } }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }
address { font-style: normal; line-height: 1.7; }
.contact-grid > div > h2:first-child { margin-top: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-elev); margin-top: 1rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; padding: 1.5rem 1.25rem; font-size: .9rem; color: var(--text-muted); flex-wrap: wrap; }
.footer-meta { margin: .6rem 0 0; font-size: .8rem; }

/* Copy toast */
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .5rem .9rem; border-radius: 8px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200; }
.toast.show { opacity: 1; }

.print-only { display: none; }

/* Print */
@media print {
  .print-only { display: block; margin-bottom: 1rem; font-size: 11pt; }
  .site-header, .site-footer, .hero-actions, .paper-links, .filters, .theme-toggle, .cv-actions, .toast, .toc, .research-tools { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .paper-panel { display: none !important; }
  main.container { padding-top: 0; }
  .cv-row, .paper { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
}
