/* =========================================================================
   The Social Structure of Jazz — shared stylesheet
   Design system: mid-century jazz-LP / Blue Note liner-notes, modernized.
   Palette derives from the subject: brass (the trumpet) + Blue-Note night.
   ========================================================================= */

:root {
  /* --- color ------------------------------------------------------------ */
  --paper:       #ECE6D8;   /* warm bone background                         */
  --paper-2:     #E3DBC8;   /* slightly deeper: panels, cards              */
  --ink:         #1C1813;   /* warm near-black: primary text               */
  --ink-soft:    #57503F;   /* muted text: captions, secondary             */
  --brass:       #A9762B;   /* accent — a trumpet is brass                  */
  --brass-bright:#CE9A3E;   /* accent hover / highlight                     */
  --blue:        #274B5A;   /* deep teal-blue — Blue Note night            */
  --line:        rgba(28, 24, 19, 0.16);
  --line-strong: rgba(28, 24, 19, 0.34);

  /* --- type ------------------------------------------------------------- */
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body:    'Newsreader', Georgia, serif;
  --mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* --- rhythm ----------------------------------------------------------- */
  --measure: 34rem;         /* comfortable reading width                    */
  --gutter:  clamp(1.25rem, 4vw, 3.5rem);
}

/* --- reset ---------------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brass); }

/* =========================================================================
   Navigation — persistent top bar
   ========================================================================= */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: baseline; gap: 1.5rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  line-height: 1;
}
.nav__brand:hover { color: var(--ink); }
.nav__link {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.nav__link:hover { color: var(--ink); border-color: var(--brass); }
.nav__link.is-active { color: var(--ink); border-color: var(--brass); }
@media (max-width: 640px) {
  .nav { gap: 0.9rem; padding: 0.75rem 1rem; flex-wrap: wrap; }
  .nav__brand { font-size: 1.1rem; width: 100%; margin-bottom: 0.15rem; }
}

/* =========================================================================
   Generic layout helpers
   ========================================================================= */
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--measure); }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--brass); margin: 0 0 0.75rem;
}
h1, h2, h3 { font-weight: 600; line-height: 1.06; margin: 0 0 0.6rem; }
.prose p { margin: 0 0 1.1rem; }

/* =========================================================================
   Landing (index)
   ========================================================================= */
.hero {
  min-height: 78vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 4rem 0 3rem;
  position: relative;
}
.hero__kicker {
  font-family: var(--mono);
  font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--brass); margin-bottom: 1.4rem;
}
.hero__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.8rem, 9vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  max-width: 15ch;
  margin: 0 0 1.6rem;
}
.hero__title em {
  font-style: normal;
  color: var(--brass);
  -webkit-text-stroke: 0;
}
.hero__lede {
  font-size: 1.3rem; max-width: 42rem; color: var(--ink);
  line-height: 1.5;
}
.hero__lede .quiet { color: var(--ink-soft); }

/* three project cards */
.cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line-strong);
  border: 1px solid var(--line-strong);
  margin: 1rem 0 5rem;
}
.card {
  background: var(--paper);
  padding: 2rem 1.6rem 2.2rem;
  text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; min-height: 15rem;
  transition: background 0.25s ease;
}
.card:hover { background: var(--paper-2); color: var(--ink); }
.card__index {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em;
  color: var(--brass); text-transform: uppercase; margin-bottom: auto;
}
.card__title {
  font-family: var(--display); font-weight: 700;
  font-size: 2rem; line-height: 0.98; text-transform: uppercase;
  margin: 1.4rem 0 0.6rem;
}
.card__desc { font-size: 0.98rem; color: var(--ink-soft); line-height: 1.45; }
.card__arrow { font-family: var(--mono); color: var(--brass); margin-top: 1rem; font-size: 0.9rem; }
.card[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
@media (max-width: 760px) {
  .cards { grid-template-columns: 1fr; }
  .card { min-height: auto; }
}

/* =========================================================================
   Story scaffolding (influence.html)
   ========================================================================= */
.story-head {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}
.story-head__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 5.5rem); line-height: 0.94;
  text-transform: uppercase; margin: 0.4rem 0 1.2rem; max-width: 18ch;
}
.story-head__meta {
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft);
  letter-spacing: 0.04em; line-height: 1.8;
}

/* the vertical spine + act markers (the signature device) */
.act {
  position: relative;
  border-top: 1px solid var(--line);
}
.act__label {
  position: sticky; top: 64px; z-index: 5;
  padding: 1.4rem var(--gutter) 0;
  pointer-events: none;
}
.act__side {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--brass);
}
.act__name {
  font-family: var(--display); font-weight: 700; font-size: 1.5rem;
  text-transform: uppercase; color: var(--ink); line-height: 1;
  margin-top: 0.15rem;
}

