*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #0e0e0e;
  --ink2: #2a2a2a;
  --mist: #f4f1eb;
  --warm: #ede8df;
  
  /* Red */
  --gold: #c71b36;
  --gold2: #a3152c;

  /* Blue */
  --teal: #0d3562;
  --teal2: #1a4a84;
  
  --rose: #b5503a;
  --purple: #4a3b7a;
  --slate: #6b6459;
  --border: #d5cfc4;
}

/* SMOOTH PAGE TRANSITIONS */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: fade-out 0.2s ease-out both;
}
::view-transition-new(root) {
  animation: fade-in 0.2s ease-in both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--mist);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

/* PAGE LAYOUT UTILITIES */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-content {
  padding-top: 120px;
  flex-grow: 1;
}
.spacing-bottom-lg {
  margin-bottom: 3rem;
}
.footer-bottom {
  margin-top: auto;
}

/* TYPOGRAPHY OVERRIDES */
.nav-logo, 
.hero-title, 
.hero-stat-num, 
.section-title, 
.rc-number, 
.rc-title, 
.team-name, 
.pub-year, 
.pub-title, 
.news-title,
.facility-title {
  font-family: 'Merriweather', serif;
}

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(244,241,235,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 4vw;
  height: 72px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
  line-height: 1.2;
}
.nav-logo a { 
  text-decoration: none; 
  color: inherit; 
  display: flex; 
  align-items: center; 
  gap: 8px;
}
.nav-logo span { color: var(--teal); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  text-decoration: none; font-size: 13px; font-weight: 500;
  color: var(--slate); letter-spacing: 0.05em; text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--teal); }

/* HAMBURGER BUTTON */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 101;
}
.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--ink);
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* HERO */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-top: 64px;
  overflow: hidden;
}
.hero-left {
  background: var(--ink);
  display: flex; flex-direction: column; justify-content: center;
  padding: 8vw 6vw 8vw 8vw;
  position: relative;
}
.hero-eyebrow {
  font-size: 11px; font-weight: 500; letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 2rem;
}
.hero-title {
  font-size: clamp(36px, 4.2vw, 64px);
  font-weight: 900; line-height: 1.05;
  color: #f4f1eb;
  margin-bottom: 2rem;
}
.hero-title em { font-style: italic; color: var(--gold); }
.hero-sub {
  font-size: 16px; color: #9b9086; line-height: 1.75;
  max-width: 420px; margin-bottom: 3rem;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--teal); color: white;
  text-decoration: none; font-size: 13px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 14px 28px; border-radius: 2px;
  transition: background 0.2s;
}
.hero-cta:hover { background: var(--teal2); }
.hero-cta-arrow { font-size: 18px; }
.hero-meta {
  position: absolute; bottom: 3rem; left: 8vw;
  display: flex; gap: 3rem;
}
.hero-stat-num {
  font-size: 32px; font-weight: 700; color: #f4f1eb;
}
.hero-stat-label { font-size: 11px; color: #6b6459; text-transform: uppercase; letter-spacing: 0.1em; }

.hero-right {
  background: var(--warm);
  display: flex; align-items: center; justify-content: center;
  padding: 4rem;
  position: relative;
}
.hero-image {
    width: 100%;
    max-width: 650px;
    height: auto;
    border-radius: 12px;
}

/* SECTION BASE */
section { 
  padding: 8rem 8vw; 
  scroll-margin-top: 80px; 
}
.section-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold2);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 1.5rem;
}
.section-label::before {
  content: ''; width: 32px; height: 1px; background: var(--gold2);
}
.section-title {
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 900; line-height: 1.1;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.section-intro {
  font-size: 17px; color: var(--slate); line-height: 1.8;
  max-width: 560px;
}

/* RESEARCH */
#research { background: #fff; }
.research-header {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
  align-items: end; margin-bottom: 5rem;
}
.research-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5px;
  background: var(--border);
  border: 1.5px solid var(--border);
}
.research-card {
  background: #fff; padding: 2.5rem 2rem;
  transition: background 0.3s;
  cursor: pointer; 
  position: relative; overflow: hidden;
}
.research-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 0;
  transition: height 0.3s;
}
.research-card.c1::before { background: var(--teal); }
.research-card.c2::before { background: var(--rose); }
.research-card.c3::before { background: var(--purple); }
.research-card.c4::before { background: var(--gold2); }
.research-card.c5::before { background: var(--teal); }
.research-card.c6::before { background: var(--rose); }
.research-card:hover { background: var(--mist); }
.research-card:hover::before { height: 100%; }

