/* =============================================================
   CoMPhy Lab · Homepage (v2)
   Section styles for the redesigned landing page. Lifted from
   `comphy-lab-design-system/project/CoMPhy Website v2.html`,
   adapted to the site's Jekyll data pipeline.
   Loaded only when page.url == "/".

   Structure:
     0. Homepage scaffold
     1. Hero (wordmark + sentence + meta + 4:5 rotating image + stats)
     2. "Currently working on" strip
     3. Research themes — 4 cards
     4. Section head shared pattern
     5. News feed — paper / talk / people / move / award
     6. Team preview (6 present members, link to full /team)
     7. Closing CTA
   ============================================================= */

.home-v2 { position: relative; z-index: 1; }

.home-wrap {
  width: min(100% - 2rem, var(--maxw-page));
  margin: 0 auto;
}

.home-section { padding: var(--s-9) 0; }

.home-section + .home-section { border-top: 1px solid var(--c-border); }

/* First home-section sits under the hero — its 96 px top padding
   compounds with the hero bottom breathing room and leaves a
   dead zone between the CTAs and the Currently strip. Tighten it. */
.hero + .home-section { padding-top: var(--s-6); }

/* On the homepage, neutralise the legacy .s-intro / .s-about baked
   into styles.css — homepage markup no longer uses them. */
body.home-v2 .s-intro,
body.home-v2 .s-about,
body.home-v2 #featured-wrapper { display: none; }

/* Legacy sticky header backdrop can stay; just make sure the hero
   has enough top padding to clear it. */

/* =========================================================
   1. HERO
   ========================================================= */
.hero {
  /* Legacy .s-header is position:fixed at 80 px tall — we clear
     it plus a small tasteful gap (--s-5 = 24 px) so the kicker
     breathes without feeling detached. Bottom is tight on purpose
     — next .home-section adds its own top padding. */
  padding: calc(var(--s-5) + 80px) 0 var(--s-4);
  position: relative;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: center;
}

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--s-5);
  font-family: var(--t-sans);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--t-track-wide);
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 600;
}

.hero__kicker .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent-teal);
}

.hero__kicker .rule {
  width: 32px;
  height: 1px;
  background: var(--c-border-strong);
}

.hero__wordmark-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 14px;
  row-gap: 2px;
}

.hero__wordmark {
  font-family: var(--t-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1;
  letter-spacing: -0.015em;
  background: linear-gradient(
    90deg,
    var(--hero-grad-1) 0%,
    var(--hero-grad-2) 45%,
    var(--hero-grad-3) 55%,
    var(--hero-grad-4) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 0 0 var(--s-3);
  display: inline-block;
}

.hero__wordmark-rest {
  font-family: var(--t-serif);
  font-style: normal;
  font-weight: 500;
  font-size: clamp(18px, 1.6vw, 22px);
  color: var(--fg-2);
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 24;
  white-space: nowrap;
}

.hero__sentence {
  font-family: var(--t-serif);
  font-weight: 500;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--fg-strong);
  margin: var(--s-5) 0;
  max-width: 22ch;
  font-variation-settings: "opsz" 72;
  text-wrap: pretty;
}

.hero__sentence em {
  font-style: italic;
  color: var(--c-brand-purple);
  font-weight: 500;
}

[data-theme="dark"] .hero__sentence em { color: #d99adc; }

.hero__lede {
  font-family: var(--t-sans);
  font-weight: 400;
  font-size: var(--t-body-lg);
  line-height: 1.55;
  color: var(--fg-1);
  max-width: 58ch;
  margin: 0;
}

.hero__meta {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: var(--s-5);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
  max-width: 640px;
}

.hero__meta dt {
  font-family: var(--t-sans);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--t-track-wide);
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 600;
  margin-bottom: 4px;
}

.hero__meta dd {
  margin: 0;
  font-family: var(--t-serif);
  font-size: var(--t-body-lg);
  color: var(--fg-strong);
  font-weight: 500;
  font-variation-settings: "opsz" 24;
}

.hero__meta dd small {
  display: block;
  font-family: var(--t-sans);
  font-size: var(--t-small);
  color: var(--fg-2);
  font-weight: 400;
  margin-top: 2px;
}

.hero__ctas {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-6);
  flex-wrap: wrap;
}