/* --- scrollytelling: sticky graphic + scrolling steps ------------------- */
.scrolly {
  position: relative;
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 0;
  max-width: 84rem; margin: 0 auto; padding: 0 var(--gutter);
}
.scrolly--left { grid-template-columns: 60% 40%; }  /* graphic on left */

.scrolly__steps { grid-column: 1; position: relative; z-index: 2; }
.scrolly--left .scrolly__steps { grid-column: 2; }

.scrolly__graphic {
  grid-column: 2; grid-row: 1;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.scrolly--left .scrolly__graphic { grid-column: 1; }

.step {
  min-height: 92vh;
  display: flex; align-items: center;
}
.step:first-child { min-height: 70vh; padding-top: 8vh; }
.step:last-child  { min-height: 80vh; }
.step__card {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  padding: 1.5rem 1.6rem;
  max-width: 30rem;
  opacity: 0.35;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  backdrop-filter: blur(3px);
}
.step.is-active .step__card { opacity: 1; transform: translateY(0); }
.step__n {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em;
  color: var(--brass); text-transform: uppercase; margin-bottom: 0.5rem;
}
.step__card h3 {
  font-family: var(--display); font-weight: 700; font-size: 1.6rem;
  text-transform: uppercase; margin-bottom: 0.5rem; line-height: 1;
}
.step__card p { margin: 0; font-size: 1.02rem; line-height: 1.55; }
.step__card p + p { margin-top: 0.8rem; }

/* graphic frame (holds SVG / canvas / plot) */
.figure {
  width: 100%; height: min(82vh, 760px);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  position: relative;
  overflow: hidden;
}
.figure__caption {
  position: absolute; left: 0; bottom: 0; right: 0;
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-soft);
  padding: 0.5rem 0.7rem; letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-top: 1px solid var(--line);
}

/* stacked image layers inside a figure frame (cross-fade per scroll step) */
.figure__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 10px 10px 30px;      /* keep clear of the caption bar */
  opacity: 0;
  transition: opacity 0.5s ease;
}
.figure__img.is-shown { opacity: 1; }

/* if an image path is wrong, the frame says so instead of sitting blank */
.figure[data-missing]::after {
  content: 'missing image: ' attr(data-missing);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft);
  padding: 1.5rem; text-align: center;
}

/* SVG network element styles (shared by acts 0 & 3) */
.node { cursor: pointer; }
.node circle { stroke: var(--paper); stroke-width: 1.2px; }
.link { fill: none; stroke: var(--ink); opacity: 0.28; }
.link.dim { opacity: 0.06; }
.node.dim { opacity: 0.18; }
.node-label {
  font-family: var(--mono); font-size: 10px; fill: var(--ink);
  pointer-events: none;
}
.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.75rem;
  padding: 0.35rem 0.55rem; border-radius: 2px;
  opacity: 0; transition: opacity 0.12s ease; white-space: nowrap;
}
.tooltip .t-sub { color: var(--brass-bright); }

/* small-multiple panel titles (act 3) */
.panel-title {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; fill: var(--ink-soft);
}

/* birth-year legend */
.legend {
  position: absolute; right: 0.7rem; top: 0.7rem;
  font-family: var(--mono); font-size: 0.62rem; color: var(--ink-soft);
  text-align: right; line-height: 1.4;
}
.legend__bar {
  height: 8px; width: 130px; margin: 3px 0;
  background: linear-gradient(90deg,
    #9E2B25, #C56A2D, #D9A441, #E8DCA0, #7FA8AE, #3E6E86, #274B5A);
  border: 1px solid var(--line);
}

/* placeholder blocks for acts not yet built */
.todo {
  border: 1px dashed var(--line-strong);
  background: repeating-linear-gradient(45deg,
    transparent, transparent 12px,
    color-mix(in srgb, var(--brass) 6%, transparent) 12px,
    color-mix(in srgb, var(--brass) 6%, transparent) 24px);
  padding: 3rem var(--gutter); margin: 0;
}
.todo__inner { max-width: 40rem; margin: 0 auto; }
.todo h3 {
  font-family: var(--display); font-weight: 700; font-size: 1.8rem;
  text-transform: uppercase; margin-bottom: 0.4rem;
}
.todo p { color: var(--ink-soft); font-size: 0.98rem; margin: 0.3rem 0; }
.todo__tag {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brass);
}

/* =========================================================================
   Data & Gender pages
   ========================================================================= */
