/* ============================================================
   Living Machine Lab — style.css  (v1 refined)
   ============================================================ */

:root {
  --ink: #0a0a0b;
  --ink-soft: #494a52;
  --paper: #ffffff;
  --paper-alt: #f5f5f7;
  --accent: #3945f5;          /* electric indigo */
  --accent-deep: #2733d6;     /* darker for text/links */
  --accent-soft: #eceefe;
  --magenta: #e5359a;         /* second accent (duotone pair) */
  --line: #e4e4e9;
  --radius: 14px;
  --font-jp: "IBM Plex Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  --font-en: "Space Grotesk", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-jp);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.9;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.en { font-family: var(--font-en); }
.mono { font-family: var(--font-mono); letter-spacing: 0.08em; }
.digital { font-family: "Share Tech Mono", var(--font-mono); letter-spacing: 0.04em; }

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-logo img { height: 14px; width: auto; }

.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a { color: var(--ink); }
.nav-links a:hover { color: var(--accent-deep); text-decoration: none; }

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  transition: color .15s;
}
.lang-toggle:hover { color: var(--accent-deep); }

.nav-join {
  padding: 7px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  transition: all .2s;
}
.nav-join:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff !important; }

.nav-toggle { display: none; }

/* ---------- hero (duotone collage + catchphrase) ---------- */
.hero {
  position: relative;
  min-height: clamp(540px, 86vh, 920px);
  display: flex;
  align-items: center;
  padding: 72px 0;
  background: var(--paper);
  overflow: hidden;
}

.hero-grid {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
}

/* solo variant: catchphrase only, no collage */
.hero-solo { min-height: clamp(420px, 70vh, 760px); }
.hero-solo .hero-grid { grid-template-columns: 1fr; }
.hero-solo .hero-copy {
  text-align: center;
  font-size: clamp(28px, 4.4vw, 52px);
}

.hero-copy {
  font-size: clamp(26px, 3.6vw, 44px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.8;
  text-align: left;
  position: relative;
  z-index: 2;
  animation: float-in 1.2s .15s ease both;
}
.hero-copy .ga-line { display: block; min-height: 1.8em; }
.hero-copy .ga-cell {
  display: inline-block;      /* fixed width per character: no layout shift */
  text-align: center;
  white-space: pre;           /* keep locked space characters open */
  margin: 0 0.05em;           /* a little air between characters */
}
.hero-copy .ga-miss { color: rgba(16,16,18,0.25); }

/* collage: two duotone panels, slightly overlapping, gaps welcome */
.hero-collage {
  position: relative;
  aspect-ratio: 10 / 9;
  max-height: 72vh;
  animation: float-in 1.2s .3s ease both;
}
/* one flat pool of image "organisms"; main.js runs their lifecycle
   (birth into empty space, death from crowding) and sets geometry */
.cslide {
  position: absolute;
  opacity: 0;
  transition: opacity 1.1s ease;
  overflow: hidden;
  mix-blend-mode: multiply;   /* overlaps mix like riso ink */
  /* default geometry until main.js places it */
  top: 0; left: 14%; width: 68%; height: 58%;
}
.cslide.on { opacity: 1; }
.cslide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* work credit, fixed white, follows its own image */
.ccredit {
  position: absolute;
  left: 16px;
  bottom: 12px;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,0.35);
  white-space: nowrap;
}

/* ---------- artificial-life band ---------- */
.alife-band {
  background: var(--paper);
  padding: 30px 0 40px;
  border-bottom: 1px solid var(--line);
}
.hero-space {
  height: clamp(80px, 12vh, 120px);
  width: min(760px, 92vw);
  margin: 0 auto;
  position: relative;
}