/* Hero rotator card.
   Two slide variants share the same container + caption panel
   markup but lay out differently:

     .hero__slide--still  — a portrait cover/figure on the left,
                            caption on a paper-tinted panel right.
                            Maximises editorial poster feel.

     .hero__slide--motion — video fills the full 4:3 card edge-to-
                            edge, caption overlays the bottom with
                            a dark gradient. Gives the DNS room to
                            breathe.

   The container has a fixed 4:3 aspect so rotations don't shift
   layout. For still slides the image well is the left column
   (3fr of 5 total) of a 4:3 container, which resolves to a ~4:5
   portrait cell — the old poster feel is back. */
.hero__media {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: var(--c-paper-tint);
  position: relative;
}

/* Figures stack via absolute positioning — forces each to match
   the aspect-ratio-constrained container exactly, so a tall caption
   on one slide can't push the whole rotator height up. */
.hero__media figure {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms var(--ease);
}

.hero__media figure[data-active="true"] {
  opacity: 1;
  pointer-events: auto;
}

/* --- Still slide: portrait image left + paper caption right --- */
.hero__slide--still {
  display: grid;
  grid-template-columns: 3fr 2fr;
}

.hero__slide--still .hero__image-well {
  position: relative;
  overflow: hidden;
  background: var(--c-paper-tint);
  border-right: 1px solid var(--c-border);
}

.hero__slide--still .hero__image-well img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero__slide--still .hero__caption-panel {
  background: var(--c-paper-tint);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-3);
}

/* --- Motion slide: 16:9 video on top + paper-tint caption strip
       on bottom. Authoring a 16:9 Keynote/ffmpeg export packs cleanly
       into the 4:3 container: video takes 540×304 of a 540×405 panel,
       caption gets the remaining 101 px. No overlay, full contrast. */
.hero__slide--motion {
  display: grid;
  grid-template-rows: auto 1fr;
}

.hero__slide--motion .hero__image-well {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--fg-strong);
}

.hero__slide--motion .hero__image-well video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__slide--motion .hero__image-well iframe {
  position: absolute;
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  /* Reset transform so an over-broad legacy rule on .hero__media
     iframe (or anything inherited) can't shift the embed. */
  transform: none;
}

.hero__slide--motion .hero__caption-panel {
  background: var(--c-paper-tint);
  padding: var(--s-3) var(--s-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border-top: 1px solid var(--c-border);
  overflow: hidden;
}

/* Motion caption is tight — shrink subtitle and link spacing */
.hero__slide--motion .hero__caption-sub { margin-top: 0; }

.hero__slide--motion .hero__caption-link { margin-top: 4px; }

.hero__caption-eyebrow {
  font-family: var(--t-sans);
  font-size: var(--t-eyebrow);
  font-weight: 700;
  letter-spacing: var(--t-track-wide);
  text-transform: uppercase;
  color: var(--c-brand-purple);
}

[data-theme="dark"] .hero__caption-eyebrow { color: #d99adc; }

.hero__caption-title {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.25;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 48;
  margin: 0;
  text-wrap: pretty;
}

/* Citation sub-line: upright by default, italic only on nested
   <em> (used to wrap the journal name). Matches standard
   bibliographic style — authors + issue info upright, journal
   name italic. */
.hero__caption-sub {
  font-family: var(--t-serif);
  font-weight: 400;
  font-size: var(--t-small);
  line-height: 1.45;
  color: var(--fg-2);
  font-variation-settings: "opsz" 14;
}

.hero__caption-sub em { font-style: italic; }

/* Dark-mode --fg-2 (#9a8e7d) is too washed on dark paper-tint for
   a 14 px citation. Lift to --fg-1 for readable contrast without
   losing the "muted sub-line" hierarchy. */
[data-theme="dark"] .hero__caption-sub { color: var(--fg-1); }

.hero__caption-link {
  font-family: var(--t-sans);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--c-accent-teal);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--c-accent-teal) 35%, transparent);
  align-self: flex-start;
  padding-bottom: 1px;
  margin-top: var(--s-3);
  transition: color var(--dur-fast) var(--ease), border-bottom-color var(--dur-fast) var(--ease);
}

.hero__caption-link:hover {
  color: var(--c-accent-teal-hover);
  border-bottom-color: var(--c-accent-teal);
}

/* On narrow viewports the split cramps the text — stack image on
   top and caption panel below. */
