/* Peptide Science page only. Loaded after base.css, style.css and
   cinematic.css, which supply the tokens, header, hero film, footer and
   motion rules shared with the home page. */

body.peptides-page {
  overflow-x: clip;
}

/* ---------------------------------------------------------------
   HERO: the same film scene as the home page, single column.
   --------------------------------------------------------------- */
.peptides-page .hero-inner {
  grid-template-columns: minmax(0, 1fr);
  min-height: max(38rem, calc(88svh - var(--header-height)));
}

.peptides-page .hero-copy {
  max-width: 50rem;
}

.peptides-page .hero-copy h1 {
  font-size: clamp(2.9rem, 5.2vw, 5.8rem);
}

.peptides-page .hero-intro {
  max-width: 48ch;
}

.hero-note {
  font-size: var(--text-sm);
  color: var(--color-muted);
  max-width: 54ch;
}

/* ---------------------------------------------------------------
   CHAPTER NAVIGATION
   --------------------------------------------------------------- */
.chapter-nav {
  padding-block: 1.1rem;
  border-block: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
}

.chapter-nav ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  max-width: var(--content-wide);
  margin-inline: auto;
}

.chapter-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-muted);
  transition: color var(--t-fast) var(--ease-out);
}

.chapter-nav a span {
  font-family: var(--signal-mono);
  font-size: 0.7rem;
  color: var(--color-primary);
}

.chapter-nav a:hover,
.chapter-nav a:focus-visible {
  color: var(--color-primary);
}

/* ---------------------------------------------------------------
   CHAPTERS: a label column and a reading column, thin rules.
   --------------------------------------------------------------- */
.chapter {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-block: clamp(4rem, 9vh, 7rem);
  border-bottom: 1px solid var(--color-border);
}

.chapter-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.32fr) minmax(0, 0.68fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.chapter-heading .eyebrow {
  padding-top: 0.6rem;
}

.chapter-heading h2 {
  font-size: var(--text-2xl);
}

.chapter-copy {
  display: grid;
  gap: 1.2rem;
  max-width: 68ch;
  margin-left: calc(32% + clamp(1.5rem, 4vw, 4rem) * 0.68);
}

.chapter-copy p {
  font-size: var(--text-lg);
  line-height: 1.62;
  color: var(--color-muted);
  max-width: 68ch;
}

.chapter-copy p strong,
.entry-body p strong {
  color: var(--color-text);
  font-weight: 700;
}

.citation {
  display: inline-block;
  padding: 0 0.2rem;
  font-size: 0.8em;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.citation:hover,
.citation:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Evidence entries: one compound per entry, label beside reading. */
.evidence-entry {
  display: grid;
  grid-template-columns: minmax(0, 0.32fr) minmax(0, 0.68fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-block: clamp(1.75rem, 4vh, 2.75rem);
  border-top: 1px solid var(--color-border);
}

.evidence-entry:last-of-type {
  padding-bottom: 0;
}

/* Each entry's rule draws in from the left as it enters the viewport,
   the same horizon line that runs through the hero. */
.evidence-entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-bright) 60%, transparent);
  box-shadow: 0 0 18px rgb(3 118 198 / 45%);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  pointer-events: none;
}

.evidence-entry {
  position: relative;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .evidence-entry::before {
      animation: rule-draw linear both;
      animation-timeline: view(block);
      animation-range: entry 0% entry 60%;
    }
  }
}

@keyframes rule-draw {
  from { transform: scaleX(0); opacity: 0; }
  60% { opacity: 1; }
  to { transform: scaleX(1); opacity: .55; }
}

.entry-head {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.entry-head h3 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.entry-badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.35rem 0.75rem;
  font-family: var(--signal-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  border: 1px solid var(--signal-edge);
  border-radius: var(--radius-pill);
}

.entry-body {
  display: grid;
  gap: 1rem;
  max-width: 68ch;
}

.entry-body p {
  line-height: 1.65;
  color: var(--color-muted);
}

/* Approved medicines and investigational compounds read differently. */
.chapter[data-maturity="established"] .entry-badge {
  color: var(--color-text);
  border-color: var(--color-primary);
  background: var(--color-primary-wash);
}

.chapter[data-maturity="emerging"] .entry-badge {
  border-style: dashed;
}

/* Interlude: a scene between the benefits and the frontier. */
.interlude {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 46vh;
  padding-block: clamp(4rem, 10vh, 7rem);
  overflow: clip;
  text-align: center;
}

/* The film still sits behind as a parallax scene (.scene-still, shared
   with the home page quotes); this layer only fades it into the page. */
.interlude::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, var(--color-bg) 0%, transparent 30%, transparent 70%, var(--color-bg) 100%);
}