.now-evolving {
  width: min(760px, 92vw);
  margin: clamp(24px, 4vh, 48px) auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  color: #9a9cab;
  min-height: 5.4em;
}
.ne-head {
  color: var(--accent-deep);
  letter-spacing: 0.18em;
  font-size: 10px;
  margin-bottom: 2px;
}
.ne-dot { color: var(--accent); animation: ne-blink 1s steps(1) infinite; }
@keyframes ne-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.now-evolving .ne-row { color: #7c7e8d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-evolving .ne-row b { color: var(--ink); font-weight: 400; }
.now-evolving .ne-row i { color: var(--accent-deep); font-style: normal; }
.now-evolving .ne-idle { color: #b7b9c6; }
.walker-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes float-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.hero-scroll {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
}
.hero-scroll span {
  display: block;
  width: 22px; height: 34px;
  border: 2px solid #d5d5dd;
  border-radius: 12px;
  position: relative;
}
.hero-scroll span::after {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 7px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: scroll-dot 1.6s infinite;
}
@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- sections ---------- */
.section { padding: 110px 0; background: var(--paper); }
.section-alt { background: var(--paper-alt); }

.section-head { margin-bottom: 56px; }

.section-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: var(--accent-deep);
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: clamp(24px, 3.6vw, 34px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.section-desc {
  margin-top: 14px;
  color: var(--ink-soft);
  max-width: 640px;
  font-size: 15px;
}

.lead { font-size: 17.5px; font-weight: 500; }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-text p + p { margin-top: 18px; }

.hypothesis {
  margin-top: 34px;
  padding: 26px 30px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: none;
}
.hypothesis-label {
  font-size: 10px;
  letter-spacing: .24em;
  color: var(--accent-deep);
  font-weight: 500;
}
.hypothesis p { margin-top: 8px; font-size: 16.5px; line-height: 2; }

.about-axes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.axis-card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 26px 28px;
}
.axis-num {
  font-size: 11px;
  color: var(--accent-deep);
  letter-spacing: .15em;
}
.axis-card h3 { font-size: 19px; font-weight: 700; margin: 4px 0 8px; }
.axis-card p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.85; }

.axis-arrow {
  text-align: center;
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

/* ---------- research ---------- */
.research-list { display: flex; flex-direction: column; gap: 40px; }

.research-item {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 40px;
  align-items: center;
  background: var(--paper);
  border-radius: calc(var(--radius) + 6px);
  padding: 30px;
  box-shadow: 0 2px 24px rgba(18, 20, 60, 0.05);
}
.research-item:nth-child(even) {
  grid-template-columns: 1fr 340px;
}
.research-item:nth-child(even) .research-media { order: 2; }

.research-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .18em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 12px;
}

.research-body h3 { font-size: 21px; font-weight: 700; margin-bottom: 12px; letter-spacing: .02em; }
.research-body p { font-size: 15px; color: var(--ink-soft); }

/* ---------- projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 34px;
}

.project-card {
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: transform .25s ease, box-shadow .25s ease;
}
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 40px rgba(18, 20, 60, 0.10);
}

.project-media { overflow: hidden; }
.project-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.project-card:hover .project-media img { transform: scale(1.03); }

.project-body { padding: 26px 28px 30px; }
.project-body h3 {
  font-size: 21px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.project-sub { font-size: 10.5px; color: var(--accent-deep); font-weight: 500; letter-spacing: .14em; }
.project-body p { font-size: 14.5px; color: var(--ink-soft); }

.project-card-invite {
  display: flex;
  align-items: center;
  border-style: dashed;
  border-width: 2px;
  border-color: #d0d1dc;
  background: transparent;
}
.project-card-invite:hover { box-shadow: none; transform: none; border-color: var(--accent); }

/* ---------- publications ---------- */
.pub-year { margin-bottom: 44px; }
.pub-year h3 {
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--accent-deep);
  font-weight: 500;
  margin-bottom: 16px;
}
.pub-list { list-style: none; }
.pub-list li {
  padding: 14px 0 14px 22px;
  border-left: 2px solid var(--line);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.85;
  transition: border-color .2s;
}
.pub-list li:hover { border-left-color: var(--accent); }
.pub-list b { color: var(--ink); }
.pub-list i { color: var(--ink); }
.pub-tag {
  font-size: 10.5px;
  color: var(--accent-deep);
  border: 1px solid rgba(57, 69, 245, 0.30);
  border-radius: 999px;
  padding: 1px 9px;
  margin-left: 6px;
  white-space: nowrap;
}
.pub-tag:hover { background: var(--accent-deep); color: #fff; border-color: var(--accent-deep); text-decoration: none; }
.pub-more { font-size: 14px; color: var(--ink-soft); }

/* ---------- members ---------- */
.member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* two columns max */
  gap: 28px;
  align-items: stretch;
}

.member-card {
  position: relative;   /* hosts the walking member-creature canvas */
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--line);
  padding: 30px;
  display: flex;
  flex-direction: column;   /* compact card: photo above name/role */
  align-items: flex-start;
  gap: 18px;
  background: var(--paper);
}

/* the PI spans both columns and keeps a full profile beside the photo */
.member-pi {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: flex-start;
  gap: 28px;
}

.member-photo {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  image-rendering: pixelated;   /* keep the dithered pixels crisp */
}

/* name-seeded live creature — same spring-mass model as the hero walkers,
   ambling inside the circular frame. The SVG is the reduced-motion fallback. */
.creature-holder {
  position: relative;
  overflow: hidden;
  background: #eef0f6;
  image-rendering: auto;
}
.creature-holder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;   /* real photos crop to the circle like before */
}
/* the live creature walks over the whole card (and out of the circle);
   the static name-portrait underneath stays as-is */
.creature-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.member-body h3 { font-size: 20px; font-weight: 700; }
.member-en { font-size: 13px; color: var(--ink-soft); font-weight: 400; margin-left: 8px; }
.member-role {
  font-size: 10px;
  color: var(--accent-deep);
  font-weight: 500;
  margin: 2px 0 12px;
  letter-spacing: .18em;
}
.member-body p { font-size: 14px; color: var(--ink-soft); }
.member-links { margin-top: 12px; font-size: 13.5px; }

.member-recruit {
  border: 2px dashed #d0d1dc;
  background: transparent;
  align-items: center;
}

.collaborators { margin-top: 46px; }
.collab-title {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .24em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.collab-list { font-size: 14.5px; color: var(--ink-soft); }

/* ---------- news ---------- */
.news-list { list-style: none; max-width: 760px; }
.news-list li {
  display: flex;
  gap: 28px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  align-items: baseline;
}
.news-list time {
  flex-shrink: 0;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--accent-deep);
  letter-spacing: .08em;
}

