/* =========================================================
   CoBe Lab — The Laboratory for Collective Behavior
   University of Chicago
   ---------------------------------------------------------
   Identity notes:
   - Logo pairs a heavy sans "CoBe" (ink) with an italic
     serif "Lab" (maroon), crowned by a spider web. The web
     is the lab's science made visible: nodes, edges, and
     emergent structure. It is the site's one signature.
   - Restraint elsewhere: clean white, generous space,
     maroon used only for accents, links, and rules.
   ========================================================= */

:root {
  --ink: #1b1a19;
  --ink-soft: #4c4744;
  --ink-faint: #8a827d;

  --maroon: #6e1423;        /* echoes the logo "Lab" */
  --maroon-deep: #4d0d18;
  --maroon-tint: #f5eaeb;   /* faint band / hover wash  */

  --paper: #ffffff;
  --paper-warm: #faf7f5;    /* subtle band, deliberately not cream */
  --line: #e8e2de;
  --web: rgba(110, 20, 35, 0.16);  /* network strokes */

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --maxw: 1120px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

img { max-width: 100%; display: block; }
a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--maroon); color: #fff; padding: .6rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Top university strip ---------- */
.uni {
  background: var(--maroon-deep);
  color: #f4e6e8;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.uni .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .55rem; }
.uni a { color: #f4e6e8; }
.uni span { font-weight: 600; }
.uni .uni-side { color: #d9b9bd; letter-spacing: .12em; }

/* ---------- Masthead / nav ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 78px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 46px; width: auto; }

.nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.4rem); }
.nav a {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: .98rem;
  padding: .3rem 0;
  position: relative;
}
.nav a:hover { color: var(--maroon); text-decoration: none; }
.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(--maroon);
}

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 0; color: var(--ink);
}
.nav-toggle svg { display: block; margin: auto; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1rem;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .nav[data-open="true"] { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { width: 100%; padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .nav a[aria-current="page"]::after { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-net { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero .wrap { position: relative; padding-block: clamp(3.5rem, 9vw, 7rem); }
.eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--maroon); margin: 0 0 1.1rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  line-height: .92;
  font-size: clamp(3.4rem, 11vw, 7rem);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.wordmark em {
  font-style: italic;
  color: var(--maroon);
  font-weight: 500;
}
.hero-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  color: var(--ink-soft);
  max-width: 36ch;
  margin: 1.6rem 0 0;
  line-height: 1.45;
}

/* page hero (inner pages) */
.page-head { position: relative; border-bottom: 1px solid var(--line); background: var(--paper-warm); overflow: hidden; }
.page-head .wrap { padding-block: clamp(2.6rem, 6vw, 4.5rem); position: relative; }
.page-head .corner-web { position: absolute; top: 0; right: 0; width: 220px; height: 220px; opacity: 1; pointer-events: none; }
.page-head .corner-web g { stroke: rgba(76, 4, 16, 0.83); }
.page-title { font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.2rem); margin: .5rem 0 0; letter-spacing: -0.01em; }
.page-lede { max-width: 60ch; margin: 1rem 0 0; color: var(--ink-soft); font-size: 1.1rem; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section.band { background: var(--paper-warm); border-block: 1px solid var(--line); }
.kicker {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--maroon); margin: 0 0 .9rem;
}
.h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 1.2rem; }
.h3 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; margin: 0 0 .5rem; }
.lead { font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 1.6; color: var(--ink); max-width: 64ch; }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 1.1rem; color: var(--ink-soft); }
.prose p strong, .prose strong { color: var(--ink); }

.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.5fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 1.4rem; } }

/* ---------- Project paths ---------- */
.paths { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 2rem; }
.path {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; padding: clamp(1.5rem, 3vw, 2.2rem);
  display: grid; grid-template-columns: 56px 1fr; gap: 1.4rem;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.path:hover { border-color: var(--maroon); box-shadow: 0 14px 40px -22px rgba(110,20,35,.45); transform: translateY(-2px); }
.path .glyph { width: 56px; height: 56px; color: var(--maroon); }
.path h3 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin: .1rem 0 .6rem; color: var(--ink); }
.path p { margin: 0 0 .9rem; color: var(--ink-soft); }
.path p:last-child { margin-bottom: 0; }
.stakes {
  border-left: 3px solid var(--maroon); padding: .15rem 0 .15rem 1rem;
  font-style: italic; color: var(--ink-soft);
}
.stakes b { font-style: normal; color: var(--maroon); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .76rem; display: block; margin-bottom: .2rem; }
@media (max-width: 560px) { .path { grid-template-columns: 1fr; gap: .9rem; } .path .glyph { width: 48px; height: 48px; } }

