/*
 * CyBehave Lab research note layout.
 *
 * Shared by every page rendered through lab/_article-layout.php. Inherits
 * the site's dark theme through the same CSS variables the CSRA uses
 * (--font-display, --white, --text-muted, --text-faint, --border, --radius),
 * with fallbacks so the page still reads if a variable is missing. The
 * orange accent matches the CSRA and is confined to the constraint panel,
 * the contents marker and links, so it means "act here" and nothing else.
 */

.lab {
  --lab-accent: #FF8C2B;
  --lab-accent-soft: rgba(255, 140, 43, 0.12);
  --lab-measure: 68ch;
  --lab-white: var(--white, #F4F4F2);
  --lab-muted: var(--text-muted, #B4B7BD);
  --lab-faint: var(--text-faint, #7C818A);
  --lab-border: var(--border, rgba(255, 255, 255, 0.12));
  --lab-radius: var(--radius, 10px);
  color: var(--lab-white);
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* --- Meta strip under the hero ------------------------------------------ */

.lab-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--lab-border);
  border-bottom: 1px solid var(--lab-border);
  margin-bottom: 3rem;
}

.lab-meta dt {
  font-size: 0.8125rem;
  color: var(--lab-faint);
  margin-bottom: 0.15rem;
}

.lab-meta dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--lab-muted);
}

.lab-meta dd a {
  color: var(--lab-white);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* --- Two column reading layout ------------------------------------------ */

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
}

@media (min-width: 960px) {
  .lab-grid {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 4rem;
  }
  .lab-side {
    position: sticky;
    top: 6rem;
    align-self: start;
  }
}

/* --- Contents (sidebar) ------------------------------------------------- */

.lab-contents {
  font-size: 0.9rem;
  color: var(--lab-muted);
}

.lab-contents p {
  color: var(--lab-faint);
  font-size: 0.8125rem;
  margin: 0 0 0.75rem;
}

.lab-contents ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--lab-border);
}

.lab-contents li a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.9rem;
  color: inherit;
  text-decoration: none;
  margin-left: -2px;
  border-left: 2px solid transparent;
}

.lab-contents li a:hover,
.lab-contents li a:focus-visible {
  color: var(--lab-white);
  border-left-color: var(--lab-accent);
  outline: none;
}

.lab-side-related {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--lab-border);
  font-size: 0.9rem;
}

.lab-side-related p {
  color: var(--lab-faint);
  font-size: 0.8125rem;
  margin: 0 0 0.5rem;
}

.lab-side-related a {
  color: var(--lab-white);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* --- Article body --------------------------------------------------------- */

.lab-body {
  max-width: var(--lab-measure);
}

.lab-body > * + * {
  margin-top: 1.25rem;
}

.lab-body h2 {
  font-family: var(--font-display, inherit);
  font-size: 1.6rem;
  line-height: 1.25;
  margin-top: 3rem;
  scroll-margin-top: 6rem;
}

.lab-body h2:first-child {
  margin-top: 0;
}

.lab-body h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
}

.lab-body p {
  color: var(--lab-muted);
}

.lab-body strong {
  color: var(--lab-white);
  font-weight: 600;
}

.lab-body a {
  color: var(--lab-white);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--lab-accent);
}

.lab-body a:focus-visible {
  outline: 2px solid var(--lab-accent);
  outline-offset: 3px;
}

/* Abstract */

.lab-abstract {
  padding: 1.5rem 1.75rem;
  border-left: 3px solid var(--lab-accent);
  background: var(--lab-accent-soft);
  border-radius: 0 var(--lab-radius) var(--lab-radius) 0;
}

.lab-abstract p {
  color: var(--lab-white);
  margin: 0;
}

.lab-abstract p + p {
  margin-top: 1rem;
}

/* Tables */

.lab-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin-top: 1.5rem;
}

.lab-body th,
.lab-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--lab-border);
  color: var(--lab-muted);
}

.lab-body th {
  color: var(--lab-white);
  font-weight: 600;
  border-bottom-width: 2px;
}

.lab-body td:first-child {
  color: var(--lab-white);
  white-space: nowrap;
}

.lab-body caption {
  caption-side: bottom;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--lab-faint);
  padding-top: 0.5rem;
}

@media (max-width: 640px) {
  .lab-body td:first-child {
    white-space: normal;
  }
}

/* Worked example */

.lab-example {
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius);
}

.lab-example h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* Editorial note: visible only while draft, remove before publishing */

.lab-draft-note {
  padding: 1rem 1.25rem;
  border: 1px dashed var(--lab-accent);
  border-radius: var(--lab-radius);
  color: var(--lab-accent);
  font-size: 0.9rem;
}

/* --- Call to action panel ------------------------------------------------ */

.lab-cta {
  margin-top: 3.5rem;
  padding: 2rem;
  border-radius: var(--lab-radius);
  border: 1px solid var(--lab-accent);
  display: grid;
  gap: 1rem;
}

.lab-cta h2 {
  margin: 0;
  font-size: 1.35rem;
}

.lab-cta p {
  margin: 0;
  color: var(--lab-muted);
}

.lab-cta .lab-btn {
  justify-self: start;
}

.lab-btn {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  background: var(--lab-accent);
  color: #1A1A1A;
  font-weight: 600;
  text-decoration: none;
}

.lab-btn:hover,
.lab-btn:focus-visible {
  filter: brightness(1.08);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 140, 43, 0.35);
}

/* --- References and citation ------------------------------------------- */

.lab-references {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--lab-border);
}

.lab-references h2 {
  font-size: 1.35rem;
  margin: 0 0 1.25rem;
}

.lab-references ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lab-references li {
  padding-left: 2.5rem;
  text-indent: -2.5rem;
  font-size: 0.9375rem;
  color: var(--lab-muted);
  margin-bottom: 0.9rem;
  overflow-wrap: anywhere;
}

.lab-references li a {
  color: var(--lab-white);
}

.lab-cite {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--lab-radius);
  border: 1px solid var(--lab-border);
  font-size: 0.9rem;
}

.lab-cite p:first-child {
  color: var(--lab-faint);
  font-size: 0.8125rem;
  margin: 0 0 0.5rem;
}

.lab-cite p + p {
  margin: 0;
  color: var(--lab-muted);
  overflow-wrap: anywhere;
}

.lab-back {
  margin-top: 2.5rem;
  font-size: 0.9375rem;
}

.lab-back a {
  color: var(--lab-muted);
  text-decoration: none;
}

.lab-back a:hover,
.lab-back a:focus-visible {
  color: var(--lab-white);
  text-decoration: underline;
}