@media (max-width: 820px) {
  .hero__media figure {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .hero__caption-panel {
    border-left: 0;
    border-top: 1px solid var(--c-border);
  }
}

.hero__media { overflow: hidden; }

/* Inactive figures keep playing silently in the background (muted)
   while faded out — small CPU/GPU cost, but keeps fade transitions
   smooth and avoids a restart flash when they rotate back. */

/* Respect prefers-reduced-motion — hero cycles stop. */
@media (prefers-reduced-motion: reduce) {
  .hero__media figure { transition: none; }
}

@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; gap: var(--s-6); }

  .hero__media { aspect-ratio: 16 / 10; }

  .hero__meta { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   2. CURRENTLY working on strip
   ========================================================= */
.c-now {
  padding: var(--s-6) var(--s-7);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--c-accent-teal) 5%, var(--c-surface-strong)) 0%,
    var(--c-surface-strong) 60%
  );
  border: 1px solid color-mix(in srgb, var(--c-accent-teal) 25%, transparent);
  border-left: 3px solid var(--c-accent-teal);
  border-radius: var(--r-md);
  margin-bottom: var(--s-7);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-5);
  align-items: center;
}

.c-now__label {
  font-family: var(--t-sans);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--t-track-wide);
  text-transform: uppercase;
  color: var(--c-accent-teal);
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid var(--c-accent-teal);
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.c-now__text {
  font-family: var(--t-serif);
  font-weight: 500;
  font-size: var(--t-body-lg);
  line-height: 1.5;
  color: var(--fg-1);
  margin: 0;
  max-width: none;
  font-variation-settings: "opsz" 24;
}

.c-now__text b { color: var(--fg-strong); font-weight: 600; }

@media (max-width: 820px) {
  .c-now { grid-template-columns: 1fr; }
}

/* =========================================================
   3. RESEARCH THEMES — 4 cards
   ========================================================= */
.themes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5);
}

.theme {
  display: grid;
  grid-template-rows: 200px auto;
  background: var(--c-surface-strong);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.theme:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

.theme__figure { position: relative; overflow: hidden; background: #111; }

.theme__figure img { width: 100%; height: 100%; object-fit: cover; }

.theme__figure-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--t-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: var(--t-track-wide);
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.04) 0 10px,
      transparent 10px 20px
    );
}

.theme__body { padding: var(--s-5) var(--s-6) var(--s-6); }

.theme__tag {
  font-family: var(--t-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--t-track-wide);
  color: var(--fg-2);
  margin-bottom: var(--s-2);
  display: block;
}

.theme__title {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.25;
  color: var(--fg-strong);
  margin: 0 0 var(--s-2);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 48;
  text-wrap: pretty;
}

.theme__desc {
  font-size: var(--t-body);
  color: var(--fg-1);
  line-height: 1.55;
  margin: 0 0 var(--s-4);
  max-width: none;
}

.theme__papers {
  display: grid;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--c-border);
  margin-top: var(--s-4);
}

.theme__paper {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  align-items: baseline;
  font-size: 13px;
}

.theme__paper-year {
  font-family: var(--t-mono);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.theme__paper-title {
  color: var(--fg-1);
  line-height: 1.4;
  border-bottom: 0;
}

.theme__paper-title:hover { color: var(--c-accent-teal); }

.theme__paper-venue {
  font-family: var(--t-serif);
  font-style: italic;
  color: var(--fg-2);
  font-size: 12px;
  font-variation-settings: "opsz" 12;
}

@media (max-width: 820px) {
  .themes { grid-template-columns: 1fr; }
}

/* =========================================================
   4. SECTION head shared pattern
   ========================================================= */
.home-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
}

.home-head__left {
  display: grid;
  gap: var(--s-3);
  max-width: 56ch;
}

.home-head__num {
  font-family: var(--t-mono);
  font-size: var(--t-small);
  color: var(--fg-2);
  letter-spacing: var(--t-track-wide);
}

.home-head__title {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  font-variation-settings: "opsz" 96;
  margin: 0;
  text-wrap: balance;
}

.home-head__sub {
  color: var(--fg-2);
  font-size: var(--t-body-lg);
  margin: 0;
  line-height: 1.55;
  max-width: 58ch;
}

/* =========================================================
   5. NEWS feed — three kinds
   ========================================================= */
.newsfeed {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--c-border);
}

.news-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--c-border);
  align-items: start;
}

.news-item__date {
  display: grid;
  text-align: center;
  padding: var(--s-3) var(--s-2);
  background: color-mix(in srgb, var(--c-brand-purple) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-brand-purple) 15%, transparent);
  border-radius: var(--r-sm);
}

.news-item__day {
  font-family: var(--t-serif);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--c-brand-purple);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48;
}

