/* =========================================================
   PROJECT PAGE  (load AFTER styles.css)
   Uses the same tokens, fonts, buttons, pills, stats and
   footer already defined in styles.css.
========================================================= */

/* ---------- header ---------- */
main[data-project-detail] [hidden] { display: none !important; }
html.project-route-pending main[data-project-detail] { display: none; }
.project-route-loading {
  display: none;
  min-height: 60vh;
  padding: 48px var(--gutter-x);
  place-content: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: var(--fs-body);
  text-align: center;
}
html.project-route-pending .project-route-loading {
  display: grid;
}
.project-route-loading.is-visible { display: grid; }
.project-route-loading a { color: var(--color-blue); text-underline-offset: 3px; }
.project-head {
  padding-top: 20px;
  padding-bottom: var(--space-2xl);
  max-width: none;
  margin: 0;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
}
.project-back {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.project-back:hover { color: var(--color-blue); }

.project-head .work-card-meta { justify-content: center; flex-wrap: wrap; }

.project-title {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  font-weight: 500;
  font-size: var(--fs-h1);
  line-height: 1.15;
}
.project-title .serif-italic { font-size: var(--fs-h1-serif); }
.project-title .project-title__blue {
  color: var(--color-blue);
  font-size: var(--fs-h3);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.project-lede {
  max-width: 560px;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ---------- cover ---------- */
.project-cover {
  max-width: none;
  margin: 0;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  padding-bottom: var(--space-xl);
}
.project-cover .work-card-image {
  min-height: 0;
  aspect-ratio: 16 / 11;
}
.project-cover .work-card-image img {
  position: absolute;
  inset: 0;
  object-position: center top;
}

/* ---------- snapshot ---------- */
.snapshot {
  max-width: none;
  margin: 0;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  padding-bottom: var(--space-section);
}
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid var(--color-border);
  background: #fff;
}
.snapshot-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border-right: 1.5px solid var(--color-border);
}
.snapshot-cell:last-child { border-right: 0; }
.snapshot-label {
  font-size: var(--fs-small);
  line-height: 1.3;
  color: var(--color-text-muted);
}
.snapshot-value {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
}

/* ---------- TL;DR ---------- */
.tldr {
  max-width: none;
  margin: 0;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  padding-bottom: var(--space-section);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-xl);
}
.tldr .work-stats { gap: 46px; }

/* ---------- case sections ---------- */
.case {
  max-width: none;
  margin: 0;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  padding-top: var(--space-section-sm);
  padding-bottom: var(--space-section-sm);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-xl);
}
.case-title {
  font-size: var(--fs-h2);
  font-weight: 500;
  line-height: 1.15;
  position: sticky;
  top: 32px;
  align-self: start;
}
.case-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}
.case-body > p,
.prose {
  max-width: 640px;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--color-text-muted);
}
.case-body strong { color: var(--color-text); font-weight: 600; }

/* figures */
.figure {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.figure-frame {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--color-border);
  overflow: hidden;
}
.figure-frame img { display: block; width: 100%; height: auto; }
.figure-frame--pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5px;
  background: var(--color-border);
}
.figure-caption {
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* decisions */
.decisions { display: flex; flex-direction: column; gap: var(--space-2xl); }
.decision { display: flex; flex-direction: column; gap: 16px; }
.decision-num {
  font-size: 32px;
  line-height: 1;
  color: var(--color-blue);
}
.decision h3 {
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.15;
  max-width: 560px;
}
.decision > p {
  max-width: 640px;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--color-text-muted);
}
.tradeoff {
  max-width: 640px;
  background: #fff;
  border: 1.5px solid var(--color-border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tradeoff-label {
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-blue);
}
.tradeoff p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* outcome table */
.results {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--color-border);
  background: #fff;
  max-width: 640px;
}
.result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--color-border);
}
.result-row:last-child { border-bottom: 0; }
.result-row span:first-child {
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text-muted);
}
.result-value { font-size: var(--fs-stat); line-height: 1.1; }
.results-note {
  max-width: 640px;
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* ---------- dark: what I'd change ---------- */
.case-dark {
  background: var(--color-dark);
  color: #fff;
  padding-top: var(--space-section);
  padding-bottom: var(--space-section);
}
.case-dark-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
}
.case-dark h2 {
  font-size: var(--fs-h2);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.case-dark h2 .serif-italic {
  color: var(--color-blue-light);
  letter-spacing: normal;
}
.case-dark .results {
  background: transparent;
  border-color: rgba(244, 246, 248, .2);
}
.case-dark .result-row { border-color: rgba(244, 246, 248, .16); }
.case-dark .result-row span:first-child,
.case-dark .results-note,
.case-dark .prose { color: rgba(244, 246, 248, .75); }
.case-dark .result-value { color: #fff; }
.case-dark .btn--outline {
  border-color: var(--color-blue-light);
  color: var(--color-blue-light);
}
.reflect-list { display: flex; flex-direction: column; gap: 28px; }
.reflect-item { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.reflect-item h3 { font-size: 20px; font-weight: 700; line-height: 1.15; letter-spacing: -0.04em; }
.reflect-item p {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: rgba(244, 246, 248, 0.75);
}

/* ---------- next project ---------- */
.next-project {
  max-width: none;
  margin: 0;
  padding-top: var(--space-section);
  padding-bottom: var(--space-section);
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.next-project.case-dark { border-top: 1px solid rgba(244, 246, 248, .16); }
.next-project .work-card-meta { justify-content: center; }
.next-project h2 {
  max-width: 720px;
  font-size: var(--fs-h2);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.next-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .project-cover .work-card-image { aspect-ratio: 16 / 11; }
  .snapshot-grid { grid-template-columns: repeat(2, 1fr); }
  .snapshot-cell:nth-child(2) { border-right: 0; }
  .snapshot-cell:nth-child(-n + 2) { border-bottom: 1.5px solid var(--color-border); }
  .snapshot { padding-bottom: 64px; }

  .tldr, .case, .case-dark-inner { grid-template-columns: 1fr; gap: 24px; }
  .tldr { padding-bottom: 64px; }
  .case { padding-top: 56px; padding-bottom: 56px; }
  .case-title { position: static; }
  .case-dark { padding-top: 64px; padding-bottom: 64px; }
  .next-project { padding-top: 64px; padding-bottom: 72px; }
}

@media (max-width: 640px) {
  .project-head { padding-top: 40px; padding-bottom: 36px; gap: 20px; }
  .project-cover { padding-bottom: 28px; }
  .project-cover .work-card-image { aspect-ratio: 4 / 3; }
  .snapshot-cell { padding: 16px; }
  .snapshot-value { font-size: 14px; }
  .tldr .work-stats { gap: 12px 28px; }
  .decisions { gap: 44px; }
  .next-actions .btn { flex: 1 1 auto; }
}

/* anchor lands below the fixed mobile bar */
#project { scroll-margin-top: 72px; }