/* ==========================================================================
   SIPL — Signal and Information Processing Lab, IISc
   Single stylesheet. Colours are tokens on :root; dark mode redefines them.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg:        #ffffff;
  --bg-soft:   #f5f7fa;
  --surface:   #ffffff;
  --text:      #12161c;
  --text-2:    #3d4652;
  --muted:     #6b7480;
  --border:    #e3e7ec;
  --border-2:  #d3d9e0;
  --accent:    #1f5fbf;
  --accent-2:  #174a96;
  --accent-bg: #eaf1fc;
  --gold:      #9a6a00;
  --gold-bg:   #fdf4dc;
  --green:     #1e7a45;
  --shadow:    0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --header-bg: rgba(255, 255, 255, .85);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --wrap: 1120px;
  --gutter: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0d1117;
    --bg-soft:   #131922;
    --surface:   #161c25;
    --text:      #e8ecf1;
    --text-2:    #c3cad3;
    --muted:     #8f99a6;
    --border:    #242c37;
    --border-2:  #323c49;
    --accent:    #7eaaff;
    --accent-2:  #a5c3ff;
    --accent-bg: #172238;
    --gold:      #e5b84a;
    --gold-bg:   #2a2210;
    --green:     #5cc98a;
    --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --header-bg: rgba(13, 17, 23, .82);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:        #0d1117;
  --bg-soft:   #131922;
  --surface:   #161c25;
  --text:      #e8ecf1;
  --text-2:    #c3cad3;
  --muted:     #8f99a6;
  --border:    #242c37;
  --border-2:  #323c49;
  --accent:    #7eaaff;
  --accent-2:  #a5c3ff;
  --accent-bg: #172238;
  --gold:      #e5b84a;
  --gold-bg:   #2a2210;
  --green:     #5cc98a;
  --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --header-bg: rgba(13, 17, 23, .82);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { color: var(--text); line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.8rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; color: var(--text-2); }
ul { color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 72px 0; }
.section + .section { padding-top: 0; }
.section.section--soft { background: var(--bg-soft); border-block: 1px solid var(--border); padding: 72px 0; }
.section--soft + .section { padding-top: 72px; }
.eyebrow {
  display: inline-block; font: 500 .75rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .9rem;
}
.lead { font-size: 1.125rem; color: var(--text-2); max-width: 70ch; }
.muted { color: var(--muted); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.more { font-weight: 500; font-size: .95rem; white-space: nowrap; }
.more::after { content: " →"; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); flex-shrink: 0; }
.brand a { color: var(--text); display: flex; align-items: center; }
.brand a:hover { text-decoration: none; color: var(--text); }
.brand .logo { height: 24px; width: auto; }
.brand-iisc { border-left: 1px solid var(--border-2); padding-left: 14px; height: 40px; }
.brand .seal { height: 40px; width: auto; }
.brand-text { flex-direction: column; align-items: flex-start !important; line-height: 1.25; }
.brand-text strong { display: block; font-size: .82rem; font-weight: 600; letter-spacing: -.005em; }
.brand-text span { display: block; font-size: .72rem; color: var(--muted); }

.logo--dark { display: none; }
:root[data-theme="dark"] .logo--light { display: none; }
:root[data-theme="dark"] .logo--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo--light { display: none; }
  :root:not([data-theme="light"]) .logo--dark { display: block; }
}

.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a {
  color: var(--text-2); font-size: .92rem; font-weight: 500; padding: 8px 12px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--bg-soft); }
.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.menu-btn { display: none; }

@media (max-width: 1180px) {
  .brand .brand-text { display: none; }
}
@media (max-width: 820px) {
  .menu-btn { display: inline-grid; }
  .header-tools { margin-left: auto; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    padding: 8px var(--gutter) 16px; display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; font-size: 1rem; border-radius: 6px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 500 .95rem/1 var(--font);
  padding: 12px 18px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--text-2); color: var(--bg); }
.btn-ghost { border-color: var(--border-2); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Hero (home) ---------- */
.hero { padding: 80px 0 72px; border-bottom: 1px solid var(--border); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero h1 { margin-bottom: 20px; }
.hero .lead { margin-bottom: 30px; }
.hero-art { width: 100%; max-width: 440px; justify-self: end; color: var(--text); }
.hero-art .edge { stroke: var(--border-2); stroke-width: 1.4; }
.hero-art .node { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.hero-art .node-ring { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: .35; }
@media (max-width: 880px) {
  .hero { padding: 56px 0 48px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { max-width: 360px; justify-self: start; }
}

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: 64px 0 40px; border-bottom: 1px solid var(--border); }
.page-head h1 { margin-bottom: 14px; font-size: clamp(1.9rem, 3.6vw, 2.6rem); }
.page-head .lead { margin: 0; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--border-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-bottom: 8px; }
.card p { font-size: .95rem; margin: 0; }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-bg); color: var(--accent); margin-bottom: 18px;
}
.card-icon svg { width: 22px; height: 22px; }

