/* ==========================================================================
   FNML — Fish Nutrition & Metabolism Lab
   Design tokens
   ========================================================================== */

:root {
  /* Color — Deep Water palette */
  --navy-deep:   #0E2A38;   /* primary dark - depth of water */
  --navy-mid:    #163C4E;
  --teal:        #2F6F62;   /* secondary */
  --coral:       #C98A3A;   /* accent - ochre, echoes fin colouring */
  --coral-soft:  #DDAE73;
  --cream:       #F0F4F1;   /* background */
  --cream-dim:   #E4E9E3;
  --ink:         #16242A;   /* body text */
  --ink-soft:    #4E5F60;
  --line:        rgba(14, 42, 56, 0.12);
  --white:       #FFFFFF;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --max-w: 1180px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--navy-deep);
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }

p { margin: 0 0 1em; color: var(--ink-soft); }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: inline-block;
  margin-bottom: 1rem;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240, 244, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.site-header.header-overlay {
  position: absolute;
  width: 100%;
  background: transparent;
  border-bottom: 1px solid transparent;
  backdrop-filter: none;
}
.site-header.header-overlay .wordmark svg path { stroke: #F0F4F1 !important; }
.site-header.header-overlay .wordmark svg circle { fill: #F0F4F1 !important; }
.site-header.header-overlay nav.primary-nav a { color: rgba(240,244,241,0.82); }
.site-header.header-overlay nav.primary-nav a:hover,
.site-header.header-overlay nav.primary-nav a.active { color: #F0F4F1; }
.site-header.header-overlay .nav-toggle span { background: #F0F4F1; }

.site-header.header-overlay.is-scrolled {
  position: fixed;
  background: rgba(240, 244, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header.header-overlay.is-scrolled .wordmark svg path:first-of-type { stroke: #C98A3A !important; }
.site-header.header-overlay.is-scrolled .wordmark svg path:last-of-type { stroke: #0E2A38 !important; }
.site-header.header-overlay.is-scrolled .wordmark svg circle { fill: #0E2A38 !important; }
.site-header.header-overlay.is-scrolled nav.primary-nav a { color: var(--ink-soft); }
.site-header.header-overlay.is-scrolled nav.primary-nav a:hover,
.site-header.header-overlay.is-scrolled nav.primary-nav a.active { color: var(--navy-deep); }
.site-header.header-overlay.is-scrolled .nav-toggle span { background: var(--navy-deep); }

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  max-width: var(--max-w);
  margin: 0 auto;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy-deep);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark svg { display: block; }

nav.primary-nav ul {
  list-style: none;
  display: flex;
  gap: clamp(14px, 2vw, 30px);
  margin: 0;
  padding: 0;
}

nav.primary-nav a {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
nav.primary-nav a:hover,
nav.primary-nav a.active { color: var(--navy-deep); }
nav.primary-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--coral);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy-deep);
  margin: 5px 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--navy-deep);
  color: var(--white);
}
.btn-primary:hover { background: var(--teal); }
.btn-outline {
  border-color: var(--line);
  color: var(--navy-deep);
}
.btn-outline:hover { border-color: var(--navy-deep); }
.btn-outline-light {
  border: 1px solid rgba(246,243,236,0.4);
  color: var(--cream);
}
.btn-outline-light:hover { border-color: var(--cream); background: rgba(246,243,236,0.08); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(64px, 12vh, 130px) 0 clamp(48px, 8vh, 90px);
  overflow: hidden;
  background: var(--navy-deep);
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(14,42,56,0.5) 0%, rgba(14,42,56,0.3) 45%, rgba(14,42,56,0.62) 100%);
}

.hero-flow {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}
.hero-flow path {
  stroke-dasharray: 6 10;
  animation: flow-move 14s linear infinite;
}
.hero-flow path#flowB { animation-duration: 18s; animation-direction: reverse; }
.hero-flow path#flowC { animation-duration: 22s; }
@keyframes flow-move {
  to { stroke-dashoffset: -320; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-flow path { animation: none; }
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 780px;
}

.hero h1 { color: var(--cream); }
.hero .eyebrow { margin-bottom: 1.2rem; }

.hero p.lede {
  font-size: 1.15rem;
  max-width: 620px;
  color: rgba(246,243,236,0.82);
}

.hero-inner-simple {
  width: 100%;
  text-align: left;
  max-width: none;
}
.hero-lab-name {
  color: var(--cream);
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 500;
}
.hero-univ-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246,243,236,0.75);
  margin: 0;
}

.hero-cta { display: flex; gap: 14px; margin-top: 1.8rem; flex-wrap: wrap; }

/* ---------- Section shell ---------- */
section { padding: clamp(50px, 9vh, 100px) 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.6rem;
}
.section-head p { margin: 0; max-width: 420px; }

.bg-navy { background: var(--navy-mid); color: var(--cream); }
.bg-navy h2, .bg-navy h3 { color: var(--cream); }
.bg-navy p { color: rgba(240,244,241,0.78); }
.bg-navy .section-head { border-color: rgba(240,244,241,0.16); }

/* ---------- Research cards ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.research-card {
  background: var(--cream);
  padding: 2rem 1.8rem;
  transition: background 0.2s ease;
}
.research-card:hover { background: var(--white); }
.research-card .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--teal);
  margin-bottom: 1rem;
  display: block;
}
.research-card h3 { margin-bottom: 0.6rem; }
.research-card p { font-size: 0.92rem; margin: 0; }

/* ---------- Research cards with photos (home page) ---------- */
.research-grid-media {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.6rem 2rem;
}
.research-card-media {
  flex: 0 1 280px;
  max-width: 300px;
}
.rcm-photo {
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--cream-dim);
}
.rcm-photo img { width: 100%; height: 100%; object-fit: cover; }
.research-card-media .num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal);
  display: block;
  margin-bottom: 0.4rem;
}
.research-card-media h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.research-card-media p { font-size: 0.88rem; margin: 0; color: var(--ink-soft); }

