/* ===== why.html — long-form motivation page ===== */

.why-page {
  padding-block: 0 var(--space-9);
}

/* ----- Hero strip ----- */
.why-hero {
  padding-block: calc(var(--nav-height) + var(--space-7)) var(--space-7);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.why-hero .eyebrow {
  margin-bottom: var(--space-3);
  display: inline-block;
}

.why-hero h1 {
  margin-bottom: var(--space-3);
  font-size: clamp(2.25rem, 4vw + 0.5rem, 3.75rem);
  max-width: 16ch;
}

.why-hero__sub {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent-primary);
  font-size: clamp(1.15rem, 1.5vw + 0.5rem, 1.5rem);
  margin-bottom: var(--space-5);
}

.why-hero__framing {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 60ch;
}

/* ----- Two-column layout: sidebar + content ----- */
.why-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-7);
  padding-top: var(--space-7);
}

@media (min-width: 1024px) {
  .why-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: var(--space-8);
  }
}

.why-toc {
  /* page-toc base class provides sticky positioning + active-link styling */
  align-self: start;
}

/* Hide sidebar below 1024 — page-toc already does this, but reinforce */
@media (max-width: 1023px) {
  .why-toc { display: none; }
}

/* ----- Mobile jump-to dropdown ----- */
.why-jumpto {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.95rem;
}

@media (min-width: 1024px) {
  .why-jumpto { display: none; }
}

.why-jumpto summary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.why-jumpto summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--dur-base) var(--ease);
}

.why-jumpto[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.why-jumpto ul {
  list-style: none;
  padding: 0;
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.why-jumpto a {
  display: block;
  padding: var(--space-2) 0;
  color: var(--text-secondary);
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.why-jumpto a:hover {
  color: var(--accent-primary);
}

/* ----- Content article ----- */
.why-content {
  max-width: 900px;
}

.why-section {
  margin-bottom: var(--space-9);
}

.why-section:last-child {
  margin-bottom: 0;
}

.why-section h2,
.why-references h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 2vw + 0.5rem, 2.25rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  scroll-margin-top: 6rem;
  letter-spacing: -0.005em;
}

/* ----- Prose blocks: narrow column for readability ----- */
.why-prose {
  max-width: 70ch;
}

.why-prose p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.why-prose p:last-child {
  margin-bottom: 0;
}

.why-prose strong {
  color: var(--text-primary);
}

/* Inline citation superscripts */
.why-prose sup {
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
  margin-left: 1px;
}

.why-prose sup a {
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.why-prose sup a:hover,
.why-prose sup a:focus-visible {
  color: var(--accent-secondary-hover);
  border-bottom-color: var(--accent-secondary-hover);
}

/* ----- Stat cards ----- */
.why-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-block: var(--space-6);
}

@media (min-width: 600px) {
  .why-stats { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .why-stats { grid-template-columns: repeat(3, 1fr); }
}

.why-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}

.why-stat:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.why-stat__value {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 3vw + 1rem, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  color: var(--accent-primary);
  letter-spacing: -0.01em;
}

.why-stat__label {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
  flex: 1;
}

.why-stat__source {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-secondary);
  text-decoration: none;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--dur-fast) var(--ease);
}

.why-stat__source:hover {
  color: var(--accent-secondary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----- Chart figures ----- */
.why-chart {
  margin-block: var(--space-6);
  padding: var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.why-chart svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.why-chart figcaption {
  margin-top: var(--space-4);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.why-chart figcaption em {
  font-style: italic;
}

/* ----- Chart internal styling (used by the inline SVGs in why.html) ----- */
.why-chart svg text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-muted);
}

.why-chart .axis-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  fill: var(--text-muted);
}

.why-chart .axis-line {
  stroke: var(--border-strong);
  stroke-width: 1;
  fill: none;
}

.why-chart .grid-line {
  stroke: var(--border);
  stroke-opacity: 0.55;
  stroke-width: 1;
}

.why-chart .axis-tick {
  font-size: 11px;
  fill: var(--text-muted);
}

.why-chart .bar-label {
  font-size: 12px;
  fill: var(--text-primary);
}

.why-chart .value-label {
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-serif);
  fill: var(--text-primary);
}

.why-chart .point-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-secondary);
}

.why-chart .data-line {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.why-chart .data-point {
  fill: var(--accent-primary);
}

.why-chart .data-point--accent {
  fill: var(--accent-secondary);
}

.why-chart .bar-electronic {
  fill: var(--accent-primary);
  fill-opacity: 0.85;
}

.why-chart .bar-photonic {
  fill: var(--accent-secondary);
}

.why-chart .bar-projected {
  fill: var(--accent-secondary);
  fill-opacity: 0.35;
  stroke: var(--accent-secondary);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.why-chart .legend-text {
  font-size: 11px;
  fill: var(--text-secondary);
}

/* ----- Chart 1 (training-compute curve) — bespoke classes -----
   Separate from the generic .data-line/.data-point so other charts
   keep their existing styling. */
.why-chart .compute-area {
  fill: var(--accent-primary);
  fill-opacity: 0.06;
  stroke: none;
}

.why-chart .compute-dot {
  fill: var(--accent-primary);
}

.why-chart .compute-dot--milestone {
  fill: var(--accent-secondary);
  stroke: var(--bg-primary);
  stroke-width: 1.5;
}

.why-chart .compute-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  fill: var(--text-secondary);
}

.why-chart .compute-leader {
  stroke: var(--border-strong);
  stroke-opacity: 0.55;
  stroke-width: 1;
  fill: none;
  stroke-linecap: round;
}

.why-chart__placeholder {
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-strong);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ----- Closing block ----- */
.why-closing {
  margin-block: var(--space-9) var(--space-8);
  padding: var(--space-6) var(--space-7);
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  max-width: 70ch;
}

.why-closing p {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.why-closing p:last-child {
  margin-bottom: 0;
}

.why-closing__cta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-style: italic;
}

.why-closing__cta em {
  color: var(--text-secondary);
}

/* ----- References ----- */
.why-references {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.why-references__list {
  list-style: none;
  counter-reset: ref;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.why-references__list li {
  counter-increment: ref;
  padding-left: var(--space-6);
  position: relative;
  scroll-margin-top: 6rem;
}

.why-references__list li::before {
  content: "[" counter(ref) "]";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-secondary);
  font-weight: 500;
}

.why-references__list cite {
  font-style: italic;
  color: var(--text-primary);
}

.why-references__list a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease);
  word-break: break-word;
}

.why-references__list a:hover {
  border-bottom-color: var(--accent-primary);
}

/* Highlight the target reference when linked-to from a footnote.
   Both selectors needed: :target works on direct fragment navigation,
   .is-target-flash is set by main.js after the smooth-scroll handler. */
.why-references__list li:target,
.why-references__list li.is-target-flash {
  background: color-mix(in srgb, var(--accent-secondary) 12%, transparent);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-6);
  transition: background var(--dur-slow) var(--ease);
}

.why-references__list li:target::before,
.why-references__list li.is-target-flash::before {
  left: var(--space-2);
}

/* ----- Visually-hidden helper (for "opens in new tab" affordance) ----- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- Smooth-scroll respect for reduced motion (covered globally, but explicit here) ----- */
@media (prefers-reduced-motion: reduce) {
  .why-stat,
  .why-stat__source,
  .why-prose sup a {
    transition: none;
  }
  .why-stat:hover { transform: none; }
}