.interlude .scene-still {
  background-position: 50% 45%;
  opacity: .4;
}

.interlude::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -15%;
  right: -15%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  box-shadow: 0 0 35px rgb(3 118 198 / 40%);
  opacity: 0.35;
  transform: rotate(-7deg);
}

.interlude .eyebrow {
  margin-bottom: 1rem;
}

.interlude p:last-child {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 20ch;
  text-shadow: 0 4px 40px var(--color-bg);
}

.interlude p:last-child em {
  color: var(--color-primary);
}

/* Sources */
.sources-note {
  grid-column: 2;
  font-size: var(--text-sm);
  color: var(--color-muted);
  max-width: 68ch;
}

.source-list {
  display: grid;
  margin-left: calc(32% + clamp(1.5rem, 4vw, 4rem) * 0.68);
  max-width: 72ch;
  counter-reset: src;
}

.source-list li {
  position: relative;
  display: grid;
  gap: 0.25rem;
  padding: 1.1rem 0 1.1rem 3rem;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-muted);
  scroll-margin-top: calc(var(--header-height) + 1rem);
  counter-increment: src;
}

.source-list li::before {
  content: "[" counter(src) "]";
  position: absolute;
  left: 0;
  top: 1.2rem;
  font-family: var(--signal-mono);
  font-size: 0.7rem;
  color: var(--color-primary);
}

.source-list li:target {
  background: linear-gradient(90deg, var(--color-primary-wash), transparent 70%);
}

.source-list strong {
  color: var(--color-text);
}

.source-list a {
  font-weight: 700;
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--signal-edge);
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.source-list a:hover,
.source-list a:focus-visible {
  text-decoration-color: var(--color-primary);
}

.source-type {
  display: block;
}

.review-status {
  grid-column: 2;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  font-size: var(--text-sm);
  color: var(--color-muted);
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: var(--radius-inner);
  max-width: 68ch;
}

/* Closing colour-block: reuses the home contact styles. */
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.contact-button {
  display: inline-flex;
  align-items: center;
  min-height: 3.1rem;
  padding: 0.85rem 1.6rem;
  font-weight: 700;
  color: var(--brand-navy);
  background: #fff;
  border: 1px solid #fff;
  border-radius: var(--radius-pill);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out);
}

.contact-button:hover,
.contact-button:focus-visible {
  background: var(--color-primary-bright);
  border-color: var(--color-primary-bright);
}

.contact-button:active {
  transform: scale(0.97);
}

.contact-button.is-ghost {
  color: #fff;
  background: transparent;
  border-color: rgb(255 255 255 / 55%);
}

.contact-button.is-ghost:hover,
.contact-button.is-ghost:focus-visible {
  color: var(--brand-navy);
  background: #fff;
  border-color: #fff;
}

.join-section .contact-button:focus-visible {
  outline-color: #fff;
}

.contact-note {
  font-size: var(--text-sm);
  color: rgb(255 255 255 / 80%);
}

