/* chshlab/css/layout.css */

/* Gentle scroll snap between beat sections */
main {
  scroll-snap-type: y proximity;
}

/* Container system */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--wide {
  max-width: var(--wide-width);
}

/* Section baseline */
.section {
  padding-block: var(--space-4);
  position: relative;
  z-index: 10;
  scroll-margin-top: 76px;
}

/* Section label (mono tag above heading) */
.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-3);
  display: inline-block;
  padding-inline: 4px 8px;
  box-shadow: inset 0 -0.58em 0 var(--marker-crimson-soft);
}

/* ── BEAT SECTIONS ── */
.beat {
  padding-block: var(--space-4);
  position: relative;
  z-index: 10;
  scroll-margin-top: 76px;
}

.beat--hook {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}

.beat__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--space-4);
  display: inline-block;
  padding-inline: 3px 8px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.16);
}

.beat__title {
  margin-bottom: var(--space-4);
  max-width: 20ch;
  margin-inline: auto;
  text-shadow: var(--ink-shadow);
}

.beat__subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 54ch;
  margin-inline: auto;
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

.beat__byline {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.beat__byline a {
  color: var(--blue);
}

.beat__prose {
  margin-bottom: var(--space-5);
}

.beat__prose p {
  margin-bottom: var(--space-3);
  line-height: 1.75;
}

/* ── EVIDENCE STRIP ── */
.evidence-strip {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.evidence-strip__summary {
  max-width: 62ch;
  margin-bottom: var(--space-5);
  color: var(--text-muted);
}

.evidence-strip__grid {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

@media (min-width: 900px) {
  .evidence-strip__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── FIGURE WRAP ── */
.figure-wrap {
  margin-block: var(--space-5);
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
  box-shadow: var(--paper-shadow-soft);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.figure-wrap::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 248, 230, 0.05);
  pointer-events: none;
}

.figure-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201, 64, 64, 0.55), transparent);
  opacity: 0.7;
  pointer-events: none;
}

.figure-wrap:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* Section-themed figure glow on hover */
.beat--claim .figure-wrap:hover {
  box-shadow: 0 0 40px -12px rgba(79, 163, 212, 0.12);
  border-color: rgba(79, 163, 212, 0.15);
}
.beat--efficiency .figure-wrap:hover {
  box-shadow: 0 0 40px -12px rgba(201, 169, 77, 0.12);
  border-color: rgba(201, 169, 77, 0.15);
}
.beat--loophole .figure-wrap:hover,
.beat--postselection .figure-wrap:hover {
  box-shadow: 0 0 40px -12px rgba(201, 64, 64, 0.12);
  border-color: rgba(201, 64, 64, 0.15);
}
.beat--proof .figure-wrap:hover {
  box-shadow: 0 0 40px -12px rgba(201, 169, 77, 0.15);
  border-color: rgba(201, 169, 77, 0.18);
}
.beat--standards .figure-wrap:hover {
  box-shadow: 0 0 40px -12px rgba(79, 163, 212, 0.12);
  border-color: rgba(79, 163, 212, 0.15);
}

.figure-wrap canvas {
  width: 100%;
  display: block;
}

/* GSAP-failure fallback: if JS doesn't run, show everything */
.no-js .reveal {
  opacity: 1;
  transform: none;
}

.figure-interactive {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 900px) {
  .figure-interactive {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.figure-caption {
  font-size: 0.85rem;
  color: var(--text-subtle);
  line-height: 1.55;
  margin-top: var(--space-3);
}

.figure-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  display: inline-block;
  padding-inline: 2px 8px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.14);
  margin-bottom: var(--space-1);
}

/* ── BOUNDS ROW ── */
.bounds-row {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* ── RESULTS TABLE ── */
.results-table-wrap {
  margin-block: var(--space-5);
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.results-table caption {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-faint);
  text-align: left;
  margin-bottom: var(--space-2);
  font-style: italic;
}

.results-table th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

.results-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
}

.results-table__highlight td {
  color: var(--crimson);
  font-weight: 500;
}

.results-table__muted td {
  color: var(--text-faint);
  font-style: italic;
}

/* ── DIAGNOSTIC LIST ── */
.diagnostic-list {
  margin-block: var(--space-4);
  padding-left: var(--space-5);
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.diagnostic-list li {
  margin-bottom: var(--space-2);
}

/* ── CONCLUSION LINKS ── */
.conclusion-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

.conclusion-link {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.conclusion-link:hover {
  color: var(--text);
  border-color: var(--amber-dim);
  text-decoration: none;
}

.conclusion-link--primary {
  border-color: var(--amber-dim);
  color: var(--amber);
}

.conclusion-link--primary:hover {
  background: rgba(201, 169, 77, 0.08);
  border-color: var(--amber);
}

/* ── BADGE (bounds) ── */
.badge {
  border: 1px solid;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.badge--amber   { border-color: var(--amber);   color: var(--amber); }
.badge--blue    { border-color: var(--blue);    color: var(--blue); }
.badge--crimson { border-color: var(--crimson); color: var(--crimson); }

.badge-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.badge-value {
  font-size: 14px;
  font-weight: 500;
}

/* ── SECTION HEADING + INTRO ── */
.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 500;
  margin-bottom: var(--space-4);
  line-height: 1.15;
  display: inline-block;
  text-shadow: var(--ink-shadow);
  box-shadow: inset 0 -0.18em 0 rgba(201, 64, 64, 0.12);
}

.section-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: var(--space-5);
  line-height: 1.7;
}

/* ── FIGURES GRID ── */
.figures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

/* ── DEMO PANEL INNER (two-col layout) ── */
.demo-panel-inner {
  display: grid;
  gap: var(--space-5);
}

.demo-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.demo-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
}

.demo-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.demo-readouts {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

@media (min-width: 900px) {
  .demo-panel-inner { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ── SECTION RULE (elegant gradient divider) ── */
.section-rule {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-color, var(--blue, #60a5fa)), transparent);
  opacity: 0;
  max-width: 80px;
  margin: var(--space-3) auto;
}

/* Section-themed divider colors */
.section-rule--blue   { --rule-color: var(--blue); }
.section-rule--crimson { --rule-color: var(--crimson); }
.section-rule--amber  { --rule-color: var(--amber); }

/* ── FOOTER AUTHOR (expanded) ── */
.footer-author {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.footer-author a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--blue);
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}

.footer-author a:hover {
  color: #78b7df;
  border-color: rgba(79, 163, 212, 0.35);
  text-decoration: none;
}

@media (max-width: 600px) {
  .beat--hook { text-align: left; }
  .bounds-row { justify-content: flex-start; }
}
