/* UCSC Ellis Power Group — Power Electronics Lab */
:root {
  --blue: #003C6C;
  --blue-dark: #002848;
  --gold: #FDC700;
  --gold-dark: #e0b000;
  --white: #ffffff;
  --off-white: #f5f7fa;
  --gray-light: #e8ecf0;
  --gray: #6b7a8d;
  --text: #1a2332;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
}

/* ── Navbar ── */
nav {
  background: var(--blue);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
}

.nav-brand .lab-name {
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.nav-brand .lab-sub {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  color: var(--white);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.1);
  border-bottom-color: var(--gold);
}

.nav-links a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  margin: 5px 0;
  transition: transform 0.2s;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #005a9e 100%);
  color: var(--white);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold);
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  max-width: 720px;
  margin: 0 auto 0.75rem;
}

.hero h1 span {
  color: var(--gold);
}

.hero .subtitle {
  font-size: 1.15rem;
  opacity: 0.88;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero .ucsc-tag {
  display: inline-block;
  background: rgba(253, 199, 0, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  margin-bottom: 1.2rem;
}

/* ── Sections ── */
.section {
  padding: 4rem 1.5rem;
}

.section-alt {
  background: var(--off-white);
}

.section-tight {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.4rem;
}

.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--gold);
  margin-top: 0.5rem;
  border-radius: 2px;
}

.section-lead {
  color: var(--gray);
  font-size: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 2.5rem;
  max-width: 680px;
}

/* ── Cards ── */
.card-grid {
  display: grid;
  gap: 1.5rem;
}

.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
}

.research-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* ── People Cards ── */
.person-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--gray);
}

.person-img.placeholder {
  height: 220px;
  background: linear-gradient(135deg, var(--gray-light), #d0d8e0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.person-img.placeholder::after {
  content: '👤';
  font-size: 3.5rem;
  opacity: 0.4;
}

.person-body {
  padding: 1.25rem;
}

.person-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.2rem;
}

.person-role {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.person-bio {
  font-size: 0.88rem;
  color: var(--gray);
  line-height: 1.55;
}

/* PI card — spans full width */
.pi-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  gap: 2rem;
  align-items: flex-start;
}

.pi-card .person-img.placeholder {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  border-radius: 8px;
}

.pi-card .person-body {
  padding: 1.5rem 1.5rem 1.5rem 0;
}

.pi-card .person-name { font-size: 1.4rem; }

/* ── Research Cards ── */
.research-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #fff;
}

.research-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #002848, var(--blue));
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.research-body {
  padding: 1.25rem;
}

.research-body .btn {
  margin-top: auto;
  align-self: flex-start;
}

.research-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.research-desc {
  font-size: 0.87rem;
  color: var(--gray);
  margin-bottom: 1rem;
  line-height: 1.55;
}

#news-section .research-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-blue {
  background: var(--blue);
  color: var(--white);
}

.btn-blue:hover {
  background: var(--blue-dark);
}

.btn-outline {
  border: 2px solid var(--blue);
  color: var(--blue);
  background: transparent;
}

.btn-outline:hover {
  background: var(--blue);
  color: var(--white);
}

/* ── Contact Page ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact-info h3 {
  font-size: 1.2rem;
  color: var(--blue);
  margin-bottom: 1rem;
}

.contact-item {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}

.contact-icon {
  font-size: 1.2rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.contact-item p {
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.5;
}

.contact-item a {
  color: var(--blue);
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

.apply-box {
  background: var(--blue);
  color: var(--white);
  border-radius: 10px;
  padding: 2rem;
}

.apply-box h3 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  color: var(--gold);
}

.apply-box p {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.btn-gold {
  background: var(--gold);
  color: var(--blue-dark);
  font-weight: 700;
}

.btn-gold:hover {
  background: var(--gold-dark);
}

/* ── Highlights (home) ── */
.highlight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.highlight-item {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--gray-light);
}

.highlight-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--blue);
  display: block;
}

.highlight-label {
  font-size: 0.85rem;
  color: var(--gray);
  font-weight: 500;
}

/* ── Footer ── */
footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
}

footer a {
  color: var(--gold);
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

footer .footer-top {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.4rem;
}

.footer-logo {
  height: 48px;
  width: auto;
  opacity: 0.9;
  margin-bottom: 0.75rem;
}

/* ── About layout ── */
.about-layout {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.about-text {
  flex: 1;
}

.about-logo {
  flex-shrink: 0;
}

.about-logo img {
  width: 220px;
  height: auto;
}

/* ── Group dividers ── */
.people-group-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 0.4rem;
  margin: 2.5rem 0 1.25rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--blue-dark); padding: 1rem; gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 1rem; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
  .nav-toggle { display: block; }

  .hero h1 { font-size: 1.8rem; }
  .about-layout { flex-direction: column; }
  .about-logo img { width: 160px; }
  .pi-card { flex-direction: column; }
  .pi-card .person-img.placeholder { width: 100%; }
  .contact-grid { grid-template-columns: 1fr; }
}

/* ── News Carousel ── */
.carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.carousel-track-container {
  overflow: hidden;
  flex: 1;
}

.carousel-track {
  display: flex;
  gap: 1.5rem;
  transition: transform 0.4s ease;
}

.carousel-track .card {
  flex: 0 0 calc(33.333% - 1rem);
  min-width: 0;
}

@media (max-width: 1023px) {
  .carousel-track .card { flex: 0 0 calc(50% - 0.75rem); }
}

@media (max-width: 639px) {
  .carousel-track .card { flex: 0 0 100%; }
}

.carousel-btn {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.carousel-btn:hover { background: var(--blue-dark); }
.carousel-btn:disabled { background: var(--gray-light); cursor: default; }

/* ── News Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  max-width: 620px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
}

.modal-close:hover {
  color: var(--blue);
}
