/* The GLD-E1 model page (research/gld-e1.html), on top of styles.css and about.css: the same
   dark GLD world as the About page (ink, paper, signal yellow, cobalt; sharp corners, fine
   lines), with a vector space instead of the galaxy flight. Charts are HTML bars on one
   shared 0 to 1 scale, GLD-E1 in signal yellow, the comparison in grey. */

.page-research {
  --ref: #8a8a90;
  --kw: #4a4a50;
}

/* ---------- hero ---------- */
.research-hero {
  padding: clamp(120px, 16vh, 180px) 24px clamp(80px, 11vh, 130px);
  background:
    radial-gradient(ellipse at 75% 35%, rgba(27, 51, 214, 0.25), transparent 60%), var(--ink);
}

.research-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.research-hero-text {
  min-width: 0;
}

.research-hero h1 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-size: clamp(36px, 4.4vw, 60px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--paper);
  text-wrap: balance;
}

.research-hero h1 span {
  color: var(--accent-yellow);
}

/* the label sits centred on the number's height, its two lines spanning it */
.hero-figure {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(244, 244, 242, 0.2);
}

.hero-figure-value {
  font-family: var(--display);
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent-yellow);
}

.hero-figure-label {
  max-width: 34ch;
  font-size: 15px;
  line-height: 1.45;
  color: rgba(244, 244, 242, 0.7);
}

.hero-figure-sub {
  color: rgba(244, 244, 242, 0.5);
}

/* ---------- charts ---------- */
.chart {
  margin: 0;
  padding: 26px 0 0;
  border-top: 1px solid rgba(244, 244, 242, 0.2);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(244, 244, 242, 0.7);
}

.key::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  vertical-align: -1px;
}

.key--gld::before {
  background: var(--accent-yellow);
}

.key--ref::before {
  background: var(--ref);
}

.chart-group + .chart-group {
  margin-top: 26px;
}

.chart-group-label {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
}

/* name | track | value; the axis below uses the same three columns */
.bar-row,
.chart-axis {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 56px;
  gap: 14px;
  align-items: center;
}

.bar-row + .bar-row {
  margin-top: 8px;
}

.bar-name {
  font-size: 14px;
  color: rgba(244, 244, 242, 0.78);
}

.bar-track {
  position: relative;
  height: 22px;
  background: rgba(244, 244, 242, 0.05);
}

.bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--v) * 100%);
  min-width: 2px;
}

.bar--gld {
  background: var(--accent-yellow);
}

.bar--ref {
  background: var(--ref);
}

.bar--kw {
  background: var(--kw);
}

.bar-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
}

.chart-axis {
  margin-top: 14px;
}

.chart-ticks {
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid rgba(244, 244, 242, 0.2);
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(244, 244, 242, 0.45);
}

.chart figcaption {
  margin-top: 18px;
  max-width: 70ch;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(244, 244, 242, 0.55);
}

/* ---------- the methodology and its results tables ---------- */
/* the methodology: one quiet disclosure bar between two rules, opening in place */
.method-section {
  padding-block: clamp(48px, 7vh, 80px);
}

.method {
  border-top: 1px solid rgba(244, 244, 242, 0.2);
  border-bottom: 1px solid rgba(244, 244, 242, 0.2);
}

.method summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  list-style: none;
  cursor: pointer;
}

.method summary::-webkit-details-marker {
  display: none;
}

.method summary:focus-visible {
  outline: 2px solid var(--accent-yellow);
  outline-offset: 3px;
}

.method-heading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.method-title {
  font-family: var(--display);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--paper);
}

/* a plus that turns into a minus when open */
.method-toggle {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(244, 244, 242, 0.4);
}

.method-toggle::before,
.method-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--accent-yellow);
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease;
}

.method-toggle::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.method[open] .method-toggle::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.method summary:hover .method-toggle {
  border-color: var(--accent-yellow);
}

.method[open] > :last-child {
  margin-bottom: 28px;
}

.page-research table {
  width: 100%;
  max-width: 720px;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--paper);
}

.page-research caption {
  margin-bottom: 8px;
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(244, 244, 242, 0.55);
}