/* ---------- join ---------- */
.section-join {
  background:
    radial-gradient(ellipse 80% 70% at 70% 20%, var(--accent-soft), transparent),
    var(--paper);
}

.join-text { max-width: 720px; }
.join-text .lead { margin-bottom: 24px; }

.join-points {
  list-style: none;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.join-points li {
  padding: 16px 22px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14.5px;
  color: var(--ink-soft);
}
.join-points b { color: var(--ink); }

.join-cta {
  display: inline-block;
  margin-top: 18px;
  font-family: var(--font-en);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  padding: 16px 34px;
  border-radius: 999px;
  transition: background .2s, transform .2s;
}
.join-cta:hover { background: var(--accent-deep); text-decoration: none; transform: translateY(-2px); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 60px 0 30px;
  background: var(--paper);
}
.footer-inner {
  display: flex;
  gap: 50px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.footer-logo { height: 72px; width: auto; }
.life-band {
  position: relative;
  /* JS aligns the top edge to the 'ALIFE 応用' box; this is a first-paint fallback */
  margin: -453px 0 0;
  padding: 0;              /* bottom sits flush against Research */
  /* the whole play area is a toy, not text — don't let taps select/copy it */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;   /* the overlapping band must not block links under it */
}
.name-life {
  display: block;
  width: 100%;
  height: 360px;
  touch-action: pan-y;     /* page still scrolls; we track the finger for repulsion */
  pointer-events: none;    /* let clicks reach links under the overlapping band */
}
.life-btns {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;              /* frontmost: letters drift behind the frosted glass */
  pointer-events: auto;   /* re-enable clicks on the buttons (band is none) */
}
.life-shuffle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(10, 10, 11, 0.12);
  box-shadow: 0 2px 12px rgba(10, 10, 11, 0.07);
  transition: background .18s, box-shadow .18s, transform .12s;
}
.life-shuffle:hover { background: rgba(255, 255, 255, 0.78); box-shadow: 0 3px 16px rgba(10, 10, 11, 0.13); }
.life-shuffle:active { transform: scale(0.92); }
.life-shuffle .ls-i { display: block; line-height: 1; }
.life-home {
  width: auto;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--ink-soft);
}
.life-home:hover { color: var(--ink); }

/* swarm-chemistry band — full-bleed, reaches up over Projects like the name band */
.swarm-band {
  position: relative;
  /* JS aligns the top to the 'Your Idea Here' box top; these are first-paint fallbacks */
  margin-top: -560px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;   /* don't block the 'Your Idea Here → Join us' link under it */
}
.swarm-life { display: block; width: 100%; height: 820px; touch-action: pan-y; pointer-events: none; }
.swarm-label {
  position: absolute;
  bottom: 16px;
  left: 22px;
  font-size: 10px;
  letter-spacing: .2em;
  color: #c4c5d0;
  pointer-events: none;
}

/* particle-lenia band — full-bleed closing note, spills up over Join */
.lenia-band {
  position: relative;
  margin-top: -70px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;   /* don't block links under it (Join section) */
}
.lenia-life { display: block; width: 100%; height: 240px; touch-action: pan-y; pointer-events: none; }
.footer-info p { font-size: 13.5px; color: var(--ink-soft); }
.footer-info p:first-child { font-weight: 700; color: var(--ink); font-size: 15px; }
.footer-links { margin-top: 10px; }

.substrate-hud {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding: 12px 24px 0;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: #b1b2bf;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.footer-copy {
  text-align: center;
  font-size: 12px;
  color: #b4b5c1;
  margin-top: 24px;
}

/* ---------- responsive ---------- */
.sp-only { display: none; }

@media (max-width: 860px) {
  .sp-only { display: inline; }

  .hero { min-height: 0; padding: 48px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-collage { order: -1; aspect-ratio: 10 / 9; max-height: 52vh; width: 100%; }
  .hero-copy { text-align: left; }

  .nav { padding: 12px 18px; }
  .nav-links {
    position: fixed;
    top: 55px; right: 0;
    flex-direction: column;
    background: rgba(255,255,255,0.97);
    width: 100%;
    padding: 28px 0 34px;
    gap: 22px;
    border-bottom: 1px solid var(--line);
    transform: translateY(-130%);
    transition: transform .3s ease;
    z-index: 49;
  }
  .nav-links.open { transform: none; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    width: 24px; height: 2px;
    background: var(--ink);
    transition: transform .25s;
  }
  .nav-toggle.open span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

  .section { padding: 76px 0; }

  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .research-item,
  .research-item:nth-child(even) { grid-template-columns: 1fr; gap: 22px; padding: 22px; }
  .research-item:nth-child(even) .research-media { order: 0; }
  .project-grid { grid-template-columns: 1fr; }
  .member-grid { grid-template-columns: 1fr; }
  .member-card { flex-direction: column; }
  .news-list li { flex-direction: column; gap: 2px; }
}

/* reveal (added by main.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .cslide { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hud-cursor { animation: none; }
}
