/* ------------------------------------------------------------------
   Homepage of Dr. Murugaiyan Amirthalingam, IIT Madras
   Plain institutional style: one family (Arial), IIT Madras maroon as the
   only accent, conventional blue links, content in simple lists.
------------------------------------------------------------------- */
:root {
  --ink: #222222;
  --steel: #555555;     /* secondary text */
  --rule: #d9d9d9;
  --plate: #f4f4f2;     /* nav bar, footer */
  --paper: #ffffff;
  --maroon: #7b1f1f;    /* IIT Madras maroon */
  --blue: #1d4f91;      /* links */
  --blue-dark: #12366a;
  --straw: #7b1f1f;
  --sans: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", sans-serif;
  --serif: var(--sans);
  --wrap: 70rem;
  --measure: 70ch;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; }
@media (min-width: 48rem) { body { font-size: 1.0625rem; } }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
:focus-visible { outline: 3px solid #e3a33b; outline-offset: 2px; }
h1, h2, h3 { font-weight: 700; line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.5rem); color: var(--maroon); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 48rem) { .wrap { padding: 0 2rem; } }
.measure { max-width: var(--measure); }
.muted { color: var(--steel); }
.small { font-size: 0.9rem; }
.skip { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }

/* ---------------- Header and navigation ---------------- */
.site-header { background: var(--paper); }
.site-header > .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: var(--ink); line-height: 1.25; }
.brand img { width: 56px; height: auto; flex-shrink: 0; }
.brand strong { display: block; font-size: 1.25rem; }
.brand span span { font-size: 0.92rem; color: var(--steel); }
.brand:hover { color: var(--ink); }
.brand .short { display: none; }
@media (max-width: 34rem) { .brand .long { display: none; } .brand .short { display: inline; } .brand img { width: 44px; } }
.site-nav { background: var(--plate); border-top: 1px solid var(--rule); border-bottom: 3px solid var(--maroon); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.site-nav a { display: block; padding: 0.7rem 0.85rem; color: var(--ink); text-decoration: none; font-size: 0.97rem; }
.site-nav li:first-child a { padding-left: 0; }
.site-nav a:hover { color: var(--maroon); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--maroon); font-weight: 700; }
.nav-toggle { display: none; }
@media (max-width: 52rem) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 0.5rem; font: 700 0.95rem var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: 0.5rem 0.8rem; cursor: pointer; }
  .nav-toggle .bars { width: 18px; height: 12px; position: relative; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
  .nav-toggle .bars::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 2px solid currentColor; }
  .site-nav { display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 0.3rem 0; }
  .site-nav a, .site-nav li:first-child a { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
  .site-nav li:last-child a { border-bottom: 0; }
}
.no-js .site-nav { display: block; }

/* ---------------- Page titles and sections ---------------- */
.page-title { padding-top: 1.8rem; padding-bottom: 0.4rem; }
.page-title h1 { margin-bottom: 0.2rem; }
.page-title p { color: var(--steel); margin: 0; }
.section { padding: 1.5rem 0 2rem; }
.section.alt { background: none; }
.section-head { max-width: var(--measure); margin-bottom: 1rem; }
.block { margin: 0 0 2.4rem; }
.block h2 { border-bottom: 1px solid var(--rule); padding-bottom: 0.35rem; margin-bottom: 0.9rem; }
.plain-list { padding-left: 1.2rem; margin: 0; }
.plain-list li { margin-bottom: 0.55rem; }