[data-theme="dark"] .news-item__day { color: #d99adc; }

.news-item__mo {
  font-family: var(--t-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--t-track-wide);
  color: var(--fg-2);
  margin-top: 6px;
}

.news-item__kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--t-sans);
  font-size: var(--t-eyebrow);
  font-weight: 700;
  letter-spacing: var(--t-track-wide);
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 6px;
}

.news-item__kicker .swatch { width: 8px; height: 8px; border-radius: 2px; }

.news-item[data-kind="paper"] .swatch { background: var(--c-brand-purple); }

.news-item[data-kind="talk"] .swatch { background: var(--c-accent-coral); }

.news-item[data-kind="people"] .swatch,
.news-item[data-kind="move"] .swatch,
.news-item[data-kind="award"] .swatch { background: var(--c-accent-teal); }

.news-item__title {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: var(--t-body-lg);
  line-height: 1.35;
  color: var(--fg-strong);
  margin: 0 0 var(--s-2);
  letter-spacing: -0.005em;
  max-width: 58ch;
  font-variation-settings: "opsz" 24;
}

.news-item__meta {
  font-size: var(--t-small);
  color: var(--fg-2);
  line-height: 1.5;
  margin: 0;
  max-width: 68ch;
}

.news-item__meta em { font-family: var(--t-serif); font-variation-settings: "opsz" 14; }

.news-item__meta strong { color: var(--c-accent-coral); font-weight: 600; }

.news-item__action { align-self: center; }

.news-item--paper .news-item__body {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--s-4);
}

.news-item__thumb {
  width: 88px;
  height: 104px;
  border-radius: var(--r-xs);
  overflow: hidden;
  background: linear-gradient(135deg, var(--c-brand-purple), var(--c-brand-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.news-item__thumb img { width: 100%; height: 100%; object-fit: cover; }

.news-item--people .news-item__body,
.news-item--move .news-item__body,
.news-item--award .news-item__body {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s-4);
  align-items: start;
}

.news-item__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--c-accent-teal), var(--c-brand-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

@media (max-width: 760px) {
  .news-item { grid-template-columns: 70px 1fr; }

  .news-item__action {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: var(--s-2);
  }
}

/* =========================================================
   6. TEAM preview (6 tiles)
   ========================================================= */
.team-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-5);
}

.member {
  display: grid;
  gap: var(--s-3);
}

.member__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--c-brand-purple) 8%, var(--c-paper-tint));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: 48px;
  color: var(--c-brand-purple);
  letter-spacing: -0.02em;
  border: 1px solid var(--c-border);
  position: relative;
}

[data-theme="dark"] .member__photo {
  color: #d99adc;
  background: color-mix(in srgb, var(--c-brand-purple) 18%, var(--c-paper-tint));
}

.member__photo img { width: 100%; height: 100%; object-fit: cover; }

.member__name {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg-strong);
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 24;
  line-height: 1.25;
  margin: 0;
}

.member__role {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.4;
}

.member__bio {
  font-size: 13px;
  color: var(--fg-1);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
  margin: 0;
  max-width: 42ch;
}

.member__links {
  display: flex;
  gap: var(--s-2);
  margin-top: 2px;
}

.member__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg-strong) 5%, transparent);
  color: var(--fg-2);
  border-bottom: 0;
}

.member__links a:hover {
  background: color-mix(in srgb, var(--c-accent-teal) 12%, transparent);
  color: var(--c-accent-teal);
}

.member__links i { font-size: 13px; }

.member--pi .member__photo {
  background: color-mix(in srgb, var(--c-accent-teal) 12%, var(--c-paper-tint));
  color: var(--c-accent-teal);
}

/* =========================================================
   7. Closing CTA (mini panel linking to /research)
   ========================================================= */
.closing-cta {
  margin-top: var(--s-7);
  padding: var(--s-6) var(--s-7);
  background: color-mix(in srgb, var(--c-brand-purple) 6%, var(--c-surface-strong));
  border: 1px solid color-mix(in srgb, var(--c-brand-purple) 18%, transparent);
  border-radius: var(--r-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-5);
  align-items: center;
}

.closing-cta h3 {
  font-family: var(--t-serif);
  font-weight: 600;
  font-size: clamp(20px, 2vw, 26px);
  color: var(--fg-strong);
  margin: 0;
  font-variation-settings: "opsz" 48;
}

.closing-cta p {
  margin: var(--s-2) 0 0;
  color: var(--fg-2);
  font-size: var(--t-body);
  max-width: 58ch;
}

@media (max-width: 760px) {
  .closing-cta { grid-template-columns: 1fr; }
}