/* ---------- News list (home teaser) ---------- */
.news-teaser-list { display: flex; flex-direction: column; }
.news-teaser-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.news-teaser-item .date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.news-teaser-item p { margin: 0; color: var(--ink); font-size: 0.95rem; }
.news-teaser-footer { margin-top: 1.6rem; }

/* ---------- Cards generic ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.member-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 1.4rem;
}
.member-card .photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--cream-dim);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.member-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.member-card h3 { margin-bottom: 0.15rem; font-size: 1.05rem; }
.member-card .role {
  font-size: 0.8rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.member-card .email { font-size: 0.82rem; color: var(--ink-soft); }

.member-card.pi {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 2rem;
}
.member-card.pi .photo { aspect-ratio: auto; height: 220px; margin-bottom: 0; }
@media (max-width: 640px) {
  .member-card.pi { grid-template-columns: 1fr; }
}

/* ---------- Publications ---------- */
.pub-year-block { margin-bottom: 2.4rem; }
.pub-year-block h3 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-bottom: 1.2rem;
}
.pub-item {
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.94rem;
  color: var(--ink);
  display: flex;
  gap: 14px;
}
.pub-item .marker { color: var(--teal); flex-shrink: 0; }
.pub-item .authors { font-weight: 600; }
.pub-item .journal { font-style: italic; color: var(--ink-soft); }

/* ---------- Gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.gallery-grid figure {
  margin: 0;
  aspect-ratio: 4/3;
  background: var(--cream-dim);
  overflow: hidden;
  border-radius: var(--radius);
}
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
/* ---------- Gallery: 2-column cards with swipeable carousels ---------- */
.gallery-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.6rem 2rem;
}
.gallery-card { display: flex; flex-direction: column; }
.gc-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 6px;
  background: var(--cream-dim);
  scrollbar-width: none;
}
.gc-carousel::-webkit-scrollbar { display: none; }
.gc-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4/3;
}
.gc-carousel.multi .gc-slide { flex: 0 0 100%; }
.gc-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gc-text { padding-top: 0.9rem; }
.gc-text h3 { font-size: 1rem; margin-bottom: 0.35rem; line-height: 1.4; }
.ge-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--teal);
}

.gc-carousel-wrap { position: relative; }
.gc-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(14,42,56,0.55);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s ease;
}
.gc-nav:hover { background: rgba(14,42,56,0.8); }
.gc-nav-prev { left: 10px; }
.gc-nav-next { right: 10px; }

@media (max-width: 700px) {
  .gallery-grid-2col { grid-template-columns: 1fr; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.contact-block .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: 0.5rem;
}
.contact-block .value { font-size: 1.05rem; color: var(--navy-deep); font-weight: 500; }

/* ---------- Philosophy quote block ---------- */
.quote-block {
  border-left: 3px solid var(--coral);
  padding-left: 1.6rem;
  margin: 2rem 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--navy-deep);
  font-style: italic;
}

/* ---------- Footer ---------- */
footer.site-footer {
  background: var(--navy-deep);
  color: rgba(246,243,236,0.6);
  padding: 40px 0;
  font-size: 0.85rem;
}
footer.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Utility ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 780px) {
  .two-col { grid-template-columns: 1fr; }
}

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--ink);
}

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
}

/* ---------- Responsive nav ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  nav.primary-nav {
    position: fixed;
    inset: 64px 0 0 0;
    background: var(--cream);
    transform: translateY(-110%);
    transition: transform 0.3s ease;
    padding: 20px var(--gutter);
    overflow-y: auto;
  }
  nav.primary-nav.open { transform: translateY(0); }
  nav.primary-nav ul { flex-direction: column; gap: 4px; }
  nav.primary-nav a { display: block; padding: 14px 0; font-size: 1.05rem; }

  /* The open mobile panel always has a cream background, even when the
     header is in its transparent hero-overlay state — so its links must
     always use the dark link colors, not the light overlay colors. */
  .site-header.header-overlay nav.primary-nav.open a { color: var(--ink-soft); }
  .site-header.header-overlay nav.primary-nav.open a:hover,
  .site-header.header-overlay nav.primary-nav.open a.active { color: var(--navy-deep); }

  .member-card.pi { grid-template-columns: 1fr; }
  .news-teaser-item { grid-template-columns: 100px 1fr; }
}