.page { padding: 4rem 0 6rem; }
.page__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 5rem); line-height: 0.94;
  text-transform: uppercase; margin: 0.4rem 0 1.4rem;
}
.dataset {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  padding: 2rem; margin: 1.5rem 0;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
}
.dataset__meta { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); line-height: 1.7; }
.dataset__title { font-family: var(--display); font-weight: 700; font-size: 1.8rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.btn {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none;
  background: var(--ink); color: var(--paper);
  padding: 0.85rem 1.4rem; border: 1px solid var(--ink);
  white-space: nowrap; transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.btn--disabled { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); pointer-events: none; }
@media (max-width: 640px) {
  .dataset { grid-template-columns: 1fr; }
}

/* footer */
.foot {
  border-top: 1px solid var(--line);
  padding: 2.5rem var(--gutter) 3.5rem;
  font-family: var(--mono); font-size: 0.74rem; color: var(--ink-soft);
  letter-spacing: 0.03em; line-height: 1.8;
}
.foot a { color: var(--ink-soft); }
.foot a:hover { color: var(--brass); }

/* responsive scrollytelling: stack on narrow screens */
@media (max-width: 820px) {
  .scrolly, .scrolly--left { grid-template-columns: 1fr; }
  .scrolly__graphic, .scrolly--left .scrolly__graphic {
    grid-column: 1; grid-row: 1;
    position: sticky; top: 56px; height: 56vh;
  }
  .scrolly__steps, .scrolly--left .scrolly__steps {
    grid-column: 1; position: relative; z-index: 2;
  }
  .figure { height: 52vh; }
  .step { min-height: 78vh; }
  .step__card { max-width: none; }
}
/* --- Footer Layout --- */
.footer-text {
  margin-bottom: 2rem; 
}

.footer-bottom-row {
  display: flex;
  justify-content: space-between; 
  align-items: center; 
  flex-wrap: wrap; 
  gap: 1rem;
  width: 100%; /* Ensures the row spans the entire width */
}

.footer-sponsors {
  display: flex;
  flex-direction: row; 
  align-items: center;
  gap: 1.5rem; 
  margin-left: auto; /* FORCES the logos to the absolute right edge */
}

.footer-sponsors img {
  height: 60px; 
  width: auto;
  max-width: 180px; 
  object-fit: contain;
  display: block;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .footer-bottom-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-sponsors {
    margin-left: 0; /* Resets the right-push on mobile so it aligns left */
    margin-top: 1rem;
  }
}

/* Wide prose section (Results & Discussion) — no scrollytelling */
.discussion { border-top: 1px solid var(--line); padding: 4.5rem 0 6rem; }
.discussion__inner { max-width: 52rem; margin: 0 auto; padding: 0 var(--gutter); }
.discussion .eyebrow { margin-bottom: 1rem; }
.discussion__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 4rem); line-height: 0.96;
  text-transform: uppercase; margin: 0 0 1.8rem;
}
.discussion h3 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1;
  text-transform: uppercase; color: var(--ink); margin: 2.8rem 0 0.9rem;
}
.discussion p { font-size: 1.18rem; line-height: 1.72; margin: 0 0 1.2rem; max-width: none; }
.discussion .lede { font-size: 1.34rem; line-height: 1.6; color: var(--ink); }
.discussion .paper-cta {
  margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.9rem;
}
.discussion .paper-cta a { color: var(--brass); }
.discussion .paper-cta a:hover { color: var(--ink); }

/* scroll reveal — only arms when JS adds .reveals-on, so text stays visible if JS fails */
.reveals-on .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveals-on .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveals-on .reveal { opacity: 1; transform: none; transition: none; } }

/* interactive network backdrop on the landing hero */
#net-bg {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100vh;
  z-index: 0; pointer-events: none; overflow: hidden;
}
body > .wrap, body > main, .nav { position: relative; z-index: 1; }
.nav { z-index: 100; }

/* zoom lightbox */
.zoom-loupe {
  position: fixed; z-index: 300; pointer-events: none;
  width: 380px; height: 380px;
  border: 1px solid var(--line-strong);
  background-repeat: no-repeat; background-color: var(--paper);
  box-shadow: 0 10px 40px rgba(28,24,19,0.25);
  opacity: 0; transition: opacity 0.15s ease;
}
.zoom-loupe.on { opacity: 1; }
.zoom-overlay {
  position: fixed; inset: 0; z-index: 320;
  background: rgba(28,24,19,0.82);
  display: none; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 3vmin;
}
.zoom-overlay.on { display: flex; }
.zoom-overlay img { max-width: 96vw; max-height: 94vh; box-shadow: 0 10px 60px rgba(0,0,0,0.5); }
.figure__img { cursor: zoom-in; }