/* ========================================
   Shoumitro Chatterjee — Academic Website
   Editorial design, multi-page, mobile-first
   Accent: Economist Red #E3120B
   ======================================== */

/* --- Custom Properties (Light) --- */
:root {
  --bg: #FFFFFF;
  --bg-alt: #F5F5F3;
  --text: #1A1A1A;
  --text-muted: #5A5A58;
  --accent: #E3120B;
  --accent-hover: #B80E09;
  --border: #DDD9D3;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --card-bg: #FFFFFF;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06);
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-heading: 'Inter', -apple-system, sans-serif;
  --max-width: 780px;
  --nav-height: 56px;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg: #1A1A1A;
  --bg-alt: #242420;
  --text: #E8E4DF;
  --text-muted: #A09E99;
  --accent: #F04E3E;
  --accent-hover: #F97066;
  --border: #3A3A36;
  --nav-bg: rgba(26, 26, 26, 0.92);
  --card-bg: #242420;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; margin-bottom: 1.2rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

p { margin-bottom: 1rem; }

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.page-content {
  padding: 3rem 0 4rem;
  min-height: calc(100vh - var(--nav-height) - 80px);
}

/* --- Sticky Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.nav-name:hover { text-decoration: none; color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Dark mode toggle */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.dark-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Hero (Home Page) --- */
.hero {
  padding-top: 3.5rem;
  padding-bottom: 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  align-items: start;
}

.hero-photo {
  width: 240px;
  height: 240px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hero-title {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.hero-role {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.hero-affiliation {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.hero-bio {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero-links a {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 20px;
  border: 1.5px solid var(--accent);
  border-radius: 5px;
  color: var(--accent);
  transition: background 0.2s, color 0.2s;
}

.hero-links a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.hero-contact {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  font-family: var(--font-heading);
}

.hero-contact a {
  color: var(--text-muted);
}

.hero-contact a:hover {
  color: var(--accent);
}

.hero-divider {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* --- Section Headings --- */
.page-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-rule {
  width: 48px;
  height: 3px;
  background: var(--accent);
  border: none;
  margin-bottom: 2rem;
}

.sub-heading {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
}

/* --- Research Section Nav --- */
.section-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.section-nav a {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--bg-alt);
  transition: background 0.2s, color 0.2s;
}

.section-nav a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* --- Paper Cards --- */
.paper {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.paper:last-child {
  border-bottom: none;
}

.paper-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.paper-title a {
  color: var(--text);
}

.paper-title a:hover {
  color: var(--accent);
}

.paper-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.paper-media {
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.paper-media span {
  color: var(--text-muted);
}

/* --- Teaching Accordion --- */
.accordion {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.2rem;
  background: var(--card-bg);
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  gap: 1rem;
  transition: background 0.2s;
}

.accordion-btn:hover {
  background: var(--bg-alt);
}

.accordion-btn .chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  transition: transform 0.3s;
}

.accordion-item.open .accordion-btn .chevron {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.accordion-body-inner {
  padding: 0 1.2rem 1.2rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* --- Columns --- */
.column-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.column-item:last-child {
  border-bottom: none;
}

.column-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.column-title a {
  color: var(--text);
}

.column-title a:hover {
  color: var(--accent);
}

.column-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* --- Mentors Grid --- */
.mentors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.mentor-link {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  padding: 0.75rem 0;
  display: block;
  border-bottom: 1px solid var(--border);
}

.mentor-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Footer --- */
.footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--accent);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 640px) {
  body { font-size: 16px; }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .hero-photo {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    display: block;
    order: -1;
  }

  .hero-title { font-size: 1.7rem; }
  .hero-links { justify-content: center; }
  .hero-contact { text-align: center; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1rem 24px;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1rem;
    padding: 8px 0;
  }

  .nav-toggle {
    display: block;
  }

  .mentors-grid {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 2rem 0 3rem;
  }

  .section-nav {
    flex-direction: column;
  }

  .section-nav a {
    text-align: center;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr 200px;
    gap: 2rem;
  }

  .hero-photo {
    width: 200px;
    height: 200px;
  }
}
