/* ================================================================
   RECAI Labs — the paper page (/research/…)
   Loaded after /styles.css, which holds the design tokens.

   A reading page, not a marketing page: one column, generous measure,
   and the only colour that moves is the one carrying information (the
   overhead badges on the stack).
   ================================================================ */

.paper { padding: 36px 0 110px; }
.paper .container { max-width: 880px; }

.paper-back {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.paper-back:hover { color: var(--signal); text-decoration: none; }

/* ---- Masthead ----------------------------------------------------- */

.paper-head {
  padding-bottom: 36px;
  border-bottom: 1px solid var(--hairline);
}

.paper-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.paper-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 600;
  font-stretch: 112%;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 20px;
  max-width: 24ch;
}

.paper-authors {
  margin-top: 24px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--paper-dim);
}
.paper-authors sup { font-size: 11px; color: var(--slate); }

/* The one name that is ours. Marked, not shouted — this is a six-author
   paper and the page should not read as though it were not. */
.paper-author-ours { color: var(--ink); font-weight: 500; }

.paper-affil {
  margin-top: 12px;
  display: grid;
  gap: 3px;
  font-size: 14px;
  color: var(--slate);
}
.paper-affil sup { font-size: 10px; }
.paper-equal { color: var(--slate); opacity: 0.8; }

.paper-meta {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 36px;
}
.paper-meta div { display: grid; gap: 3px; }
.paper-meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}
.paper-meta dd { margin: 0; font-size: 14.5px; }
.paper-meta a { color: var(--signal); }

/* ---- Actions ------------------------------------------------------- */

.paper-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

/* .btn-outline now lives in styles.css — see the note beside .btn there. */

/* The toggle only exists once paper.js has wired it up. Without that it
   would be a button that does nothing in front of a panel that cannot
   open — worse than no button at all. */
html:not(.paper-js) #summary-toggle { display: none; }

/* ---- Summary panel -------------------------------------------------- */

.summary-panel {
  margin-top: 34px;
  padding: 30px 32px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(224, 179, 71, 0.05), rgba(224, 179, 71, 0.012)),
    var(--surface);
}
.summary-panel[hidden] { display: none; }
.summary-panel:focus { outline: none; }

.summary-head {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--gold);
}
.summary-panel p { margin-top: 15px; color: var(--paper-dim); line-height: 1.68; }
.summary-panel strong { color: var(--ink); font-weight: 600; }
.summary-panel em { font-style: italic; }

.summary-note {
  margin-top: 22px !important;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  font-size: 13.5px;
  color: var(--slate) !important;
}

/* ---- Sections -------------------------------------------------------- */

.paper-section { margin-top: 64px; }

.paper-h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: -0.01em;
}

.paper-lede {
  margin-top: 14px;
  color: var(--slate);
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 68ch;
}

.paper-abstract {
  margin: 22px 0 0;
  padding: 28px 30px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: #332640;
}
.paper-abstract p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink);
}

/* ---- The lifecycle flow ---------------------------------------------- */

.flow {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.flow-stage {
  position: relative;
  padding: 24px 26px 24px 30px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(224, 179, 71, 0.10);
}

/* The connector between stages. Drawn on the element rather than between
   them so the last one simply has none, with no :last-child exception to
   get wrong. */
.flow-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 1px;
  height: 14px;
  background: linear-gradient(180deg, var(--gold), transparent);
}
.flow-stage:last-child::after { display: none; }

.flow-n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.flow-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-top: 5px;
}
.flow-body { margin-top: 12px; color: var(--slate); font-size: 15.5px; line-height: 1.6; }

.flow-io {
  margin-top: 10px;
  font-size: 14px;
  color: var(--paper-dim);
}
.flow-io span {
  display: inline-block;
  min-width: 34px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}
.flow-out { color: var(--ink); }
.flow-out span { color: var(--gold); }

/* ---- The two loops ---------------------------------------------------- */

.flow-loops {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.loop {
  padding: 20px 22px;
  border: 1px dashed var(--hairline-dark);
  border-radius: 4px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--slate);
}
.loop strong { display: block; margin: 6px 0 6px; color: var(--ink); font-weight: 600; font-size: 15.5px; }
.loop-path {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.loop-monitor .loop-path { color: var(--amber); }
.loop-safety .loop-path { color: var(--rose-text); }

/* ---- The layer stack --------------------------------------------------- */

.stack { margin-top: 30px; display: grid; gap: 14px; }

.layer {
  padding: 24px 26px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--hairline-dark);
  border-radius: 4px;
  background: var(--surface);
}
/* Each layer takes a different left edge, so the stack is scannable by
   colour before it is read. Deliberately follows the overhead, not the
   number: the eye should pick out "expensive" first. */
.layer-1 { border-left-color: #56D98A; }
.layer-2 { border-left-color: var(--rose-text); }
.layer-3 { border-left-color: var(--amber); }
.layer-4 { border-left-color: var(--amber); }
.layer-5 { border-left-color: var(--gold); }

.layer-n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}
.layer-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-top: 5px;
}
.layer-role { margin-top: 8px; font-size: 16px; color: var(--ink); }

.layer-sees,
.layer-methods,
.layer-out {
  margin-top: 11px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--slate);
}
.layer-sees span,
.layer-methods span,
.layer-out span {
  display: inline-block;
  min-width: 74px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.layer-cost { margin-top: 16px; font-size: 14px; color: var(--slate); }
.cost {
  display: inline-block;
  margin-right: 9px;
  padding: 3px 9px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.cost-low  { color: #56D98A; }          /* 8.73 on the card */
.cost-mod  { color: var(--amber); }     /* 8.58 */
.cost-high { color: var(--rose-text); } /* 7.25 */
.cost-var  { color: var(--gold); }      /* 8.00 */

.layer-limit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--slate);
  font-style: italic;
}
.layer-limit em { font-style: normal; color: var(--ink); }

.paper-figure-note {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--slate);
  line-height: 1.6;
}

/* ---- The three claims --------------------------------------------------- */

.claims { margin: 26px 0 0; padding: 0 0 0 22px; display: grid; gap: 22px; }
.claims li::marker { color: var(--gold); font-family: var(--font-mono); font-size: 14px; }
.claims h3 {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 600;
  color: var(--ink);
}
.claims p { margin-top: 8px; color: var(--slate); font-size: 15.5px; line-height: 1.65; }

/* ---- Citation ------------------------------------------------------------ */

.cite-block {
  margin-top: 22px;
  padding: 22px 24px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: #130D17;
  overflow-x: auto;
}
.cite-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--paper-dim);
  white-space: pre;
}

/* ---- Close ---------------------------------------------------------------- */

.paper-cta {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
}
.paper-cta p { margin-top: 12px; color: var(--slate); font-size: 16.5px; max-width: 62ch; }
.paper-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-top: 24px;
}

/* ---- Narrow ---------------------------------------------------------------- */

@media (max-width: 620px) {
  .paper-title { max-width: none; }
  .flow-stage, .layer { padding-left: 20px; padding-right: 20px; }
  .summary-panel { padding: 24px 20px; }
  .paper-abstract { padding: 22px 20px; }
  .layer-sees span, .layer-methods span, .layer-out span,
  .flow-io span { display: block; min-width: 0; margin-bottom: 2px; }
}
