/* EEG Lab — sources and safety */

.sources-app {
  --sources-alert: oklch(0.48 0.15 30);
  --sources-alert-soft: oklch(0.48 0.15 30 / 0.08);
  display: block;
  min-height: 100dvh;
}

html[data-theme="dark"] .sources-app {
  --sources-alert: oklch(0.76 0.11 30);
  --sources-alert-soft: oklch(0.76 0.11 30 / 0.1);
}

.sources-topbar {
  border-bottom: 1px solid var(--lab-line);
  background: color-mix(in srgb, var(--lab-bg) 96%, transparent);
}

.sources-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sources-course-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  padding-inline: 0.8rem;
  color: var(--lab-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.sources-course-link:hover {
  color: var(--lab-ink);
}

.sources-app .eeg-theme-btn {
  min-height: 2.75rem;
}

.sources-main {
  width: min(100%, 72rem);
  margin-inline: auto;
  padding: clamp(8.5rem, 15vw, 12rem) clamp(1.1rem, 4vw, 2.5rem) clamp(5rem, 9vw, 8rem);
}

.sources-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 0.55fr);
  gap: clamp(2.5rem, 8vw, 7rem);
  align-items: end;
}

.sources-hero .eeg-kicker {
  margin-bottom: 1rem;
}

.sources-hero h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--lab-ink);
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(3.7rem, 9vw, 7.5rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 0.92;
}

.sources-hero .eeg-title-rule {
  width: 5rem;
  margin: clamp(1.5rem, 3vw, 2.4rem) 0;
}

.sources-lede {
  max-width: 42rem;
  margin: 0;
  color: var(--lab-ink);
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.3;
}

.sources-intro-note {
  max-width: 33ch;
  margin: 0 0 0.4rem;
  color: var(--lab-muted);
  font-size: 0.98rem;
  line-height: 1.75;
}

.boundaries,
.references {
  margin-top: clamp(6rem, 13vw, 11rem);
}

.section-heading {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: clamp(2rem, 5vw, 3.75rem);
}

