/* PIE Lab — design system
   Palette drawn from the lab mark: forest green tree, teal-blue water/sky, warm gold sun.
   Typography follows UCSB brand guidelines (brand.ucsb.edu/visual-identity/typography):
   Nunito Sans is UCSB's designated substitute for Avenir/Produkt in contexts (like a
   plain-HTML site) that can't embed the licensed brand fonts. */

@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-sans-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito Sans";
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-sans-italic-variable.woff2") format("woff2");
}

:root {
  --forest-900: #10261c;
  --forest-800: #16342a;
  --forest-700: #1f4a38;
  --forest-600: #2b5f46;
  --forest-500: #3f7a56;
  --moss-400: #5c9468;

  --teal-700: #0f5468;
  --teal-600: #146b83;
  --teal-500: #1c86a3;

  --gold-500: #e0a934;
  --gold-600: #c9932a;

  --cream-50: #faf7ef;
  --cream-100: #f3ecdc;
  --cream-200: #e9dfc7;

  --ink-900: #1c2420;
  --ink-700: #3a453e;
  --ink-500: #5c675f;

  --border: #ddd2b3;
  --white: #ffffff;

  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 38, 28, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 38, 28, 0.12);
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--cream-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--forest-600); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--forest-900);
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

ul, ol { padding-left: 1.3em; }

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

/* ---------- Header ---------- */

.site-header {
  background: var(--forest-900);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cream-50);
  min-width: 0;
}
.brand:hover { color: var(--cream-50); text-decoration: none; }
.brand-text { min-width: 0; }

.brand-mark { height: 42px; width: auto; }

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--cream-200);
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  width: 40px;
  height: 36px;
  min-width: 40px;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--cream-50);
}
.nav-toggle::before { top: 11px; }
.nav-toggle span { top: 17px; }
.nav-toggle::after { top: 23px; }

.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-nav a {
  display: block;
  padding: 10px 12px;
  color: var(--cream-100);
  font-size: 0.92rem;
  border-radius: 6px;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.site-nav li.has-dropdown { position: relative; }

.site-nav .dropdown {
  display: none;
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--forest-800);
  border-radius: 8px;
  padding: 10px 6px 6px;
  margin: 0;
  min-width: 260px;
  box-shadow: var(--shadow-md);
}
.site-nav li.has-dropdown:hover .dropdown,
.site-nav li.has-dropdown:focus-within .dropdown { display: block; }
.site-nav .dropdown a { font-size: 0.88rem; white-space: normal; }

.nav-cta {
  background: var(--gold-500);
  color: var(--forest-900) !important;
  font-weight: 600;
}
.nav-cta:hover { background: var(--gold-600); }

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(160deg, var(--forest-900) 0%, var(--forest-700) 55%, var(--teal-700) 100%);
  color: var(--white);
  padding: 72px 0 88px;
}
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero h1 { color: var(--white); }
.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--gold-500);
  font-weight: 700;
  margin-bottom: 10px;
  display: block;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--cream-100);
  max-width: 46ch;
}
.hero-mark {
  justify-self: center;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 32px;
}
.hero-mark img { width: 240px; }

.page-hero {
  background: linear-gradient(160deg, var(--forest-900), var(--teal-700));
  color: var(--white);
  padding: 56px 0;
}
.page-hero h1 { color: var(--white); margin: 0; }
.page-hero p { color: var(--cream-100); max-width: 60ch; margin-top: 10px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
}
.btn-primary {
  background: var(--gold-500);
  color: var(--forest-900);
}
.btn-primary:hover { background: var(--gold-600); color: var(--forest-900); text-decoration: none; }
.btn-outline {
  border-color: rgba(255,255,255,0.55);
  color: var(--white);
}
.btn-outline:hover { background: rgba(255,255,255,0.12); color: var(--white); text-decoration: none; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.chip {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--forest-600);
  color: var(--forest-700);
  font-size: 0.85rem;
  font-weight: 600;
}
.chip:hover { background: var(--forest-600); color: var(--white); text-decoration: none; }
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 24px 0; }

/* ---------- Sections ---------- */

main { display: block; }

.section {
  padding: 56px 0;
}
.section-alt { background: var(--cream-100); }
.section-tight { padding: 36px 0; }

