/* ==========================================================================
   Case study pages — loaded after style.css
   ========================================================================== */

/* --- Header --------------------------------------------------------------- */
.cs-hero {
  position: relative;
  background: var(--ink-deep);
  padding-block: clamp(130px, 16vw, 180px) clamp(56px, 8vw, 88px);
  overflow: hidden;
}

/* same graph-paper grid as the home hero */
.cs-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(238, 222, 193, 0.075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(238, 222, 193, 0.075) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.cs-hero .shell { position: relative; }

.cs-back {
  display: inline-block;
  margin-bottom: 28px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-decoration: none;
}
.cs-back:hover { color: var(--yellow); }

.cs-hero h1 {
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  max-width: 14ch;
}

.cs-hero__lede {
  margin-top: 24px;
  max-width: 60ch;
  font-size: clamp(1.05rem, 1.8vw, 1.22rem);
  color: var(--cream-dim);
}

.cs-facts {
  margin: 40px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--ink-line);
  border: 1px solid var(--ink-line);
  max-width: 900px;
}
.cs-facts div { background: var(--ink-deep); padding: 16px 18px; }
.cs-facts dt {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-lit);
  margin-bottom: 8px;
}
.cs-facts dd { margin: 0; font-size: 0.95rem; }

/* --- Body ----------------------------------------------------------------- */
.cs-body { padding-block: clamp(56px, 8vw, 96px); }

.cs-body section { padding-block: 0; }   /* override the home page's section padding */

.prose { max-width: 70ch; }
.prose + .prose,
.figure + .prose,
.table-scroll + .prose,
.examples + .prose { margin-top: clamp(56px, 8vw, 88px); }
.table-scroll + .prose:has(> h3:first-child) { margin-top: 8px; }
.cs-body .prose--cont { margin-top: 28px; }   /* text that continues a section after a table/figure */

.prose h2 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}

.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 36px 0 12px;
}

.prose p { color: rgba(238, 222, 193, 0.82); }
.prose p + p { margin-top: 16px; }
.prose strong { color: var(--cream); }

.prose ul.list { margin-top: 16px; display: grid; gap: 10px; }
.prose ul.list + p { margin-top: 16px; }
.prose ul.list li {
  position: relative;
  padding-left: 22px;
  color: rgba(238, 222, 193, 0.82);
}
.prose ul.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  background: var(--yellow);
}

.prose code, .cs-table code {
  font: 500 0.86em/1 var(--mono);
  background: var(--ink-soft);
  padding: 2px 6px;
  color: var(--cream);
}

.callout {
  margin-top: 24px;
  border-left: 3px solid var(--yellow);
  background: var(--ink-soft);
  padding: 18px 22px;
}
.callout p { color: var(--cream); }

/* --- Figures -------------------------------------------------------------- */
.figure { margin: 36px 0 0; max-width: 980px; }
.figure__scroll { overflow-x: auto; border: 1px solid var(--ink-line); background: var(--ink-deep); }
.figure svg { display: block; width: 100%; min-width: 640px; height: auto; }
.figure figcaption {
  margin-top: 12px;
  font: 500 12px/1.5 var(--mono);
  letter-spacing: 0.04em;
  color: var(--cream-dim);
}

/* --- Tables --------------------------------------------------------------- */
.table-scroll { margin-top: 24px; overflow-x: auto; max-width: 980px; }

.cs-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.94rem;
}
.cs-table th {
  text-align: left;
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-lit);
  padding: 0 14px 12px 0;
  border-bottom: 1px solid var(--gold);
}
.cs-table td {
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--ink-line);
  vertical-align: top;
  color: rgba(238, 222, 193, 0.82);
}
.cs-table td:first-child { font-family: var(--mono); color: var(--cream); white-space: nowrap; }
.cs-table .num { font-family: var(--mono); text-align: right; white-space: nowrap; color: var(--cream); }
.cs-table .neg { color: #f08a8f; }

.econ {
  display: inline-block;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  padding: 4px 6px;
}

/* --- Worked examples ------------------------------------------------------ */
.examples {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 980px;
}

.example {
  background: var(--cream-face);
  color: var(--on-face);
  padding: 24px 24px 22px;
  border-top: 6px solid var(--red);
}
.example--pass { border-top-color: var(--teal); }

.example h3 { font-size: 1.15rem; font-weight: 800; }
.example > p { margin-top: 8px; color: var(--on-face-dim); font-size: 0.95rem; }

.example ol {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  font: 500 13px/1.4 var(--mono);
}
.example li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--on-face-faint);
}
.example li b { font-weight: 700; white-space: nowrap; }
.example .total { font-weight: 700; border-bottom: 0; padding-top: 12px; }

