/* ── Case study pages — Augusto Bastos ──
   Loaded after portfolio.css, so the nav, footer, buttons, fonts and tokens are
   the homepage's own. This file only lays out the long-form parts, using the
   same vocabulary: Lato headings, green labels, --border lines, --bg-alt panels. */

.nowrap { white-space: nowrap; }

.case-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
}

/* ── Header ── */
.case-hero {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 112px 0 var(--section-pad-y);
}

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; margin-bottom: 18px;
  font-weight: 700; font-size: 0.9rem;
}

.case-hero h1 {
  font-family: 'Lato', var(--font);
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 900; letter-spacing: -1px; line-height: 1.05;
  color: var(--text);
  margin: 4px 0 12px;
}

.case-hero .lede {
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
  font-weight: 700; line-height: 1.5;
  color: var(--green-dark);
  max-width: 62ch;
}
[data-theme="dark"] .case-hero .lede { color: var(--green-light); }

.case-facts {
  margin-top: 32px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px 32px;
}
.case-facts div { border-top: 1px solid var(--border); padding-top: 12px; }
.case-facts dt {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green-text);
}
.case-facts dd { margin-top: 6px; font-size: 0.92rem; line-height: 1.55; color: var(--text); }

/* ── Body: contents list + article ── */
.case-body {
  display: grid; grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px; align-items: start;
  padding-top: var(--section-pad-y); padding-bottom: calc(var(--section-pad-y) + 16px);
}

.toc { position: sticky; top: 88px; font-size: 0.88rem; }
.toc h2 {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.toc ol { list-style: none; display: grid; gap: 2px; }
.toc a { display: block; padding: 6px 0; color: var(--text-muted); transition: color 0.2s; }
.toc a:hover { color: var(--green-text); }

.prose { max-width: 70ch; line-height: 1.7; color: var(--text-muted); }
.prose > section + section { margin-top: 64px; }
.prose h2 {
  font-family: 'Lato', var(--font);
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 900; letter-spacing: -0.5px; line-height: 1.2;
  color: var(--text); margin-bottom: 16px;
}
.prose h3 {
  font-family: 'Lato', var(--font);
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin: 28px 0 8px;
}
.prose p + p { margin-top: 14px; }
.prose ul { padding-left: 1.2em; display: grid; gap: 8px; margin-top: 12px; }
.prose strong { color: var(--text); }
.prose code {
  font-family: Consolas, 'Cascadia Mono', monospace; font-size: 0.88em;
  background: var(--surface); border-radius: 4px; padding: 1px 5px;
  overflow-wrap: anywhere;
}
.prose figure { margin-top: 24px; }

/* Diagram panel: same border and radius as the homepage project cards. */
.figure {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}
.figure > figcaption:first-child {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green-text); margin-bottom: 18px;
}

.flow { list-style: none; padding: 0 !important; display: grid; gap: 0 !important; margin: 0 !important; }
.flow li { position: relative; padding: 0 0 20px 32px; }
.flow li:last-child { padding-bottom: 0; }
.flow li::before {
  content: ""; position: absolute; left: 5px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--green);
}
.flow li::after {
  content: ""; position: absolute; left: 10px; top: 22px; bottom: 2px;
  width: 2px; background: var(--border);
}
.flow li:last-child::after { display: none; }
.flow li.is-key::before { background: var(--green); }
.flow strong { display: block; font-family: 'Lato', var(--font); font-weight: 700; color: var(--text); }
.flow li > span { display: block; font-size: 0.93rem; line-height: 1.55; }

.shot {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--thumb-bg-navy);
}
.shot img { display: block; width: 100%; height: auto; }
.shot-caption { margin-top: 10px; font-size: 0.85rem; color: var(--text-muted); }

.decisions { list-style: none; padding: 0 !important; gap: 0 !important; margin-top: 8px !important; }
.decisions li { padding: 18px 0; border-top: 1px solid var(--border); }
.decisions li:last-child { border-bottom: 1px solid var(--border); }
.decisions strong { display: block; font-family: 'Lato', var(--font); margin-bottom: 4px; }
.decisions .cost { display: block; margin-top: 6px; font-size: 0.9rem; font-style: italic; }

.incident {
  margin-top: 16px; padding: 18px 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.incident h3 { margin: 0 0 10px; }
.incident dl { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 6px 14px; }
.incident dt {
  padding-top: 3px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--green-text);
}
.incident dd { font-size: 0.95rem; line-height: 1.6; }

.next-case {
  margin-top: 64px; padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
}
.next-case .back-link { margin-bottom: 0; }
.next-case .btn-outline { text-align: center; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .case-body { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .toc {
    position: static;
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px;
  }
}

@media (max-width: 768px) {
  .case-inner { padding-left: 20px; padding-right: 20px; }
  .case-hero { padding-top: 92px; }
  .figure { padding: 20px 18px; }
  .back-link, .toc a { min-height: 44px; }
  .toc a { padding-block: 10px; }
}

@media (max-width: 560px) {
  .incident { padding: 16px; }
  .incident dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .incident dd + dt { margin-top: 8px; }
}
