/* Section 08: closing call to action, authors, and citation. */

@property --spot {
  syntax: "<color>";
  inherits: true;
  initial-value: transparent;
}

/* Small secondary text here sits on card surfaces, so it uses a slightly brighter muted tone (about 5.8:1). */
#use { --muted-2: #8190a6; }

/* ---------- Closing card ---------- */
.cta {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 36px clamp(32px, 4.4vw, 60px); align-items: center;
  padding: clamp(28px, 4.6vw, 60px);
  border-radius: 30px; border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(53, 208, 240, 0.5), rgba(139, 124, 246, 0.16) 34%, rgba(139, 124, 246, 0.1) 62%, rgba(227, 93, 159, 0.42)) border-box;
  box-shadow: var(--shadow-lg);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1), --spot .45s ease;
}
.cta.is-lit { --spot: rgba(139, 124, 246, 0.1); }
/* Corner glows and a pointer spotlight. */
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(440px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 70%),
    radial-gradient(520px 360px at 0% 0%, rgba(53, 208, 240, 0.13), transparent 70%),
    radial-gradient(460px 340px at 100% 0%, rgba(139, 124, 246, 0.11), transparent 70%),
    radial-gradient(560px 380px at 100% 100%, rgba(227, 93, 159, 0.1), transparent 70%);
}
/* Faint lattice behind the headline: the benchmark's grid motif. */
.cta::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(160, 180, 220, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160, 180, 220, 0.07) 1px, transparent 1px);
  background-size: 34px 34px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(60% 85% at 0% 0%, #000, transparent 72%);
  mask-image: radial-gradient(60% 85% at 0% 0%, #000, transparent 72%);
}
.cta-copy, .cta-code { min-width: 0; }

.cta-head { display: block; max-width: none; margin: 0; }
.cta-head .sec-num { margin: 0 0 24px; }
.cta-head h2 { font-size: clamp(38px, 4.6vw, 60px); line-height: 1; text-wrap: balance; }
.cta-head p { margin: 20px 0 0; font-size: 17.5px; line-height: 1.6; max-width: 27em; }

.cta-res {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding-top: 24px; border-top: 1px solid var(--line);
}
.res-note { margin-left: auto; font-size: 13px; color: var(--muted-2); }
.res-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 7px 0 13px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.025);
  font-size: 13.5px; color: var(--text-2); white-space: nowrap; cursor: default;
}
.res-pill[href] { cursor: pointer; text-decoration: none; }
.res-pill[href]:hover { color: var(--text); border-color: var(--accent); }
.res-pill[href]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.res-pill svg { width: 15px; height: 15px; flex: none; }
.res-host { color: var(--muted-2); margin-left: -3px; }
.res-pill .soon { margin-left: 3px; }