.rc-number {
  font-size: 40px; font-weight: 900;
  color: var(--border); margin-bottom: 1rem;
  line-height: 1;
}
.rc-title {
  font-size: 20px; font-weight: 700;
  color: var(--ink); margin-bottom: 0.75rem;
  line-height: 1.3;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.rc-title::after {
  content: '+';
  font-size: 24px; font-weight: 300; color: var(--border);
  transition: transform 0.3s ease; line-height: 1;
}
.research-card.expanded .rc-title::after {
  transform: rotate(45deg);
}
.rc-desc { font-size: 14px; color: var(--slate); line-height: 1.7; }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1.25rem; }
.rc-tag {
  font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 10px;
  background: var(--warm); color: var(--slate);
  border-radius: 2px;
}
.rc-details {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
  font-size: 14px; color: var(--slate); line-height: 1.7;
}
.research-card.expanded .rc-details {
  max-height: 600px; 
  opacity: 1; 
  margin-top: 1.5rem; 
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ABOUT STRIP & PILLARS */
.about-strip {
  background: var(--ink);
  padding: 7rem 8vw;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6rem;
  align-items: center;
}
.about-strip .section-title { color: #f4f1eb; }
.about-strip .section-label { color: var(--gold); }
.about-strip .section-label::before { background: var(--gold); }
.about-text { font-size: 16px; color: #9b9086; line-height: 1.85; }
.about-text p + p { margin-top: 1rem; }
.about-pillars { display: flex; flex-direction: column; gap: 1.5px; }

/* PILLAR LINKS (Removes inline styles) */
a.pillar {
  text-decoration: none;
  color: inherit;
}
.pillar {
  background: #1a1a1a; padding: 1.5rem 2rem;
  display: flex; align-items: center; gap: 1.5rem;
  transition: background 0.2s;
}
.pillar:hover { background: #222; }
.pillar-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.pillar-icon.t { background: rgba(26,107,90,0.2); color: #2dce9e; }
.pillar-icon.r { background: rgba(181,80,58,0.2); color: #e8836b; }
.pillar-icon.c { background: rgba(74,59,122,0.2); color: #9b8bd4; }
.pillar-text strong { display: block; font-size: 15px; font-weight: 500; color: #e8e4dc; }
.pillar-text span { font-size: 13px; color: #6b6459; }

/* PEOPLE */
#people { background: var(--mist); }
.people-header {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
  align-items: end; margin-bottom: 4rem;
}
.team-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; align-items: start; /* Prevents neighboring cards from stretching */
}
.team-card {
  background: #fff; border: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer; 
  display: flex;
  flex-direction: column;
  align-items: center;
}
.team-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }

.avatar-img {
  width: 88px; height: 88px; 
  border-radius: 50%;
  object-fit: cover; 
  margin: 0 auto 1rem;
  border: 2px solid var(--mist);
}
.team-name {
  font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 4px;
}
.team-role { font-size: 12px; color: var(--slate); letter-spacing: 0.08em; }

.team-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
  font-size: 13px; color: var(--slate); line-height: 1.6;
  text-align: left;
  width: 100%;
}
.team-card.expanded .team-content {
  max-height: 500px;
  opacity: 1;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.team-links {
  display: flex; gap: 1rem; margin-top: 1.25rem;
}
.team-links a {
  font-size: 11px; font-weight: 600; color: var(--teal); 
  text-decoration: none; text-transform: uppercase; letter-spacing: 0.08em;
}
.team-links a:hover { color: var(--teal2); text-decoration: underline; }

/* PUBLICATIONS */
#publications { background: #fff; }
.pubs-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 3rem;
}
.pubs-link {
  font-size: 13px; font-weight: 500; color: var(--teal);
  text-decoration: none; letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.pubs-link:hover { color: var(--teal2); }
.pub-list { display: flex; flex-direction: column; gap: 0; }
.pub-item {
  padding: 2rem 0; border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: auto 1fr;
  gap: 2rem; align-items: start;
  transition: background 0.15s;
  cursor: default;
}
.pub-item:first-child { border-top: 1px solid var(--border); }
.pub-year {
  font-size: 20px; font-weight: 700; color: var(--gold);
  min-width: 56px; padding-top: 2px;
}
.pub-title {
  font-size: 18px; font-weight: 700; color: var(--ink);
  line-height: 1.35; margin-bottom: 6px;
  transition: color 0.2s;
}
a:hover .pub-title {
  color: var(--teal);
}
.pub-read-more {
  display: inline-block; 
  margin-top: 8px;
  font-size: 11px; font-weight: 600; color: var(--teal);
  text-decoration: none; text-transform: uppercase; letter-spacing: 0.08em;
}
.pub-read-more:hover {
  color: var(--teal2); 
  text-decoration: underline;
}
.pub-authors { font-size: 13px; color: var(--slate); margin-bottom: 4px; }
.pub-journal {
  font-size: 12px; font-style: italic; color: var(--gold2); font-weight: 500;
}

/* FACILITIES */
.facilities-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
  margin-top: 4rem; align-items: start; /* Prevents neighboring cards from stretching */
}
.facility-card {
  background: #fff; 
  border: 1px solid var(--border);
  padding: 0 0 1.5rem; 
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer; 
  display: flex; 
  flex-direction: column;
}
.facility-card:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 12px 32px rgba(0,0,0,0.08); 
}

/* Updated to handle actual photographs perfectly */
.facility-img {
  height: 200px; 
  width: 100%;
  object-fit: cover; /* Prevents photos from squishing */
  display: block;
  border-bottom: 1px solid var(--border);
}

.facility-body { 
  padding: 1.5rem 1.5rem 0; 
}
.facility-title {
  font-size: 18px; font-weight: 700; color: var(--ink);
  line-height: 1.35; 
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.facility-title::after {
  content: '+';
  font-size: 24px; font-weight: 300; color: var(--teal);
  transition: transform 0.3s ease;
  line-height: 1;
}
.facility-card.expanded .facility-title::after {
  transform: rotate(45deg);
}
.facility-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
  font-size: 14px; color: var(--slate); line-height: 1.7;
}
.facility-card.expanded .facility-content {
  max-height: 600px; 
  opacity: 1;
  margin-top: 1rem;
}

/* CONTACT PAGE */
.contact-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 120px 20px 8rem;
}
.contact-header {
  margin-bottom: 4rem;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr; /* Starts as 1 column for Mobile */
  gap: 2rem;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr; /* Switches to 2 columns on Desktop */
  }
}

.contact-card {
  background: #fff;
  border: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.contact-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}
.contact-icon {
  width: 64px;
  height: 64px;
  background: var(--mist);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--gold); /* Ashoka Red Icons */
}
.contact-icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.5px;
}
.contact-card-content h3 {
  font-family: 'Merriweather', serif;
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.contact-card-content p {
  color: var(--slate);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}
.contact-card-content a {
  color: var(--teal2); /* Ashoka Blue links */
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}
.contact-card-content a:hover {
  text-decoration: underline;
}
.contact-card-content .sub-text {
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* FOOTER */
footer {
  background: #080808; 
  padding: 2rem 8vw;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #1a1a1a;
}
.footer-logo {
  font-size: 15px;
  color: #d5cfc4; /* Lightened up so it's easy to read */
  font-weight: 700;
}
/* The Ashoka University Link - Base & Visited States */
.footer-logo .ashoka-link,
.footer-logo .ashoka-link:visited { 
  color: var(--gold); /* Forces Ashoka Red even if you've visited the site before */
  text-decoration: none;
  transition: color 0.2s;
}

/* The Ashoka University Link - Hover & Clicking States */
.footer-logo .ashoka-link:hover,
.footer-logo .ashoka-link:active,
.footer-logo .ashoka-link:focus {
  color: var(--teal2); /* Forces Ashoka Blue when hovering or actively clicking */
  text-decoration: underline;
}
/* Brighter Copyright Text */
.footer-copy { 
  font-size: 12px; 
  color: #b0a89f; /* Brightened up significantly for visibility */
}

/* Social Links Layout */
.footer-links { 
  display: flex; gap: 1.5rem; 
}

/* Social Links Base & Visited States (Kills the Purple/Blue) */
.footer-links a,
.footer-links a:visited { 
  font-size: 15px;       /* Matched to Soft Matter Lab size */
  color: #d5cfc4;        /* Matched to Soft Matter Lab color */
  font-weight: 700;      /* Matched to Soft Matter Lab boldness */
  text-decoration: none; 
  transition: color 0.2s;
}

/* Social Links Hover & Clicking States */
.footer-links a:hover,
.footer-links a:active,
.footer-links a:focus { 
  color: var(--teal2); /* Ashoka Blue on hover */
  text-decoration: underline; 
}

/*GALLERY CAROUSEL */
.gallery-strip {
  padding: 6rem 0 2rem 0; 
  background: #fff;
  border-top: 1px solid var(--border);
}
.gallery-header {
  padding: 0 8vw;
  margin-bottom: 3rem;
}
.gallery-track {
  display: flex;
  gap: 1.5rem;
  padding: 0 8vw 2rem 8vw; /* Padding matches the page margins */
  overflow-x: auto;
  scroll-snap-type: x mandatory; /* Smooth snapping behavior */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hides scrollbar in Firefox */
}
.gallery-track::-webkit-scrollbar {
  display: none; /* Hides scrollbar in Chrome/Safari */
}
.gallery-item {
  flex: 0 0 320px; /* Fixed width of 320px per image */
  height: 320px;
  scroll-snap-align: start;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mist);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Updated to include cursor: pointer for the modal */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  cursor: pointer; 
}
.gallery-item:hover img {
  transform: scale(1.05); /* Your original hover zoom */
}

@media (max-width: 900px) {
  .gallery-item {
    flex: 0 0 260px; /* Slightly smaller squares on mobile */
    height: 260px;
  }
}

/* The Dark Background Overlay */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 2000; /* Stays on top of everything */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85); /* 85% opacity black */
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* The Active State (Fades in) */
.modal-overlay.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

/* The Expanded Image */
.modal-content {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.5);
}

