/* Wi-Fly — shared styles
   Palette derives from the three plate materials in the study
   (polystyrene, aluminium, steel) plus the red of a Drosophila eye. */

:root {
  --poly:    #e7e9e5;
  --poly-2:  #dcdfd9;
  --poly-3:  #f2f3f0;
  --alu:     #a9afb2;
  --steel:   #383f44;
  --steel-2: #262c30;
  --ink:     #1a1e20;
  --eye:     #a32213;
  --amber:   #d9a21b;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --rule: 1px solid rgba(26, 30, 32, 0.18);

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--poly);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.14rem);
  line-height: 1.62;
  font-variant-numeric: oldstyle-nums;
}

::selection { background: var(--amber); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--eye);
  outline-offset: 3px;
}

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-stretch: 118%;
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(1.47rem, 0.84rem + 2.94vw, 3.08rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); }
h3 {
  font-size: 1.02rem;
  font-stretch: 100%;
  font-weight: 600;
  letter-spacing: 0.01em;
}

p { margin: 0 0 1.1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--eye); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { background: var(--amber); color: var(--ink); text-decoration-color: transparent; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin: 0 0 1.4rem;
  max-width: none;
}

.lede {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.45rem);
  line-height: 1.42;
  max-width: 30rem;
}

.caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--steel);
  max-width: 30rem;
}

.note {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--steel);
  border-left: 2px solid var(--alu);
  padding-left: 0.9rem;
  max-width: 30rem;
}

/* ---------- shell ---------- */

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

.masthead {
  border-bottom: var(--rule);
  position: sticky;
  top: 0;
  background: var(--poly);
  z-index: 10;
}

.masthead .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.85rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark img {
  display: block;
  width: auto;
  height: 2em;
  max-height: 2em;
  mix-blend-mode: multiply;
  animation: wifly-rainbow 6s linear infinite;
  will-change: filter;
}
@keyframes wifly-rainbow {
  from { filter: invert(24%) sepia(98%) saturate(6500%) hue-rotate(0deg) brightness(98%) contrast(112%); }
  to { filter: invert(24%) sepia(98%) saturate(6500%) hue-rotate(360deg) brightness(98%) contrast(112%); }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark img {
    animation: none;
    filter: invert(24%) sepia(98%) saturate(6500%) hue-rotate(210deg) brightness(98%) contrast(112%);
  }
}
.wordmark:hover { background: none; color: var(--eye); }
.wordmark .tail { color: var(--eye); }

.nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav a { color: var(--steel); text-decoration: none; padding-bottom: 2px; }
.nav a:hover { background: none; color: var(--ink); border-bottom: 1px solid var(--eye); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--eye); }

.band { padding-block: clamp(3rem, 7vw, 5.5rem); }
.band + .band { border-top: var(--rule); }
.band.dark {
  background: var(--steel);
  color: var(--poly-3);
  border-top: none;
}
.band.dark h2, .band.dark h3 { color: var(--poly-3); }
.band.dark .eyebrow, .band.dark .caption { color: var(--alu); }
.band.dark a { color: var(--amber); }
.band.dark .note { border-left-color: rgba(233, 236, 232, 0.35); color: var(--alu); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.6rem, 4vw, 3.5rem);
}
@media (min-width: 62rem) {
  .split { grid-template-columns: 15rem minmax(0, 1fr); }
  .split > .side { position: sticky; top: 4.5rem; align-self: start; }
}

.stack > * + * { margin-top: 2.6rem; }

/* ---------- hero ---------- */

.hero { padding-block: clamp(2.6rem, 6vw, 4.5rem) clamp(2.4rem, 5vw, 4rem); }

.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
}
@media (min-width: 60rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
}

h1 .quiet { color: var(--alu); display: block; }

.tracking-figure { margin: 0; }
.tracking-figure img,
.tracking-figure video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(26, 30, 32, 0.22);
  background: var(--steel-2);
}
.tracking-figure figcaption { margin-top: 0.85rem; }
.section-figure { margin: 1.8rem 0; max-width: 40rem; }

.experiment-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
  margin: 1.8rem 0;
}
.method-figure {
  margin: 0;
}
.method-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(26, 30, 32, 0.22);
  background: var(--poly-3);
}
.method-figure figcaption { margin-top: 0.85rem; }