.verdict {
  margin-top: 14px;
  font: 700 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.example--flag .verdict { color: var(--red); }
.example--pass .verdict { color: var(--teal-deep); }

/* --- Next steps / footer CTA ---------------------------------------------- */
.cs-cta {
  margin-top: clamp(56px, 8vw, 88px);
  padding-top: 40px;
  border-top: 1px solid var(--ink-line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
}
.cs-cta p { font-size: 1.1rem; font-weight: 700; }
.cs-cta .btn { margin-top: 0; }

/* ==========================================================================
   Reading notes (writing/ddia/) — share the case-study layout above
   ========================================================================== */

/* "My take" and "Push back" boxes are speech bubbles from Professor Oak, who stands to the
   left: listening for a take, pointing for a push back */
.take {
  position: relative;
  min-height: 118px;
  margin: 26px 0 0 92px;
  padding: 20px 24px 22px;
  background: #fff;
  color: #1c1c1c;
  border: 3px solid #1c1c1c;
  border-radius: 10px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #6f8190;
}
.take--push { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--orange); }
.take::before {                           /* Oak */
  content: "";
  position: absolute;
  left: -95px;
  bottom: -3px;
  width: 58px;
  height: 138px;
  background: url("../img/oak.png") center bottom / contain no-repeat;
}
.take--push::before {
  left: -100px;
  width: 64px;
  background-image: url("../img/oak-point.png");
}
.take::after {                            /* the bubble's tail, pointing at Oak */
  content: "";
  position: absolute;
  left: -12px;
  bottom: 30px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-left: 3px solid #1c1c1c;
  border-bottom: 3px solid #1c1c1c;
  transform: rotate(45deg);
}

@media (max-width: 560px) {
  .take { margin-left: 62px; min-height: 96px; }
  .take::before { left: -64px; width: 44px; height: 104px; }
  .take--push::before { left: -66px; width: 48px; }
}

.take__label {
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 10px;
}
.take .take__label { color: #a3081f; }
.take--push .take__label { color: #a8461f; }
.take p { color: var(--on-face); }
.take p + p { margin-top: 12px; }
.take code { background: rgba(28, 35, 31, 0.08); color: var(--on-face); }
.take strong { color: var(--on-face); }      /* .prose strong is cream, invisible on the cream box */
.prose .table-scroll + p { margin-top: 20px; }

/* series index: chapter list */
.chapters { margin-top: 32px; max-width: 820px; border-top: 1px solid var(--ink-line); }
.chapter {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--ink-line);
  text-decoration: none;
}
.chapter__num { font: 700 13px/1 var(--mono); color: var(--gold-lit); letter-spacing: 0.1em; }
.chapter__title { font-size: 1.15rem; font-weight: 700; }
.chapter__title span { display: block; margin-top: 4px; font-size: 0.95rem; font-weight: 400; color: var(--cream-dim); }
.chapter__status { font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cream-dim); }
a.chapter:hover .chapter__title { color: var(--yellow); }
a.chapter .chapter__status { color: var(--yellow); }

.series-nav {
  margin-top: clamp(56px, 8vw, 88px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  font: 500 12px/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.series-nav a { color: var(--cream); text-decoration: none; }
.series-nav a:hover { color: var(--yellow); }

/* DDIA progress HUD placement (styles live in style.css) */
.cs-hud { margin-top: 36px; }
.cs-hud--end { margin-top: clamp(56px, 8vw, 88px); }

/* ==========================================================================
   Professor dialogue (assets/js/oak.js) — key takeaways
   ========================================================================== */

.oak__list { margin-top: 16px; padding-left: 1.4em; display: grid; gap: 10px; color: rgba(238, 222, 193, 0.82); }
.oak__list li::marker { color: var(--yellow); font-family: var(--mono); font-weight: 700; }
.oak__list[hidden] { display: none; }

.oak__stage {
  margin-top: 22px;
  border: 3px solid var(--on-face);
  box-shadow: 6px 6px 0 var(--gold);
  background: linear-gradient(to bottom, #e3f2ea 0, #cfe9dd 58%, #86c2aa 58%, #5f9f86 100%);
  padding: 20px 14px 14px;
}

.oak__figure {
  position: relative;
  width: 76px;
  margin: 0 auto 18px;
}
/* the round platform the professor stands on */
.oak__figure::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 132px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #e9f6ef 0 55%, #b7dccb 56% 100%);
}
.oak__sprite {
  position: relative;
  display: block;
  width: 76px;
  height: 180px;
}

.oak__box {
  position: relative;
  display: block;
  width: 100%;
  min-height: 7.6em;
  padding: 14px 44px 18px 20px;
  text-align: left;
  background: #fff;
  color: #1c1c1c;
  border: 3px solid #1c1c1c;
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #6f8190;
  font: 600 16px/1.6 var(--mono);
  cursor: pointer;
}
.oak__speaker {
  display: block;
  margin-bottom: 6px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.16em;
  color: #a3081f;
}
.oak__text { white-space: pre-wrap; }
.oak__arrow {
  position: absolute;
  right: 18px;
  bottom: 12px;
  color: var(--red);
  font-size: 13px;
  visibility: hidden;
}
.oak__box.is-done .oak__arrow { visibility: visible; animation: oak-blink 0.9s steps(2, jump-none) infinite; }
@keyframes oak-blink { 50% { opacity: 0; } }

.oak__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.oak__count {
  margin-right: auto;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.oak__btn {
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
  background: transparent;
  border: 1.5px solid var(--gold);
  padding: 8px 12px;
  cursor: pointer;
}
.oak__btn:hover { background: var(--ink-soft); }
.oak__btn--sound[aria-pressed="false"] { color: var(--cream-dim); border-color: var(--ink-line); }

.oak__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .oak__box { font-size: 14px; padding: 12px 36px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .oak__box.is-done .oak__arrow { animation: none; }
}