.section-number,
.reference-group-index {
  margin: 0;
  color: var(--lab-teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.section-eyebrow,
.boundary-label,
.reference-kind {
  margin: 0 0 0.45rem;
  color: var(--lab-teal);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.section-heading h2,
.trace-provenance h2,
.use-note h2 {
  margin: 0;
  color: var(--lab-ink);
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(2.3rem, 5vw, 4rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block: 1px solid var(--lab-line);
}

.boundary-note {
  padding: clamp(2rem, 5vw, 3.75rem) clamp(1rem, 4vw, 3.5rem) clamp(2rem, 5vw, 3.75rem) 0;
}

.boundary-note + .boundary-note {
  border-left: 1px solid var(--lab-line);
  padding-right: 0;
  padding-left: clamp(1rem, 4vw, 3.5rem);
}

.boundary-note--safety {
  background: linear-gradient(135deg, transparent 0 58%, var(--sources-alert-soft) 58% 100%);
}

.boundary-note--safety .boundary-label {
  color: var(--sources-alert);
}

.boundary-note h3 {
  max-width: 18ch;
  margin: 0 0 1.2rem;
  color: var(--lab-ink);
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(1.75rem, 3.4vw, 2.55rem);
  font-weight: 650;
  line-height: 1.08;
}

.boundary-note p:last-child,
.trace-provenance p:last-child,
.use-note p:last-child {
  max-width: 66ch;
  margin: 0;
  color: var(--lab-muted);
  line-height: 1.75;
}

.trace-provenance {
  display: grid;
  grid-template-columns: minmax(10rem, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
  margin-top: clamp(5rem, 10vw, 8rem);
  padding: clamp(2rem, 5vw, 4rem);
  border: 1px solid var(--lab-line);
  background: var(--lab-soft);
}

.trace-mark {
  color: var(--lab-teal);
}

.trace-mark svg {
  display: block;
  width: 100%;
}

.trace-provenance h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3.25rem);
}

.reference-group {
  display: grid;
  grid-template-columns: minmax(12rem, 0.38fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
  border-top: 1px solid var(--lab-line);
}

.reference-group:last-child {
  border-bottom: 1px solid var(--lab-line);
}

.reference-group-heading {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-content: start;
}

.reference-group-heading h3 {
  max-width: 14ch;
  margin: 0;
  color: var(--lab-ink);
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 650;
  line-height: 1.15;
}

.reference-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reference-list li + li {
  border-top: 1px solid var(--lab-line);
}

.reference-link {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 2rem;
  gap: 1rem;
  align-items: start;
  min-height: 4.5rem;
  padding-block: 1.35rem;
  color: var(--lab-ink);
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.reference-link:hover {
  background: var(--lab-teal-soft);
  color: var(--lab-ink);
}

.reference-number {
  padding-top: 0.2rem;
  color: var(--lab-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.reference-copy {
  display: grid;
  gap: 0.25rem;
}

.reference-copy strong {
  font-family: var(--font-display, "Literata", serif);
  font-size: clamp(1.25rem, 2.3vw, 1.65rem);
  font-weight: 650;
  line-height: 1.2;
}

.reference-copy > span:last-child {
  max-width: 62ch;
  color: var(--lab-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.reference-kind {
  margin: 0 0 0.15rem;
  font-family: var(--font-body, "Manrope", sans-serif);
}

.reference-arrow {
  color: var(--lab-teal);
  font-size: 1.2rem;
  transition: transform 160ms ease;
}

.reference-link:hover .reference-arrow {
  transform: translate(0.15rem, -0.15rem);
}

.use-note {
  width: min(100%, 45rem);
  margin: clamp(5rem, 10vw, 8rem) 0 0 auto;
}

.use-note h2 {
  margin-bottom: 1.1rem;
  font-size: clamp(2.1rem, 4.3vw, 3.4rem);
}

.sources-footer {
  display: flex;
  width: min(100% - 2.2rem, 72rem);
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 2rem;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-muted);
  font-size: 0.9rem;
}

.sources-footer p {
  margin: 0;
}

.sources-footer a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: var(--lab-teal-strong);
  font-weight: 800;
  text-decoration: none;
}

.sources-footer a:hover {
  color: var(--lab-ink);
}

@media (max-width: 760px) {
  .sources-hero,
  .trace-provenance,
  .reference-group {
    grid-template-columns: 1fr;
  }

  .sources-intro-note {
    max-width: 56ch;
  }

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

  .boundary-note {
    padding-right: 0;
  }

  .boundary-note + .boundary-note {
    border-top: 1px solid var(--lab-line);
    border-left: 0;
    padding-left: 0;
  }

  .trace-mark {
    max-width: 18rem;
  }

  .reference-group {
    gap: 1.75rem;
  }

  .reference-group-heading h3 {
    max-width: 24ch;
  }
}

@media (max-width: 520px) {
  .sources-topbar {
    padding-inline: 0.8rem;
  }

  .sources-topbar-actions {
    gap: 0.2rem;
  }

  .sources-course-link {
    padding-inline: 0.55rem;
  }

  .sources-main {
    padding-top: 7.5rem;
  }

  .sources-hero h1 {
    font-size: clamp(3.25rem, 18vw, 4.7rem);
  }

  .section-heading {
    grid-template-columns: 2rem 1fr;
    gap: 0.75rem;
  }

  .trace-provenance {
    padding: 1.35rem;
  }

  .reference-link {
    grid-template-columns: 2rem minmax(0, 1fr) 1.25rem;
    gap: 0.6rem;
  }

  .reference-copy strong {
    font-size: 1.25rem;
  }

  .sources-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reference-link,
  .reference-arrow {
    transition: none;
  }
}

@media print {
  .sources-topbar,
  .skip-link {
    display: none;
  }

  .sources-main {
    padding-top: 2rem;
  }

  .reference-link {
    color: #111817;
  }
}