/* Tabbed commands. Panels share one grid cell so switching tabs never moves the page. */
.cta-code { display: flex; flex-direction: column; gap: 14px; }
.cta-tabs { display: flex; }
.cta-panels { display: grid; }
.cta-panel {
  grid-area: 1 / 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 12px;
  visibility: hidden; opacity: 0; transform: translateY(4px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.cta-panel.is-active { visibility: visible; opacity: 1; transform: none; transition: opacity .22s ease, transform .22s ease; }
.cta .code {
  --pad: 20px;
  padding: 54px var(--pad) 20px; border-radius: 16px; font-size: 13px; line-height: 1.75;
  overflow: hidden; border-color: var(--line-strong);
  background: linear-gradient(var(--line), var(--line)) 0 40px / 100% 1px no-repeat, var(--code-bg);
}
.cta .code::before {
  content: attr(data-lang); position: absolute; top: 13px; left: var(--pad);
  font: 500 11.5px/1 var(--font-mono); color: var(--muted-2);
}
.cta .code .copy { top: 7px; right: 8px; }
/* Long lines scroll inside the block while the label and copy button stay put. */
.code-lines { display: block; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 2px; overflow-x: auto; scrollbar-width: thin; }
.code-lines:focus-visible { outline-offset: -2px; }
.code-lines .ln { --hang: 2ch; }
.code-lines.has-more {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
#use .code .f { color: #c4b5fd; }
.cta-note { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-2); text-wrap: balance; }
.cta-note code {
  font: 400 12px/1 var(--font-mono); color: var(--text); padding: 2px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.cta-eg { display: block; margin-top: 7px; }
.cta-note .info { margin-left: 4px; }
.tooltip .tt-line { color: var(--text-2); line-height: 1.5; }
.tooltip .tt-line + .tt-line { margin-top: 5px; }
.tooltip .tt-code { font: 500 11px/1 var(--font-mono); color: var(--text); white-space: nowrap; }

/* ---------- Authors and citation ---------- */
.cite { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.cite-card { position: relative; isolation: isolate; overflow: hidden; padding: 30px 32px 32px; border-radius: 24px; min-width: 0; }
.cite-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(380px 240px at 0% 0%, rgba(53, 208, 240, 0.08), transparent 70%);
}
.cite-card + .cite-card::before { background: radial-gradient(380px 240px at 100% 0%, rgba(139, 124, 246, 0.1), transparent 70%); }
.cite-card.is-in {
  transition: opacity .8s ease, transform .35s cubic-bezier(.2, .7, .2, 1), border-color .25s, box-shadow .25s;
}
.cite-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.cite-card h3 { margin: 0 0 16px; font: 600 22px/1.2 var(--font-display); letter-spacing: -0.015em; }

.author-list { list-style: none; margin: 0; padding: 0; font-size: 16.5px; line-height: 2; color: var(--text); }
.author-list li { display: inline-block; margin-right: 0.9em; white-space: nowrap; transition: opacity .2s, color .2s; }
.author-list sup, .affil-legend sup { font-size: 0.64em; line-height: 0; color: var(--muted-2); font-feature-settings: "tnum"; }
.author-list sup { margin-left: 0.1em; }
.author-list[data-hl] li { opacity: 0.3; }
.author-list[data-hl] li.is-hl { opacity: 1; color: #fff; }
.author-list[data-hl] li.is-hl sup { color: var(--accent); }

.affil-legend {
  list-style: none; margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13.5px; line-height: 1.7; color: var(--text-2);
}
.affil-legend button {
  margin: 0 -5px; padding: 0 5px; border: 0; border-radius: 6px; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer; transition: color .2s, background-color .2s;
}
.affil-legend sup { margin-right: 0.3em; }
.affil-legend button:hover, .affil-legend button:focus-visible, .affil-legend button[aria-pressed="true"] { color: var(--text); }
.affil-legend button:hover sup, .affil-legend button:focus-visible sup, .affil-legend button[aria-pressed="true"] sup { color: var(--accent); }
.affil-legend button[aria-pressed="true"] { background: rgba(53, 208, 240, 0.08); }
.affil-legend button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cite-meta { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13.5px; line-height: 1.55; }
.cite-meta div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 12px; }
.cite-meta dt { color: var(--muted-2); }
.cite-meta dd { margin: 0; color: var(--text-2); }
/* Two license items; the separator dot sits in the gap and is clipped when the second item wraps to a new line. */
.cite-meta .lic { display: flex; flex-wrap: wrap; column-gap: 1.3em; overflow: hidden; }
.cite-meta .lic .li { position: relative; }
.cite-meta .lic .li ~ .li::before { content: "\00B7" / ""; position: absolute; left: -0.9em; color: var(--muted-2); }
.cite-meta a { color: var(--text); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.cite-meta a:hover { text-decoration-color: var(--accent); }

.code.bib { white-space: pre-wrap; font-size: 12.5px; line-height: 1.7; border-radius: 14px; }
.code.bib .bl { display: block; padding-left: var(--hang, 0); text-indent: calc(-1 * var(--hang, 0)); }

@media (max-width: 1100px) {
  .cta { grid-template-columns: minmax(0, 1fr); align-items: start; }
  /* Single column: the tabs sit above the panel, so each panel can take its natural height. */
  .cta-panel { display: none; }
  .cta-panel.is-active { display: flex; }
  .res-note { margin-left: 0; flex-basis: 100%; margin-top: 2px; }
  .cite { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cta { border-radius: 24px; padding: 28px 18px 20px; }
  .cta::after { -webkit-mask-image: radial-gradient(90% 50% at 0% 0%, #000, transparent 72%); mask-image: radial-gradient(90% 50% at 0% 0%, #000, transparent 72%); }
  .cta-head p { font-size: 16.5px; }
  .cta .code { --pad: 16px; font-size: 12px; padding-bottom: 16px; }
  /* Phones wrap long lines with a hanging indent instead of scrolling; copy still returns the exact text. */
  .cta .code-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
  .cta .code-lines .ln { display: block; padding-left: var(--hang); text-indent: calc(-1 * var(--hang)); }
  .cta .code-lines .nb { white-space: nowrap; }
  .cta-note code { font-size: 11px; }
  .res-pill { gap: 6px; padding: 0 6px 0 11px; font-size: 13px; }
  .cite-card { padding: 24px 20px 24px; border-radius: 22px; }
  .author-list { font-size: 15.5px; line-height: 1.95; }
  .cite-meta div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .code.bib { font-size: 11.5px; }
}
/* Very narrow phones: keep the three tabs on one row. */
@media (max-width: 380px) {
  .cta-tabs .seg { display: flex; width: 100%; flex-wrap: nowrap; }
  .cta-tabs .seg button { flex: 1 1 auto; padding: 7px 6px; font-size: 12.5px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .cta-panel, .cta-panel.is-active { transform: none; transition: none; }
}