/* ---------- PI / people ---------- */
.pi { display: grid; grid-template-columns: minmax(0, 320px) minmax(0,1fr); gap: clamp(1.6rem,4vw,3rem); align-items: start; }
@media (max-width: 760px) { .pi { grid-template-columns: 1fr; } }
.pi-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-warm); padding: 1.6rem;
}
.pi-card .role { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--maroon); font-weight: 600; }
.pi-card .name { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; margin: .35rem 0 .1rem; line-height: 1.1; }
.pi-card .title { color: var(--ink-soft); margin: 0 0 1rem; font-size: .98rem; }
.pi-card ul { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.pi-card li { padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; display: flex; justify-content: space-between; gap: 1rem; }
.pi-card li span { color: var(--ink-faint); }

.invite {
  margin-top: 2.5rem; border: 1px dashed var(--maroon); border-radius: var(--radius);
  background: var(--maroon-tint); padding: clamp(1.4rem, 3vw, 2rem);
}
.invite .h3 { color: var(--maroon-deep); }
.invite p { color: var(--ink-soft); margin: 0; max-width: 90ch; }

/* ---------- Join page bits ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.4rem, 4vw, 3rem); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.chips li {
  border: 1px solid var(--line); border-radius: 999px;
  padding: .4rem .85rem; font-size: .86rem; color: var(--ink-soft);
  background: #fff;
}

.checklist { list-style: none; margin: 1rem 0 0; padding: 0; }
.checklist li { position: relative; padding: .35rem 0 .35rem 1.8rem; color: var(--ink-soft); }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: .85rem;
  width: 8px; height: 8px; background: var(--maroon); border-radius: 50%;
}

.materials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
@media (max-width: 640px) { .materials { grid-template-columns: 1fr; } }
.mat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem;
  background: #fff;
}
.mat .num { font-family: var(--serif); font-style: italic; color: var(--maroon); font-size: 1.1rem; }
.mat h4 { margin: .3rem 0 .3rem; font-size: 1.05rem; }
.mat p { margin: 0; font-size: .92rem; color: var(--ink-soft); }

.deadline {
  margin-top: 2.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem;
  background: var(--maroon); color: #fff; border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 1.9rem) clamp(1.5rem, 4vw, 2.4rem);
}
.deadline .when { font-family: var(--serif); font-style: italic; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1; }
.deadline .what { color: #f1d9dc; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; }
.deadline p { margin: 0; color: #f6e7e9; max-width: 42ch; font-size: .95rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: clamp(2rem,5vw,4rem); }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-block { font-size: 1.05rem; }
.contact-block .label { font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--maroon); font-weight: 600; margin: 0 0 .2rem; }
.contact-block p { margin: 0 0 1.3rem; color: var(--ink-soft); }
.contact-block .name { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); font-weight: 600; }

/* ---------- Footer ---------- */
.site-foot { background: var(--ink); color: #cfc9c6; margin-top: 0; }
.site-foot .wrap { padding-block: clamp(2.5rem, 5vw, 3.5rem); display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .site-foot .wrap { grid-template-columns: 1fr; gap: 1.5rem; } }
.site-foot h5 { color: #fff; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .8rem; font-weight: 600; }
.site-foot a { color: #e7bdc2; }
.site-foot a:hover { color: #fff; }
.foot-mark { font-family: var(--serif); font-size: 1.6rem; color: #fff; line-height: 1; }
.foot-mark em { font-style: italic; color: #e7bdc2; }
.foot-note { color: #8d8682; font-size: .85rem; margin-top: .8rem; }
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links li { margin-bottom: .5rem; }
.foot-bottom { border-top: 1px solid #2e2c2a; }
.foot-bottom .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-block: 1.1rem; font-size: .82rem; color: #8d8682; }

/* ---------- Entrance animation (progressive enhancement) ----------
   Hidden only when JS is present; without JS, content shows normally. */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

/* network draw-in */
.hero-net .edge { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s var(--ease) forwards; }
.hero-net .node { transform-box: fill-box; transform-origin: center; opacity: 0; animation: pop .5s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .hero-net .edge, .hero-net .node { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .js .reveal { opacity: 1; transform: none; }
}
