/* =========================================================================
   Lang Lab — shared stylesheet
   Design system lives at the top. Want a different look? Most of it can be
   changed by editing the tokens in :root below (colors, fonts, spacing).
   ========================================================================= */

:root {
  /* ---- Palette ---------------------------------------------------------
     Grounded in two-channel fluorescence microscopy: a cool "assay blue"
     (DNA stain) for structure, plus a magenta + cyan channel pair used only
     in the signature merge motif. */
  --paper:      #F5F6F8;  /* page background, cool off-white */
  --card:       #FFFFFF;  /* raised surfaces */
  --ink:        #131A24;  /* primary text, cool near-black */
  --slate:      #586273;  /* secondary text */
  --slate-2:    #8A93A1;  /* tertiary / captions */
  --line:       #E4E7EC;  /* hairline borders */
  --accent:     #1957A8;  /* assay blue — links, active states */
  --accent-ink: #0F3E7D;  /* darker accent for hover */
  --chan-mag:   #E0468A;  /* fluorescence channel A */
  --chan-cyan:  #21B4AC;  /* fluorescence channel B */
  --field:      #0B0F16;  /* dark microscope-field chip */

  /* ---- Type ------------------------------------------------------------ */
  --display: "Archivo Expanded", "Archivo", system-ui, sans-serif;
  --sans:    "Archivo", system-ui, -apple-system, sans-serif;
  --serif:   "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  /* ---- Rhythm ----------------------------------------------------------- */
  --measure: 68ch;
  --gap: clamp(1.5rem, 4vw, 3rem);
  --pad-x: clamp(1.25rem, 5vw, 5rem);
  --radius: 4px;
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; line-height: 1.04; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 1rem; max-width: var(--measure); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; display: block; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 0.9rem;
}

/* ---- Layout shell -------------------------------------------------------- */
.wrap { width: min(1180px, 100%); margin-inline: auto; padding-inline: var(--pad-x); }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section + .section { border-top: 1px solid var(--line); }

/* ---- Header / nav -------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .mark { width: 22px; height: 22px; flex: none; }
.brand .name { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand .name span { color: var(--accent); }

.nav { display: flex; align-items: center; gap: clamp(0.4rem, 2vw, 1.6rem); }
.nav a {
  font-family: var(--sans); font-weight: 500; font-size: 0.92rem;
  color: var(--slate); text-decoration: none; padding: 0.4rem 0.2rem; position: relative;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--accent);
}
.nav-toggle { display: none; }

/* ---- Hero ---------------------------------------------------------------- */
.hero { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3.5rem, 8vw, 6rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 1.4rem + 4vw, 4.1rem);
  letter-spacing: -0.025em;
  margin-bottom: 1.3rem;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: clamp(1.1rem, 1.02rem + 0.5vw, 1.3rem); color: var(--slate); max-width: 46ch; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }

/* ---- Microscope-field signature ----------------------------------------- */
.field {
  position: relative; aspect-ratio: 1 / 1; width: 100%; max-width: 380px; margin-inline: auto;
  background: var(--field); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 24px 50px -28px rgba(11,15,22,0.55);
  border: 1px solid #1d2530;
}
.field .chan { position: absolute; inset: 0; mix-blend-mode: screen; filter: blur(2px); }
.field .chan::before, .field .chan::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(14px);
}
.field .chan.a::before { width: 52%; height: 52%; left: 16%; top: 20%; background: var(--chan-mag); animation: drift-a 14s ease-in-out infinite; }
.field .chan.a::after  { width: 30%; height: 30%; left: 48%; top: 52%; background: var(--chan-mag); opacity: 0.8; animation: drift-a 18s ease-in-out infinite reverse; }
.field .chan.b::before { width: 50%; height: 50%; left: 40%; top: 30%; background: var(--chan-cyan); animation: drift-b 16s ease-in-out infinite; }
.field .chan.b::after  { width: 26%; height: 26%; left: 22%; top: 50%; background: var(--chan-cyan); opacity: 0.85; animation: drift-b 20s ease-in-out infinite reverse; }
.field .grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.field .scalebar {
  position: absolute; left: 16px; bottom: 14px; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; color: rgba(255,255,255,0.7);
}
.field .scalebar i { display: block; width: 40px; height: 3px; background: rgba(255,255,255,0.8); }
.field .tag {
  position: absolute; right: 14px; top: 12px;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.6);
}
@keyframes drift-a { 0%,100% { transform: translate(0,0); } 50% { transform: translate(8%, -6%); } }
@keyframes drift-b { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-7%, 7%); } }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 0.95rem;
  padding: 0.7rem 1.15rem; border-radius: var(--radius);
  text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ---- Section headings ---------------------------------------------------- */
.sec-head { margin-bottom: clamp(1.8rem, 4vw, 2.6rem); }
.sec-head h2 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem); }
.sec-head p { color: var(--slate); margin-top: 0.7rem; }

/* ---- Research approach cards --------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card { background: var(--card); padding: clamp(1.4rem, 3vw, 2rem); }
.card .num { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; color: var(--chan-mag); }
.card h3 { font-family: var(--sans); font-weight: 700; font-size: 1.18rem; margin: 0.6rem 0 0.5rem; letter-spacing: -0.01em; }
.card p { font-size: 0.96rem; color: var(--slate); margin: 0; }

/* ---- Approach chips ------------------------------------------------------ */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; }
.chip { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 100px; padding: 0.4rem 0.85rem; }