/* ---------------- Home ---------------- */
.intro { display: grid; gap: 1.5rem; padding: 2rem 0 1.5rem; align-items: start; }
@media (min-width: 44rem) { .intro { grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; } }
.portrait { width: 100%; max-width: 13rem; border: 1px solid var(--rule); }
.intro h1 { margin-bottom: 0.4rem; }
.intro .role { color: var(--steel); margin-bottom: 1rem; }
.contact { border-collapse: collapse; margin: 0 0 0.9rem; font-size: 0.98rem; }
.contact th { text-align: left; font-weight: 700; padding: 0.15rem 1.2rem 0.15rem 0; vertical-align: top; }
.contact td { padding: 0.15rem 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0; }
.lead { font-size: 1.12rem; max-width: var(--measure); }
.parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem 1rem; margin-top: 1rem; }
@media (min-width: 40rem) { .parts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 62rem) { .parts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.part { margin: 0; }
.part .ph { aspect-ratio: 4 / 3; background: #fff; border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; padding: 0.4rem; overflow: hidden; }
.part .ph img { width: 100%; height: 100%; object-fit: contain; }
.part figcaption { font-size: 0.95rem; margin-top: 0.4rem; line-height: 1.35; }
ol.pubs.recent { padding-left: 1.5rem; }
ol.pubs.recent li { margin-bottom: 0.7rem; }

/* ---------------- In-page links ("On this page") ---------------- */
.jump { list-style: none; margin: 0.5rem 0 1.8rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 0; font-size: 0.97rem; }
.jump::before { content: "On this page:"; color: var(--steel); margin-right: 0.6rem; }
.jump li + li::before { content: "|"; color: var(--rule); margin: 0 0.6rem; }

/* ---------------- Profile ---------------- */
.two-col { display: grid; gap: 2rem; }
@media (min-width: 56rem) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 1rem; }
.timeline .when { font-size: 0.92rem; color: var(--steel); }
.timeline h3 { margin: 0; font-size: 1.05rem; }
.timeline p { margin: 0; color: var(--steel); font-size: 0.97rem; }

/* ---------------- Publications ---------------- */
.metrics { display: flex; flex-wrap: wrap; gap: 0.3rem 1.6rem; margin: 0 0 1rem; padding: 0; }
.metrics div { display: flex; align-items: baseline; gap: 0.35rem; }
.metrics dt { font-weight: 700; order: 0; }
.metrics dd { margin: 0; color: var(--steel); }
.pub-tools { margin-bottom: 1.2rem; }
.pub-tools label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.pub-tools input { width: 1.1rem; height: 1.1rem; }
.year-group { margin-bottom: 1.5rem; }
.year-group h3 { font-size: 1.05rem; color: var(--ink); margin-bottom: 0.5rem; }
ol.pubs { margin: 0; padding-left: 2.4rem; }
ol.pubs li { margin-bottom: 0.8rem; max-width: 82ch; }
ol.pubs a { overflow-wrap: anywhere; }
.oa { color: #1f6b45; font-size: 0.88rem; font-weight: 700; white-space: nowrap; margin-left: 0.3rem; }
.oa::before { content: "["; } .oa::after { content: "]"; }
.pub-section { padding-top: 0.5rem; margin-bottom: 2rem; scroll-margin-top: 1rem; }
.only-oa ol.pubs li:not(.is-oa) { display: none; }
.only-oa .year-group:not(.has-oa) { display: none; }
.only-oa .pub-section:not(#journals) { display: none; }
.legend { font-size: 0.97rem; color: var(--steel); }

/* ---------------- People ---------------- */
.group-photo { margin: 0 0 2rem; }
.group-photo figcaption { font-size: 0.92rem; color: var(--steel); margin-top: 0.4rem; }
.people { display: grid; gap: 1.4rem 1.5rem; margin-bottom: 2.4rem; }
@media (min-width: 44rem) { .people { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 66rem) { .people { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.person { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.person img { width: 5.5rem; height: 6.4rem; object-fit: cover; object-position: center top; background: var(--plate); border: 1px solid var(--rule); }
.person h3 { font-size: 1rem; margin: 0 0 0.2rem; }
.person p { margin: 0 0 0.3rem; font-size: 0.95rem; line-height: 1.45; }
.person .guide { color: var(--steel); font-size: 0.88rem; }
.alumni-grid { display: grid; gap: 1.5rem; }
@media (min-width: 56rem) { .alumni-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 3rem; } }
.alumni-grid ol { padding-left: 1.6rem; margin: 0; }
.alumni-grid li { margin-bottom: 0.45rem; font-size: 0.97rem; }

/* ---------------- Research projects ---------------- */
.proj-group { border-top: 1px solid var(--rule); }
.proj-group:last-of-type { border-bottom: 1px solid var(--rule); }
.proj-group > summary { list-style: none; cursor: pointer; padding: 0.85rem 0; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.proj-group > summary::-webkit-details-marker { display: none; }
.proj-group > summary h2 { font-size: 1.15rem; margin: 0; }
.proj-group > summary .count { color: var(--steel); font-size: 0.92rem; white-space: nowrap; margin-left: auto; }
.proj-group > summary::after { content: "+"; font: 700 1.3rem/1 var(--sans); color: var(--maroon); width: 1rem; text-align: center; }
.proj-group[open] > summary::after { content: "\2212"; }
.proj-sum { color: var(--steel); margin: -0.3rem 0 0.8rem; font-size: 0.95rem; }
.projects { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.projects li { padding: 0.8rem 0; border-top: 1px dotted var(--rule); display: grid; gap: 0.25rem; }
@media (min-width: 56rem) { .projects li { grid-template-columns: minmax(0, 1fr) 14rem; column-gap: 2rem; } }
.projects h3 { font-size: 1rem; line-height: 1.4; margin: 0; }
.projects .who, .projects .agency { font-size: 0.95rem; color: var(--steel); margin: 0; }
.projects .facts { font-size: 0.95rem; margin: 0; }
@media (min-width: 56rem) { .projects .facts { grid-column: 2; grid-row: 1 / span 3; text-align: right; } }
.projects .value { font-weight: 700; margin-right: 0.3rem; }
.status { font-size: 0.88rem; color: var(--steel); }
.status.ongoing { color: #8a5a00; font-weight: 700; }

/* ---------------- Teaching ---------------- */
.courses { display: grid; gap: 0; }
.course { padding: 0.8rem 0; border-top: 1px solid var(--rule); }
.course .code { font-weight: 700; color: var(--maroon); font-size: 0.95rem; margin-right: 0.4rem; }
.course h3 { display: inline; font-size: 1.05rem; }
.course > p { margin-top: 0.2rem !important; }
.course details summary { cursor: pointer; color: var(--blue); font-size: 0.95rem; margin-top: 0.35rem; }
.course details p { margin-top: 0.5rem; font-size: 0.97rem; color: var(--steel); max-width: 80ch; }

/* ---------------- Media ---------------- */
.videos { display: grid; gap: 1.8rem; }
@media (min-width: 52rem) { .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.video .frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video p { margin: 0.5rem 0 0; font-size: 0.97rem; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--plate); border-top: 3px solid var(--maroon); padding: 1.4rem 0 1.2rem; margin-top: 2.5rem; font-size: 0.93rem; color: var(--steel); }
.site-footer p { margin: 0 0 0.35rem; }
.site-footer b { color: var(--ink); }
.site-footer .copy { margin-top: 0.6rem; font-size: 0.86rem; }

@media print {
  .site-nav, .nav-toggle, .pub-tools, .jump, .site-footer { display: none !important; }
  body { font-size: 11pt; }
}

/* Teaching: numbered course units inside "Course contents" */
.course details ol.units { margin: 0.6rem 0 0.6rem; padding-left: 1.4rem; font-size: 0.97rem; color: var(--steel); max-width: 80ch; }
.course details ol.units li { margin-bottom: 0.4rem; }
.course details b { color: var(--ink); }

/* ---------------- People: photo stack (prints in a pile) ---------------- */
.stack { margin: 0 0 2.5rem; max-width: 52rem; overflow-x: clip; padding-top: 1.2rem; }
.stack-cards { list-style: none; margin: 0; padding: 0; position: relative; aspect-ratio: 16 / 9; }
.print {
  position: absolute; inset: 0;
  background: #fff; padding: 0.6rem 0.6rem 0.6rem;
  border: 1px solid var(--rule); border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.45s cubic-bezier(.2,.7,.2,1), opacity 0.45s ease;
  touch-action: pan-y;
}
@media (min-width: 40rem) { .print { padding: 0.75rem; } }
.print { background-color: var(--plate); background-size: cover; background-position: center; background-origin: content-box; background-clip: content-box; background-repeat: no-repeat; }
.print picture { display: block; width: 100%; height: 100%; }
.print img { width: 100%; height: 100%; object-fit: cover; border-radius: 1px; }
.print img:not([src]) { visibility: hidden; }
/* positions in the pile, set by script as data-pos */
.print[data-pos="0"] { z-index: 5; transform: none; }
.print[data-pos="1"] { z-index: 4; transform: translate(1.2%, -1.8%) rotate(1.2deg); }
.print[data-pos="2"] { z-index: 3; transform: translate(-1.2%, -3%) rotate(-1.4deg); }
.print[data-pos="3"] { z-index: 2; transform: translate(0.4%, -4%) rotate(0.5deg); opacity: 0.9; }
.print[data-pos="hidden"] { z-index: 1; transform: translate(0, -5.4%); opacity: 0; }
.print.leaving { z-index: 6; transform: translate(-115%, 4%) rotate(-9deg); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .print { transition: none; } }
.stack-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.stack-cap { margin: 0; color: var(--steel); font-size: 0.97rem; }
.stack-n { color: var(--ink); font-weight: 600; margin-right: 0.4rem; white-space: nowrap; }
.stack-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }
.stack-btns button {
  width: 2.6rem; height: 2.6rem; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font: 400 1.6rem/1 var(--serif);
}
.stack-btns button:hover { border-color: var(--blue); color: var(--blue); }
/* Without JavaScript: show the photos one after another */
.no-js .stack-cards { aspect-ratio: auto; display: grid; gap: 1rem; }
.no-js .print { position: static; transform: none; opacity: 1; }
.no-js .print picture { height: auto; }
.no-js .print img:not([src]) { display: none; }
.no-js .print noscript img, .no-js .print img { height: auto; }
.no-js .stack-bar { display: none; }
