/* ============================================================
   ROHAN M. SHENOY — Academic Site CSS
   Styled after math.mit.edu/~rigollet/
   ============================================================ */

/* ── CUSTOM PROPERTIES ── */

/* LIGHT MODE — Imperial College London
   Navy #002147 · Imperial Blue #003E74 · Light Blue #D4EFFC · Light Grey #EBEEEE */
:root {
  --bg:            #ffffff;
  --bg-card:       #f4f7fb;        /* faint Imperial blue tint */
  --text:          #001830;        /* near-navy for body text */
  --text-muted:    #3a4f6a;
  --text-light:    #7a8fa8;
  --accent:        #003E74;        /* Imperial Blue (PMS 541) */
  --accent-hover:  #002147;        /* Navy (PMS 539) */
  --border:        #c8d8e8;        /* cool blue-grey */
  --border-light:  #ddeaf5;
  --link:          #003E74;
  --link-hover:    #002147;
  --blockquote-bg: #eaf2fb;        /* tinted Imperial light blue */
  --blockquote-border: #003E74;
  --shadow:        0 1px 4px rgba(0,33,71,0.10);
  --font-serif:    'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:     'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --header-h:      54px;
}

/* DARK MODE — MIT
   Cardinal Red #A31F34 · MIT Gray #8A8B8C · near-black background */
[data-theme="dark"] {
  --bg:            #0f0f10;        /* near-black, neutral */
  --bg-card:       #1a1a1c;
  --text:          #e8e6e3;
  --text-muted:    #a8a6a3;
  --text-light:    #6a6868;
  --accent:        #A31F34;        /* MIT Cardinal Red (PMS 201) */
  --accent-hover:  #c42540;        /* slightly lighter for hover legibility */
  --border:        #2e2d2d;
  --border-light:  #252424;
  --link:          #c42540;        /* lightened slightly so links are readable on dark bg */
  --link-hover:    #e0475e;
  --blockquote-bg: #1a1214;        /* very dark red-tinted panel */
  --blockquote-border: #A31F34;
  --shadow:        0 1px 4px rgba(0,0,0,0.45);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  font-size: 18px;
}

body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.header-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
}

/* Header right-side icon group */
.header-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Scholar / LinkedIn icons in header */
.header-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.header-icon-link:hover {
  color: var(--accent);
  background: var(--border-light);
  text-decoration: none;
}

.header-svg-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}

/* Dark / light toggle — icon only */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--border-light);
}

.toggle-sun,
.toggle-moon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* In light mode: show sun, hide moon */
[data-theme="light"] .toggle-sun  { opacity: 1; transform: scale(1); }
[data-theme="light"] .toggle-moon { opacity: 0; transform: scale(0.6); }

/* In dark mode: hide sun, show moon */
[data-theme="dark"]  .toggle-sun  { opacity: 0; transform: scale(0.6); }
[data-theme="dark"]  .toggle-moon { opacity: 1; transform: scale(1); }

/* ── LAYOUT ── */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  align-items: start;
}

/* ── SIDEBAR ── */
.sidebar {
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 2.5rem 1.5rem 2.5rem 0;
  background: var(--bg);
  transition: background 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-photo-wrap {
  margin-bottom: 1rem;
}

.sidebar-photo-thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  filter: grayscale(15%);
}

.sidebar-name {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.sidebar-title {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.sidebar-affil {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--link);
  display: block;
  margin-bottom: 1.6rem;
}

.sidebar-nav ul {
  list-style: none;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.sidebar-nav li {
  border-bottom: 1px solid var(--border-light);
}

.sidebar-nav a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
  padding: 0.45rem 0;
  letter-spacing: 0.015em;
  transition: color 0.15s, padding-left 0.15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--accent);
  padding-left: 6px;
  text-decoration: none;
}

/* ── MAIN CONTENT ── */
.content {
  padding: 2.5rem 0 4rem 3rem;
  border-left: 1px solid var(--border);
  min-height: calc(100vh - var(--header-h));
}