@media (max-width: 48rem) {
  .experiment-figures { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- plate widget (signature) ---------- */

.plate {
  background: var(--poly-3);
  border: 1px solid rgba(26, 30, 32, 0.22);
  padding: 0.9rem;
  box-shadow: 0 1px 0 rgba(26, 30, 32, 0.1);
}

.lightbar {
  height: 0.55rem;
  background: var(--amber);
  transition: background 220ms ease;
  margin-bottom: 0.9rem;
}
.lightbar[data-state="dark"] { background: var(--steel-2); }

.wells {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: clamp(0.28rem, 1.1vw, 0.55rem);
}

.well {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--alu);
  background: transparent;
  transition: background 90ms linear, border-color 90ms linear;
}
.well[data-moving="1"] {
  background: var(--eye);
  border-color: var(--eye);
}

.plate-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.toggle {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--alu);
  background: transparent;
  color: var(--steel);
  cursor: pointer;
}
.toggle:hover { border-color: var(--ink); color: var(--ink); }
.toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--poly-3);
}

.plate-caption { margin-top: 0.85rem; }

/* ---------- material ranking ---------- */

.materials {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  max-width: 44rem;
}
@media (min-width: 44rem) {
  .materials { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.material {
  border: 1px solid rgba(26, 30, 32, 0.2);
  padding: 1rem 1rem 1.1rem;
  background: var(--poly-3);
}
.material .rank {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  display: block;
  margin-bottom: 0.5rem;
}
.material .name {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: 600;
  font-size: 1.2rem;
  display: block;
  margin-bottom: 0.35rem;
}
.material p { font-size: 0.92rem; margin: 0; }
.material.is-plastic { border-left: 4px solid var(--eye); }
.material.is-steel { border-left: 4px solid var(--steel); }
.material.is-alu { border-left: 4px solid var(--alu); }

/* ---------- definition list for the statistics ---------- */

.defs { margin: 0; max-width: 40rem; }
.defs > div {
  border-top: var(--rule);
  padding-block: 1.1rem;
  display: grid;
  gap: 0.35rem 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 42rem) {
  .defs > div { grid-template-columns: 7rem minmax(0, 1fr); }
}
.defs dt {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: 600;
  font-size: 1.05rem;
}
.defs dd { margin: 0; }
.defs dd p { margin-bottom: 0; }
.band.dark .defs > div { border-top-color: rgba(233, 236, 232, 0.28); }

/* ---------- kit list ---------- */

.kit { list-style: none; margin: 0; padding: 0; max-width: 40rem; }
.kit li {
  border-top: var(--rule);
  padding-block: 1rem;
  display: grid;
  gap: 0.2rem 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 42rem) {
  .kit li { grid-template-columns: 11rem minmax(0, 1fr); }
}
.kit .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  padding-top: 0.28rem;
}
.kit .body { font-size: 0.98rem; }
.kit .body p { margin: 0; }
.band.dark .kit li { border-top-color: rgba(233, 236, 232, 0.28); }
.band.dark .kit .label { color: var(--alu); }

/* ---------- paper block ---------- */

.paper {
  border: 1px solid rgba(26, 30, 32, 0.22);
  background: var(--poly-3);
  padding: clamp(1.3rem, 3vw, 2rem);
  max-width: 42rem;
}
.paper .title {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 600;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.16;
  margin: 0 0 0.7rem;
  max-width: none;
}
.paper .authors { font-size: 0.98rem; margin-bottom: 1.2rem; }
.paper + .paper { margin-top: 1rem; }
.publication-summary {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1.3rem;
  max-width: none;
}
.publication-summary span { display: block; }
.publication-summary span + span { margin-top: 0.35rem; }
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.links a {
  border: 1px solid var(--ink);
  padding: 0.5rem 0.8rem;
  text-decoration: none;
  color: var(--ink);
}
.links a:hover { background: var(--ink); color: var(--poly-3); }

/* ---------- team ---------- */

.team-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 42rem) {
  .team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.team-member {
  border: 1px solid rgba(26, 30, 32, 0.22);
  background: var(--poly-3);
}

.portrait {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), transparent 55%),
    var(--poly-2);
  border-bottom: 1px solid rgba(26, 30, 32, 0.16);
  color: var(--alu);
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-stretch: 118%;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.team-member-copy { padding: 1.1rem; }

.team-member h2 {
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.65rem);
  margin-bottom: 0.45rem;
}

.team-member .role {
  margin: 0;
  color: var(--steel);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- footer ---------- */

.colophon {
  border-top: var(--rule);
  padding-block: 2.2rem 3rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--steel);
}
.colophon .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.colophon p { margin: 0; max-width: 26rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