/* ---------- Two-column (home: pubs + news) ---------- */
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 56px; } }

.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); font-size: .94rem; color: var(--text-2); }
.news li:last-child { border-bottom: 1px solid var(--border); }
.news time { font: 500 .78rem/1.9 var(--mono); color: var(--muted); }

/* ---------- PI feature ---------- */
.pi { display: grid; grid-template-columns: 240px 1fr; gap: 40px; align-items: start; }
.pi img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.pi h3 { font-size: 1.5rem; margin-bottom: 4px; }
.pi .role { color: var(--muted); margin-bottom: 18px; }
.chip-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip-links a {
  font-size: .85rem; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--text-2);
}
.chip-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
@media (max-width: 720px) { .pi { grid-template-columns: 1fr; gap: 24px; } .pi img { max-width: 240px; } }

/* ---------- People ---------- */
.group { margin-bottom: 64px; }
.group > h2 { font-size: 1.35rem; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 28px; display: flex; align-items: baseline; gap: 10px; }
.group > h2 .count { font: 500 .8rem var(--mono); color: var(--muted); }
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 24px; }
@media (max-width: 960px) { .people { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; } }
.person img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-soft); margin-bottom: 14px;
}
.person h3 { font-size: 1.02rem; margin-bottom: 2px; }
.person h3 a { color: var(--text); }
.person h3 a:hover { color: var(--accent); }
.person .meta { font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.person .topic { font-size: .88rem; color: var(--text-2); margin: 0; }

.name-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; list-style: none; padding: 0; margin: 0; }
@media (max-width: 900px) { .name-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .name-list { grid-template-columns: 1fr; } }
.name-list li { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.name-list a { color: var(--text); font-weight: 500; }
.name-list a:hover { color: var(--accent); }
.name-list .li-icon { width: 13px; height: 13px; vertical-align: -1px; margin-left: 5px; opacity: .45; }
.name-list a:hover .li-icon { opacity: 1; }
.name-list small { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.subhead { font: 500 .78rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 30px 0 4px; }
.subhead:first-of-type { margin-top: 0; }

/* ---------- Research ---------- */
.area { display: grid; grid-template-columns: 280px 1fr; gap: 48px; padding: 48px 0; border-top: 1px solid var(--border); }
.area:first-of-type { border-top: 0; padding-top: 16px; }
.area-num { font: 500 .8rem var(--mono); color: var(--muted); display: block; margin-bottom: 10px; }
.area h2 { font-size: 1.4rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 24px; }
.tag { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border); }
.selected h4 { font: 500 .75rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
@media (max-width: 820px) { .area { grid-template-columns: 1fr; gap: 12px; } }

/* ---------- Publications ---------- */
.pub-toolbar {
  position: sticky; top: 64px; z-index: 20; background: var(--bg);
  padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.pub-controls { display: grid; grid-template-columns: 1fr 150px 190px 260px; gap: 10px; }
@media (max-width: 960px) { .pub-controls { grid-template-columns: 1fr 1fr; } .pub-controls .search { grid-column: 1 / -1; } }
@media (max-width: 520px) { .pub-controls { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .pub-toolbar { position: static; } .year-sticky { position: static; } }
.field {
  width: 100%; height: 42px; padding: 0 12px; font: 400 .93rem var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; appearance: none; -webkit-appearance: none;
}
select.field {
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f99a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .field { padding-left: 36px; padding-right: 40px; }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: 500 .72rem var(--mono); color: var(--muted); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 6px;
}
.pub-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font: 500 .82rem var(--font); padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2); background: transparent; color: var(--text-2);
}
.seg button:hover { background: var(--bg-soft); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.seg button .n { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.year-group { display: grid; grid-template-columns: 90px 1fr; gap: 24px; padding: 28px 0 8px; border-top: 1px solid var(--border); }
.year-group:first-child { border-top: 0; }
.year-label { font: 600 1.25rem/1.4 var(--font); color: var(--text); letter-spacing: -.02em; }
.year-label small { display: block; font: 400 .78rem var(--mono); color: var(--muted); letter-spacing: 0; }
@media (max-width: 640px) { .year-group { grid-template-columns: 1fr; gap: 4px; } .year-label small { display: inline; margin-left: 8px; } }
.year-sticky { position: sticky; top: 200px; align-self: start; }

.pub { padding: 0 0 22px; }
.pub + .pub { border-top: 1px dashed var(--border); padding-top: 20px; }
.pub-title { font-size: 1.02rem; font-weight: 600; line-height: 1.4; color: var(--text); margin: 0 0 4px; letter-spacing: -.005em; }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: .92rem; color: var(--text-2); margin: 0 0 3px; }
.pub-authors button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.pub-authors button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pub-venue { font-size: .9rem; color: var(--muted); margin: 0 0 10px; }
.pub-venue i { font-style: italic; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font: 500 .74rem/1 var(--font);
  padding: 5px 9px; border-radius: 6px; background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
}
.badge--venue { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.badge--award { background: var(--gold-bg); color: var(--gold); border-color: transparent; }
.pub-links { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; }
.pub-links a, .pub-links button {
  font: 500 .78rem/1 var(--font); padding: 5px 9px; border-radius: 6px; cursor: pointer;
  color: var(--text-2); background: transparent; border: 1px solid var(--border-2);
}
.pub-links a:hover, .pub-links button:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.pub-empty { padding: 64px 0; text-align: center; color: var(--muted); }

.pub-compact { list-style: none; margin: 0; padding: 0; }
.pub-compact li { padding: 16px 0; border-top: 1px solid var(--border); }
.pub-compact li:last-child { border-bottom: 1px solid var(--border); }
.pub-compact .pub-title { font-size: .98rem; }
.pub-compact .pub-venue { margin: 0; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(8, 12, 18, .6); }
.modal[hidden] { display: none; }
.modal-box { width: min(680px, 100%); background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; }
.modal-box header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-box h3 { margin: 0; font-size: 1rem; }
.modal-box pre {
  margin: 0 0 16px; padding: 16px; max-height: 50vh; overflow: auto; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--border); font: .8rem/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}

/* ---------- Teaching ---------- */
.course { padding: 28px; }
.course-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.course-code { font: 500 .8rem var(--mono); color: var(--muted); }
.course h3 { font-size: 1.2rem; margin: 2px 0 10px; }
.status { font: 500 .74rem/1 var(--font); padding: 6px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.status--on { color: var(--green); border-color: currentColor; background: transparent; }
details { border-top: 1px solid var(--border); margin-top: 16px; }
details summary { cursor: pointer; padding: 12px 0 0; font-weight: 500; font-size: .92rem; color: var(--text); list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+"; font: 500 1rem var(--mono); color: var(--muted); width: 12px; }
details[open] summary::before { content: "−"; }
details .details-body { padding-top: 10px; font-size: .92rem; }
details .details-body h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }
details .details-body ul { margin: 0; padding-left: 18px; }
details .details-body li { margin-bottom: 4px; }

/* ---------- Vacancies ---------- */
.role-card { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.role-card:first-child { border-top: 0; }
.role-card h3 { font-size: 1.1rem; margin: 0; }
.role-card p:last-child { margin-bottom: 0; }
@media (max-width: 720px) { .role-card { grid-template-columns: 1fr; gap: 8px; } }
.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius);
  background: var(--bg-soft); padding: 22px 24px;
}
.callout h3 { font-size: 1rem; margin-bottom: 6px; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }
.contact dl { margin: 0; }
.contact dt { font: 500 .75rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 22px; }
.contact dt:first-child { margin-top: 0; }
.contact dd { margin: 6px 0 0; color: var(--text); }
.map { width: 100%; height: 100%; min-height: 380px; border: 1px solid var(--border); border-radius: var(--radius); }
:root[data-theme="dark"] .map { filter: invert(.9) hue-rotate(180deg) saturate(.7); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; font-size: .88rem; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: start; }
.footer-logos { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.site-footer .logo { height: 20px; width: auto; }
.site-footer .seal { height: 32px; width: auto; padding-left: 14px; border-left: 1px solid var(--border-2); box-sizing: content-box; }
.site-footer p { color: var(--muted); margin: 0; font-size: .88rem; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--text); }

/* ---------- 404 ---------- */
.notfound { padding: 120px 0; text-align: center; }
.notfound .code { font: 600 .9rem var(--mono); color: var(--muted); }

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  .section { padding: 56px 0; }
  .section--soft + .section { padding-top: 56px; }
  .section.section--soft { padding: 56px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Home: photo slider ---------- */
.slider {
  position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-soft);
  border: 1px solid var(--border); aspect-ratio: 16 / 7;
}
.slides { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden;
  transition: opacity .7s ease, visibility 0s linear .7s;
}
.slide.is-active { opacity: 1; visibility: visible; transition: opacity .7s ease; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide--contain { background: #111; }
.slide--contain::before {
  content: ""; position: absolute; inset: -20px; background: var(--img) center / cover no-repeat;
  filter: blur(24px) brightness(.55); transform: scale(1.1);
}
.slide--contain img { position: relative; object-fit: contain; padding: 20px 20px 104px; }
.slide figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 28px 22px;
  background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, .35) 55%, transparent);
  color: #fff; display: flex; flex-direction: column; gap: 2px; padding-right: 180px;
}
.slide figcaption strong { font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em; }
.slide figcaption span { font-size: .9rem; color: rgba(255, 255, 255, .82); }
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .88); color: #12161c; box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  opacity: 0; transition: opacity .2s;
}
.slider-btn svg { width: 20px; height: 20px; }
.slider-prev { left: 16px; }
.slider-next { right: 16px; }
.slider:hover .slider-btn, .slider:focus-within .slider-btn { opacity: 1; }
@media (hover: none) { .slider-btn { opacity: 1; } }
.slider-bar { position: absolute; right: 22px; bottom: 22px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.slider-dots { display: flex; gap: 6px; }
.slider-dots button {
  width: 8px; height: 8px; padding: 0; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .5); transition: width .25s, background .25s;
}
.slider-dots button[aria-current="true"] { width: 22px; background: #fff; }
.slider-pause { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: rgba(255, 255, 255, .18); color: #fff; }
.slider-pause svg { width: 13px; height: 13px; }
.slider-pause .i-play { display: none; }
.slider.is-paused .slider-pause .i-play { display: block; }
.slider.is-paused .slider-pause .i-pause { display: none; }
@media (max-width: 720px) {
  .slider { aspect-ratio: 4 / 3; border-radius: 12px; }
  .slide figcaption { padding: 48px 16px 44px; }
  .slide figcaption strong { font-size: 1rem; }
  .slide figcaption span { font-size: .82rem; }
  .slider-bar { left: 16px; right: auto; bottom: 14px; }
  .slide--contain img { padding: 10px 10px 84px; }
}

/* Home side column */
.side-stack { display: flex; flex-direction: column; gap: 20px; }
.side-links h3 { font-size: 1rem; margin-bottom: 6px; }
.side-links ul { list-style: none; padding: 0; margin: 0; }
.side-links li { border-top: 1px solid var(--border); }
.side-links li:first-child { border-top: 0; }
.side-links a { display: flex; justify-content: space-between; padding: 11px 0; color: var(--text); font-size: .95rem; font-weight: 500; }
.side-links a::after { content: "→"; color: var(--muted); }
.side-links a:hover { color: var(--accent); text-decoration: none; }
.side-links a:hover::after { color: var(--accent); }

/* ---------- Teaching ---------- */
a.card.course { display: flex; flex-direction: column; }
.course-more { margin: auto 0 0; padding-top: 18px; }
a.card.course:hover .more { text-decoration: underline; text-underline-offset: 3px; }
.back-link { display: table; font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.back-link:hover { color: var(--text); }
.page-head .status { display: inline-block; }

.course-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 56px; align-items: start; }
.toc { position: sticky; top: 96px; font-size: .88rem; }
.toc p { font: 500 .72rem var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; color: var(--text-2); border-left: 2px solid transparent; }
.toc a:hover { color: var(--text); border-left-color: var(--border-2); text-decoration: none; }
@media (max-width: 860px) { .course-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; } .toc { position: static; } .toc ul { display: flex; flex-wrap: wrap; gap: 4px 16px; border: 0; } .toc a { padding: 2px 0; border: 0; margin: 0; } }

.prose { max-width: 820px; }
.prose h2 { font-size: 1.3rem; margin: 44px 0 14px; padding-top: 4px; }
.prose h2:first-child { margin-top: 0; }
.prose h3, .prose h4 { font-size: 1rem; margin: 22px 0 8px; }
.prose ul { padding-left: 20px; margin: 0 0 1em; }
.prose li { margin-bottom: 6px; }
.prose li ul { margin: 6px 0 0; }
.prose p, .prose li { color: var(--text-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0 20px; }
table.schedule { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.schedule th {
  text-align: left; font: 500 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  background: var(--bg-soft); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.schedule td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
table.schedule tr:last-child td { border-bottom: 0; }
table.schedule td:first-child { font-variant-numeric: tabular-nums; color: var(--muted); width: 1%; white-space: nowrap; }
table.schedule tbody tr:hover td { background: var(--bg-soft); }
table.schedule td a { font-weight: 500; white-space: nowrap; }
.video { position: relative; aspect-ratio: 16 / 9; max-width: 640px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin: 8px 0 20px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Slider placed in the hero */
.hero .wrap { grid-template-columns: 1fr 1fr; gap: 56px; }
.hero-slider { aspect-ratio: auto; background: none; border: 0; border-radius: 0; overflow: visible; }
.hero-slider .slides {
  position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.slide--art { display: grid; place-items: center; background: var(--bg-soft); }
.slide--art .hero-art { width: 84%; max-width: none; justify-self: center; }
.hero-slider .slide figcaption { padding: 48px 20px 16px; }
.hero-slider .slide figcaption strong { font-size: 1rem; }
.hero-slider .slide figcaption span { font-size: .84rem; }
.hero-slider .slide--contain img { padding: 16px 16px 72px; }
.hero-slider .slider-btn { top: calc(50% - 21px); width: 38px; height: 38px; }
.hero-slider .slider-prev { left: 12px; }
.hero-slider .slider-next { right: 12px; }
.hero-slider .slider-bar { position: static; margin-top: 14px; justify-content: space-between; }
.hero-slider .slider-dots button { background: var(--border-2); }
.hero-slider .slider-dots button[aria-current="true"] { background: var(--text); }
.hero-slider .slider-pause { background: transparent; color: var(--muted); border: 1px solid var(--border-2); }
.hero-slider .slider-pause:hover { color: var(--text); }
@media (max-width: 880px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 36px; }
  .hero-slider .slides { aspect-ratio: 4 / 3; }
}

/* News in two columns */
.news--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
.news--grid li:last-child { border-bottom: 0; }
.news--grid li:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
@media (max-width: 760px) {
  .news--grid { grid-template-columns: 1fr; }
  .news--grid li:nth-last-child(2) { border-bottom: 0; }
}

/* Join band */
.join { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.join h2 { margin-bottom: 8px; }
.join p { margin: 0; max-width: 60ch; }

/* ---------- Ph.D. / M.Tech (Res) cards ---------- */
.polaroids { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.polaroid {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.polaroid:hover, .polaroid:focus-within { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-2); }
.polaroid-photo { aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.polaroid-photo img { width: 100%; height: 100%; object-fit: cover; }
.polaroid-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.polaroid-body h3 { font-size: 1.02rem; margin-bottom: 4px; }
.polaroid-body .topic { font-size: .88rem; color: var(--accent); font-weight: 500; margin: 0 0 8px; line-height: 1.4; }
.polaroid-body .meta { font-size: .8rem; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.polaroid-links { display: flex; gap: 8px; margin-top: auto; }
.icon-link {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--border-2); color: var(--text-2); transition: background .15s, color .15s, border-color .15s;
}
.icon-link svg { width: 14px; height: 14px; }
.icon-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
:root[data-theme="dark"] .icon-link:hover { color: #0d1117; }
@media (max-width: 960px) { .polaroids { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .polaroids { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .polaroid-body { padding: 12px 12px 14px; }
  .polaroid-body h3 { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { .polaroid { transition: none; } }

/* Publications disclaimer */
.disclaimer { font-size: .92rem; color: var(--muted); margin: 0; max-width: 70ch; }

@media (max-width: 480px) {
  .brand { gap: 10px; }
  .brand-iisc { padding-left: 10px; height: 34px; }
  .brand .seal { height: 34px; }
}

/* When a page ends with the shaded "Work with us" band, let the footer sit directly under it */
main:has(> .section--soft:last-child) + .site-footer { margin-top: 0; border-top: 0; }

/* Course material that is linked but not uploaded yet (see js/main.js) */
.is-missing { color: var(--muted); opacity: .7; cursor: help; border-bottom: 1px dotted var(--border-2); }

/* PI links use the same round icon buttons as the student cards */
.pi-links { margin-top: 20px; gap: 10px; }
.pi-links .icon-link { width: 38px; height: 38px; }
.pi-links .icon-link svg { width: 16px; height: 16px; }