/* ── SECTION ── */
.content-section {
  padding-bottom: 3.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.content-section:last-child { border-bottom: none; }

.section-title {
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
  padding-top: 1.8rem;
  color: var(--text);
}

/* ── ABOUT ── */
.bio-card {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: normal;
  line-height: 1.75;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
  border-radius: 3px;
  color: var(--text);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.about-affiliations {
  margin-bottom: 2rem;
}

.about-affiliations h3 {
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 0.6rem;
}

.affil-list {
  list-style: none;
}
.affil-list li {
  margin-bottom: 0.3rem;
}
.affil-list a {
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

/* ── POSITIONS ── */
.cv-positions h3 {
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin: 1.8rem 0 0.8rem;
}

.position-entry {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-light);
}

.pos-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
}

.pos-meta {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* ── PRIZES TOGGLE ── */
.pos-prizes {
  margin-top: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.83rem;
}

.pos-prizes-toggle {
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  display: inline-block;
  transition: color 0.15s ease;
}

.pos-prizes-toggle:hover {
  color: var(--text-light);
}

.pos-prizes[open] .pos-prizes-toggle {
  margin-bottom: 0.3rem;
}

.pos-prizes-list {
  margin: 0 0 0 1.1rem;
  padding: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── AWARDS ── */
.award-entry {
  position: relative;
  padding: 1rem 0 1rem 1.2rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 1.8rem;
}

.award-label {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  display: block;
  margin-bottom: 0.2rem;
}

.award-year {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.award-entry p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── WORKS GRID ── */
.works-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.work-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.4rem;
  padding: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.15s, background 0.25s ease;
}
.work-card:hover { border-color: var(--accent); }

.work-img-wrap {
  width: 120px;
  height: 100px;
  background: var(--border-light);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
}

.work-img-placeholder {
  font-size: 2.8rem;
  opacity: 0.35;
  user-select: none;
}

.work-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-body h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.work-ref {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.work-body p:not(.work-ref) {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── PUBLICATIONS ── */
.pub-entry {
  padding: 1.2rem 0 1.4rem;
  border-bottom: 1px solid var(--border-light);
}
.pub-entry:last-child { border-bottom: none; }

.pub-title {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.pub-authors {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.pub-venue {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.pub-abstract {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.7rem;
}

.pub-links {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pub-link {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 10px;
  border-radius: 2px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.pub-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ── TALKS ── */
.talk-entry {
  position: relative;
  padding: 0.8rem 0 1rem 1.2rem;
  border-left: 3px solid var(--border);
  margin-bottom: 1.5rem;
  transition: border-color 0.15s;
}
.talk-entry:hover { border-left-color: var(--accent); }

.talk-venue {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  display: block;
  margin-bottom: 0.2rem;
}

.talk-year {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.talk-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.talk-entry > p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── TEACHING ── */
.teaching-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
}

.teaching-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s, background 0.25s ease;
}
.teaching-entry:hover { border-color: var(--accent); }

.teaching-entry h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.teaching-role {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.1rem;
}

.teaching-term {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ── HOBBIES ── */
.hobbies-grid {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.hobby-entry {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 1rem;
  align-items: start;
}

.hobby-icon {
  width: 44px;
  height: 44px;
  background: var(--blockquote-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  transition: background 0.25s ease, border-color 0.15s;
}

.hobby-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.hobby-body h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.hobby-body p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── PHOTO GALLERY ── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 130px;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.photo-item {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.15s, transform 0.15s;
}
.photo-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(8%);
  transition: filter 0.2s ease, transform 0.3s ease;
}
.photo-item:hover img {
  filter: grayscale(0%);
  transform: scale(1.04);
}

/* landscape tile: spans two columns, normal row height */
.photo-item--wide {
  grid-column: span 2;
  grid-row: span 1;
}

/* portrait tile: single column, spans two rows */
.photo-item--tall {
  grid-column: span 1;
  grid-row: span 2;
}

/* ── CONTACT ── */
.contact-lead {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.contact-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 2rem;
  transition: background 0.25s ease;
}

.contact-block p {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.contact-links {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

.contact-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 14px;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.contact-btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* Icon-bearing contact buttons */
.contact-btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
}
.contact-btn--icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.copyright {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .sidebar {
    position: static;
    max-height: none;
    padding: 1.8rem 0 1rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 1.2rem;
    row-gap: 0.2rem;
    align-items: start;
  }

  .sidebar-photo-wrap {
    grid-row: 1 / 4;
    margin-bottom: 0;
  }

  .sidebar-name { align-self: end; }
  .sidebar-affil { grid-column: 2; }

  .sidebar-nav {
    grid-column: 1 / 3;
    margin-top: 0.8rem;
  }

  .sidebar-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
  }
  .sidebar-nav li { border-bottom: none; }
  .sidebar-nav a { padding: 0.35rem 0.8rem 0.35rem 0; }

  .content {
    padding: 2rem 0 3rem;
    border-left: none;
  }

  .work-card {
    grid-template-columns: 90px 1fr;
    gap: 1rem;
  }
  .work-img-wrap { width: 90px; height: 80px; }

  .photo-gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
  }
  .photo-item--wide { grid-column: span 2; }
}

@media (max-width: 540px) {
  html { font-size: 16px; }
  .site-header { padding: 0 1rem; }
  .layout { padding: 0 0.75rem; }
  .teaching-grid { grid-template-columns: 1fr; }
  .work-card { grid-template-columns: 1fr; }
  .work-img-wrap { width: 100%; height: 100px; }
  .hobby-entry { grid-template-columns: 38px 1fr; gap: 0.75rem; }
  .hobby-icon { width: 38px; height: 38px; }
  .hobby-icon svg { width: 17px; height: 17px; }
  .photo-gallery {
    grid-template-columns: 1fr;
    grid-auto-rows: 200px;
  }
  .photo-item--wide,
  .photo-item--tall {
    grid-column: span 1;
    grid-row: span 1;
  }
}