.page-research th,
.page-research td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(244, 244, 242, 0.12);
  text-align: left;
  font-weight: 400;
}

.page-research thead th {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(244, 244, 242, 0.6);
}

.page-research td {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- model: the pipeline and the specs ---------- */

/* From the law to the search: one line through numbered stations, GLD-E1 in signal yellow,
   a light pulse travelling along the line (still under reduced motion). Vertical on phones. */
.pipeline {
  --node-y: 36px; /* the line's height: number row + gap + half a node */
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0 0 48px;
  padding: 0;
  list-style: none;
  overflow: hidden; /* the pulse leaves at the right edge */
}

.pipeline--short {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 40px;
}

.pipeline::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 0;
  top: var(--node-y);
  height: 1px;
  background: rgba(244, 244, 242, 0.28);
}

.pipeline::after {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--node-y) - 1px);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-yellow), transparent);
  animation: pipeline-pulse 4.5s linear infinite;
}

@keyframes pipeline-pulse {
  from {
    left: -80px;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  to {
    left: 100%;
    opacity: 0;
  }
}

.pipeline li {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pipeline-num {
  height: 18px;
  margin-bottom: 11px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(244, 244, 242, 0.45);
}

.pipeline-node {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(244, 244, 242, 0.7);
  background: var(--ink);
}

.pipeline-label {
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.pipeline-sub {
  max-width: 26ch;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(244, 244, 242, 0.6);
}

.pipeline .is-model .pipeline-num,
.pipeline .is-model .pipeline-label {
  color: var(--accent-yellow);
}

.pipeline .is-model .pipeline-node {
  border-color: var(--accent-yellow);
  background: var(--accent-yellow);
  box-shadow: 0 0 0 6px rgba(234, 255, 0, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .pipeline::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .pipeline,
  .pipeline--short {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
  .pipeline li {
    padding-left: 34px;
  }
  .pipeline::before {
    left: 7px;
    right: auto;
    top: 8px;
    bottom: 8px;
    width: 1px;
    height: auto;
  }
  .pipeline::after {
    display: none;
  }
  .pipeline-num {
    height: auto;
    margin-bottom: 4px;
  }
  .pipeline-node {
    position: absolute;
    left: 0;
    top: 2px;
    margin: 0;
  }
}

.specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid rgba(244, 244, 242, 0.24);
}

.specs div {
  display: flex;
  flex-direction: column;
  padding: 24px 24px 0 0;
}

.specs div + div {
  padding-left: 24px;
  border-left: 1px solid rgba(244, 244, 242, 0.1);
}

.specs dd {
  order: -1;
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent-yellow);
}

.specs dt {
  font-size: 14px;
  color: rgba(244, 244, 242, 0.7);
}

/* ---------- second test set: the figure beside its chart ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.split-figure {
  margin: 26px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(244, 244, 242, 0.7);
}

.split-figure span {
  display: block;
  margin-bottom: 8px;
  font-family: var(--display);
  font-size: clamp(48px, 5.4vw, 72px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent-yellow);
}

.caveat {
  max-width: 70ch;
  margin: 22px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent-yellow);
  background: rgba(244, 244, 242, 0.04);
  font-size: 14px;
  line-height: 1.6;
  color: rgba(244, 244, 242, 0.8);
}

/* ---------- methodology ---------- */
.method-list {
  max-width: 78ch;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.method-list li {
  padding: 12px 0;
  border-bottom: 1px solid rgba(244, 244, 242, 0.1);
  font-size: 15px;
  line-height: 1.65;
  color: rgba(244, 244, 242, 0.78);
}

.method-list strong {
  color: var(--paper);
}

.method-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: rgba(244, 244, 242, 0.55);
}

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .research-hero-inner,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .bar-row,
  .chart-axis {
    grid-template-columns: 92px minmax(0, 1fr) 48px;
    gap: 10px;
  }
  .bar-name {
    font-size: 12.5px;
  }
  .specs {
    grid-template-columns: minmax(0, 1fr);
  }
  .specs div,
  .specs div + div {
    padding: 20px 0 0;
    border-left: none;
  }
  .page-research .results {
    display: block;
    overflow-x: auto;
  }
}