/* ---------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------- */
@media (max-width: 900px) {
  .peptides-page .hero-inner {
    min-height: max(32rem, 76svh);
    align-content: end;
  }

  .chapter-heading,
  .evidence-entry {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chapter-copy,
  .source-list {
    margin-left: 0;
  }

  .sources-note,
  .review-status {
    grid-column: 1;
  }

  .chapter-heading .eyebrow {
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .chapter-copy p {
    font-size: var(--text-base);
  }

  .interlude {
    min-height: 36vh;
  }

  .contact-button {
    flex: 1 1 100%;
    justify-content: center;
  }

  .source-list li {
    padding-left: 2.4rem;
  }
}

/* Without app.js (blocked, failed, or disabled) nothing is hidden. */
html:not([data-enhanced]) .reveal,
html:not([data-enhanced]) [data-hero-part] {
  opacity: 1;
  transform: none;
}

/* Visual chapters: each image has one placement on this page. */
.peptides-page .interlude .scene-still { background-image: url('./assets/image-ideas/03-signal-field.webp'); background-position: center; }
.peptides-page .join-section::after { background: linear-gradient(125deg, #000062, #034578 68%, #0376c6); opacity: .6; }
.peptide-visual, .study-visual, .evidence-map, .evidence-lens { margin: 0 0 clamp(2.5rem, 6vh, 4rem); border: 1px solid var(--color-border); border-radius: 16px; background: var(--color-surface); overflow: hidden; }
.peptide-visual { display: grid; grid-template-columns: 1.15fr 1fr; align-items: stretch; }
.peptide-photo { width: 100%; height: 100%; min-height: 18rem; max-height: 26rem; object-fit: cover; object-position: center 40%; }
.peptide-visual figcaption { display: grid; align-content: center; gap: 1.2rem; padding: clamp(1.5rem, 4vw, 3rem); }
.peptide-visual h3, .visual-heading h3, .evidence-lens h3 { font-size: clamp(1.5rem, 2.8vw, 2.4rem); line-height: 1.08; font-weight: 500; }
.peptide-visual figcaption > p:not(.eyebrow), .visual-heading > p:not(.eyebrow) { color: var(--color-muted); font-size: .95rem; line-height: 1.6; }
.molecule-steps { display: grid; gap: .65rem; }
.molecule-steps li { display: flex; gap: 1rem; align-items: center; border-bottom: 1px solid var(--color-border); padding-bottom: .65rem; color: var(--color-text); font-size: .95rem; }
.molecule-steps b { color: var(--color-primary); font: .7rem var(--signal-mono, monospace); }
.peptides-page .visual-note { color: var(--color-muted); font-size: .75rem; line-height: 1.6; max-width: none; }
.study-visual, .evidence-map, .evidence-lens { padding: clamp(1.3rem, 3vw, 2.5rem); }
.visual-heading { display: grid; gap: .85rem; max-width: 52rem; margin-bottom: 2rem; }
.study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.study-chart { min-width: 0; margin: 0; padding: 1.4rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 12px; }
.study-chart figcaption { min-height: 8rem; }
.study-name { color: var(--color-primary); font: .7rem var(--signal-mono, monospace); letter-spacing: .1em; }
.study-chart h4 { font: 500 1.2rem/1.2 var(--font-display); margin: .65rem 0 .6rem; color: var(--color-text); }
.study-chart figcaption p { color: var(--color-muted); font-size: .8rem; line-height: 1.5; }
.chart-row { margin: 1rem 0; }
.chart-row > div:first-child { display: flex; gap: .75rem; align-items: baseline; justify-content: space-between; font-size: .8rem; margin-bottom: .5rem; }
.chart-row b { color: var(--color-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-track { height: 1rem; position: relative; background: var(--color-surface-2); border-radius: 3px; overflow: hidden; }
.chart-track i { position: absolute; inset: 0 auto 0 0; display: block; width: var(--bar-width); background: var(--color-primary); }
.chart-track .chart-comparison { background: var(--color-muted); }
.chart-track .chart-range { background: repeating-linear-gradient(120deg, var(--color-primary) 0 3px, var(--color-primary-wash) 3px 7px); }
.chart-axis { display: flex; justify-content: space-between; color: var(--color-muted); font-size: .65rem; padding-top: .4rem; border-top: 1px solid var(--color-border); }
.study-chart .chart-context { color: var(--color-muted); margin-top: 1rem; font-size: .75rem; line-height: 1.65; }
.evidence-map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.evidence-map-grid a { min-width: 0; display: grid; align-content: start; gap: .65rem; padding: 1.1rem; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-bg); }
.evidence-map-grid a:hover { border-color: var(--color-primary); }
.evidence-map-grid b { color: var(--color-primary); font-size: .9rem; line-height: 1.3; font-weight: 500; }
.evidence-map-grid span { color: var(--color-text); font-size: .82rem; }
.evidence-map-grid small { color: var(--color-muted); font-size: .72rem; line-height: 1.5; }
.evidence-photo { margin-top: 2rem; grid-template-columns: .8fr 1.2fr; }
.evidence-photo .peptide-photo { height: 23rem; min-height: 0; }
.evidence-lens figcaption { display: grid; gap: .8rem; max-width: 42rem; margin-bottom: 2rem; }
.lens-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; counter-reset: lens; }
.lens-grid li { display: grid; gap: 1.3rem; padding: 1.25rem; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-bg); }
.lens-grid b { display: grid; place-items: center; border: 1px solid var(--color-primary); border-radius: 50%; width: 2.3rem; height: 2.3rem; color: var(--color-primary); font: .8rem var(--signal-mono, monospace); }
.lens-grid span { font-size: .95rem; line-height: 1.4; color: var(--color-text); }
[data-theme='light'] .peptide-photo { mask-image: linear-gradient(0deg, transparent, #000 8px, #000 calc(100% - 8px), transparent); }
@media (max-width: 900px) {
  .peptide-visual { grid-template-columns: 1fr 1fr; }
  .study-chart { padding: 1rem; }
  .study-chart figcaption { min-height: 9rem; }
  .evidence-map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .peptide-visual, .study-grid { grid-template-columns: 1fr; }
  .peptide-photo, .evidence-photo .peptide-photo { height: 15rem; min-height: 0; }
  .peptide-visual figcaption { padding: 1.4rem; }
  .study-chart figcaption { min-height: 0; margin-bottom: 1.4rem; }
  .evidence-map-grid, .lens-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evidence-map-grid a { padding: .9rem; }
  .lens-grid li { padding: 1rem; }
}