/* The Caption Text */
#modal-caption {
  margin-top: 15px;
  color: #ffffff;
  font-family: 'Inter', sans-serif; /* Matches your header imports */
  font-size: 1.1rem;
  font-weight: 300;
  text-align: center;
  max-width: 80vw;
  line-height: 1.5;
}

/* The Close Button (X) */
.modal-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 45px;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: #aaaaaa;
}

@media (max-width: 900px) {
  .gallery-item {
    flex: 0 0 260px; /* Slightly smaller squares on mobile */
    height: 260px;
  }
}

/* MOBILE RESPONSIVE */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-right { display: none; }
  .research-grid { grid-template-columns: 1fr 1fr; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .facilities-grid { grid-template-columns: 1fr; }
  .research-header, .people-header, .about-strip, #contact { grid-template-columns: 1fr; gap: 2rem; }

  .hamburger {
    display: flex; 
  }
  
  .nav-links {
    position: absolute;
    top: 100%; 
    left: 0;
    width: 100%;
    background: rgba(244, 241, 235, 0.98);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    gap: 1.5rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.35s ease-out;
  }
  
  .nav-links.active {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }

  .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  footer {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 3rem 4vw;
  }
  .footer-links {
    justify-content: center;
  }
}
/* SMARTPHONE RESPONSIVE FIXES */
@media (max-width: 600px) {
  .team-grid { 
    grid-template-columns: 1fr; /* Forces 1 column on phones */
  }
  .research-grid { 
    grid-template-columns: 1fr; /* Forces 1 column on phones */
  }
}