.section-head { max-width: 70ch; margin-bottom: 32px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

hr.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ---------- Cards / grids ---------- */

.grid {
  display: grid;
  gap: 28px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card img { width: 100%; height: 190px; object-fit: cover; }
.card h3 { margin-bottom: 6px; }
.card .meta { font-size: 0.82rem; color: var(--ink-500); margin-bottom: 8px; }

.person-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.person-card img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
}
.person-card.pi { grid-template-columns: 220px 1fr; }
.person-card.pi img { width: 220px; height: 220px; }
.person-card h3 { margin-bottom: 4px; }
.person-card .role { color: var(--teal-700); font-weight: 600; font-size: 0.88rem; margin-bottom: 10px; display: block; }

.social-row { display: flex; gap: 10px; margin-top: 14px; }
.social-row a {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--forest-800);
  color: var(--white);
  font-size: 0.85rem;
}
.social-row a:hover { background: var(--teal-600); text-decoration: none; }

.logo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  padding: 20px 0;
}
.logo-strip img { max-height: 60px; width: auto; filter: grayscale(15%); }

.media-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 32px;
}
.media-item img, .media-item iframe { border-radius: var(--radius); width: 100%; }
.media-item iframe { aspect-ratio: 16/9; height: auto; border: none; }
.media-item .media-figure { border-radius: var(--radius); overflow: hidden; }

.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.pub-list li:last-child { border-bottom: none; }
.pub-list strong { color: var(--forest-900); }

.figure { margin: 24px 0; }
.figure img { border-radius: var(--radius); }
.figure figcaption {
  font-size: 0.85rem;
  color: var(--ink-500);
  margin-top: 8px;
}

.callout {
  background: var(--forest-800);
  color: var(--cream-100);
  border-radius: var(--radius);
  padding: 28px 32px;
}
.callout h2, .callout h3 { color: var(--white); }
.callout a:not(.btn) { color: var(--gold-500); }

/* Blog */
.blog-card { display: flex; flex-direction: column; height: 100%; }
.blog-card .card-body { flex: 1; display: flex; flex-direction: column; }
.blog-card .excerpt { flex: 1; color: var(--ink-700); }
.blog-card .read-more { align-self: flex-start; font-weight: 600; }

.post-header { margin-bottom: 24px; }
.post-header .meta { color: var(--ink-500); font-size: 0.9rem; }
.post-body :is(h2, h3) { margin-top: 1.4em; }
.post-body .figure img { margin-left: auto; margin-right: auto; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--forest-900);
  color: var(--cream-200);
  padding: 40px 0 24px;
  margin-top: 64px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-mark { height: 40px; }
.footer-brand strong { color: var(--white); display: block; }
.footer-brand p { margin: 2px 0 0; font-size: 0.85rem; color: var(--cream-200); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--cream-100); font-size: 0.9rem; }
.footer-links a:hover { color: var(--white); }
.footer-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--moss-400);
  margin: 28px 0 0;
}

/* ---------- Contact form (mailto based) ---------- */

.contact-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

/* ---------- Lab guide ---------- */

.note-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 90px;
}
.note-box .note-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: rgba(28, 134, 163, 0.10);
  border-left: 4px solid var(--teal-500);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--forest-900);
  letter-spacing: -0.01em;
}
summary.note-title {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
summary.note-title::-webkit-details-marker { display: none; }
.note-box .note-title::before {
  content: "\25B8"; /* right-pointing triangle; rotates when open */
  color: var(--teal-600);
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}
.note-box[open] > .note-title::before { transform: rotate(90deg); }
summary.note-title:hover { background: rgba(28, 134, 163, 0.16); }
summary.note-title:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: -2px;
}
.note-box .note-body {
  padding: 18px 24px 4px;
  border-left: 4px solid var(--teal-500);
}
.note-box .note-body h4 {
  color: var(--teal-700);
  margin: 18px 0 6px;
}
.note-box .note-body > *:first-child { margin-top: 0; }
.note-box .note-body ul { margin-bottom: 16px; }

h3[id] { scroll-margin-top: 90px; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-mark { justify-self: start; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .media-item { grid-template-columns: 1fr; }
  .person-card, .person-card.pi { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--forest-900);
    padding: 8px 16px 16px;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .site-nav li.has-dropdown .dropdown { position: static; display: block; box-shadow: none; }
  .header-inner { position: relative; flex-wrap: nowrap; }
  .brand-mark { height: 34px; }
  .brand-name { font-size: 1rem; }
  .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .logo-strip { gap: 24px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