/* ---- People grid --------------------------------------------------------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: clamp(1.2rem, 3vw, 2rem); }
.person .photo {
  aspect-ratio: 4 / 5; background: linear-gradient(135deg, #e9edf2, #dde3ea);
  border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden;
  display: flex; align-items: flex-end; justify-content: flex-start;
}
.person .photo img { width: 100%; height: 100%; object-fit: cover; }
.person .photo .ph { font-family: var(--mono); font-size: 0.62rem; color: var(--slate-2); padding: 0.6rem; letter-spacing: 0.08em; }
.person h3 { font-family: var(--sans); font-weight: 700; font-size: 1.08rem; margin: 0.85rem 0 0.15rem; letter-spacing: -0.01em; }
.person .role { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.person p { font-size: 0.9rem; color: var(--slate); margin: 0.55rem 0 0.5rem; }
.person .links { display: flex; gap: 0.8rem; font-family: var(--sans); font-size: 0.82rem; font-weight: 500; }
.email { cursor: pointer; }
.person.lead { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .person.lead { display: grid; grid-template-columns: 230px 1fr; gap: 2rem; align-items: start; }
  .person.lead > div:last-child { padding-top: 0.3rem; }
  .person.lead h3 { font-size: 1.5rem; margin-top: 0; }
  .person.lead p { font-size: 1rem; max-width: 60ch; }
}

/* ---- Publications -------------------------------------------------------- */
.pub-year { display: flex; align-items: baseline; gap: 1rem; margin: 2.4rem 0 1rem; }
.pub-year:first-of-type { margin-top: 0; }
.pub-year h3 { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; color: var(--ink); letter-spacing: 0.02em; }
.pub-year .rule { flex: 1; height: 1px; background: var(--line); }
.pub { padding: 1rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 1rem; }
.pub .idx { font-family: var(--mono); font-size: 0.78rem; color: var(--slate-2); padding-top: 0.15rem; }
.pub .title { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0 0 0.25rem; line-height: 1.4; }
.pub .authors { font-size: 0.9rem; color: var(--slate); margin: 0 0 0.3rem; }
.pub .authors .me { color: var(--ink); font-weight: 600; }
.pub .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--slate); }
.pub .meta .journal { color: var(--accent); }
.pub .plinks { margin-top: 0.4rem; display: flex; gap: 0.8rem; font-family: var(--sans); font-size: 0.8rem; font-weight: 500; }

/* ---- Contact / prose ----------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose p { font-size: 1.05rem; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); margin-top: 2rem; }
.contact-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.contact-card .label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate); margin-bottom: 0.6rem; }
.contact-card a { font-family: var(--sans); font-weight: 500; }

/* ---- Footer -------------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--line); padding-block: 2.5rem; color: var(--slate); font-size: 0.88rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.site-foot .nav a { font-size: 0.84rem; }

/* ---- Responsive nav ------------------------------------------------------ */
@media (max-width: 680px) {
  .hero-grid { grid-template-columns: 1fr; }
  .field { order: -1; max-width: 300px; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; background: transparent; border: 1px solid var(--line);
    border-radius: var(--radius); cursor: pointer; color: var(--ink);
  }
  .nav {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--pad-x) 1.2rem; transform: translateY(-120%); transition: transform .25s ease;
    box-shadow: 0 20px 30px -24px rgba(0,0,0,0.3);
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav a { padding: 0.85rem 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
  .nav a[aria-current="page"]::after { display: none; }
  .pub { grid-template-columns: 1fr; gap: 0.3rem; }
  .pub .idx { display: none; }
}

/* ---- Research: jump list + question sections ----------------------------- */
.toc { margin-top: 1.9rem; }
.toc .toc-label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); margin-bottom: 0.85rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.toc a {
  display: inline-flex; align-items: baseline; gap: 0.6rem;
  font-family: var(--sans); font-weight: 500; font-size: 0.92rem;
  text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 100px; padding: 0.55rem 1rem;
  background: var(--card); transition: border-color .15s, color .15s, background .15s;
}
.toc a:hover, .toc a:focus-visible { border-color: var(--accent); color: var(--accent); }
.toc a .n { font-family: var(--mono); font-size: 0.74rem; color: var(--chan-mag); }

/* Each research area scrolls to sit clear of the sticky header */
.area { scroll-margin-top: 88px; }
.area .eyebrow { color: var(--accent); }

/* ---- Research figures ---------------------------------------------------- */
/* Holds one figure or many: a lone image fills the row, extra figures flow
   into an even grid automatically — no layout changes needed to add more. */
.figs { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin-top: 2.2rem; }
.fig { margin: 0; }
.fig img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.fig figcaption { font-family: var(--mono); font-size: 0.74rem; line-height: 1.55; color: var(--slate); margin-top: 0.65rem; }
.fig .ph {
  aspect-ratio: 3 / 2; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--slate-2); border-radius: var(--radius);
  background: linear-gradient(135deg, #eef1f5, #e6eaf0);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.05em; color: var(--slate); padding: 1rem;
}

/* Research areas: text left, figure(s) right, tops aligned (stacks on mobile) */
@media (min-width: 820px) {
  .area .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(2rem, 4vw, 3.5rem);
    align-items: start;
  }
  .area .sec-head { grid-column: 1; grid-row: 1; margin-bottom: 1.2rem; }
  .area .prose    { grid-column: 1; grid-row: 2; align-self: start; }
  .area .figs     { grid-column: 2; grid-row: 2; align-self: start; margin-top: 0; }
}
