/* =========================================================
   App Masons — Case Study pages
   Extends style.css (loaded first) for shared vars, nav,
   buttons and footer. This file adds the case-study layout,
   personas, stat tiles and the inline-SVG charts.
   ========================================================= */

:root {
  /* Chart palette — validated on the dark craftsman surface
     (node validate_palette.js "#1fa85a,#3987e5,#d95926" --mode dark
      --surface #16281c → ALL CHECKS PASS) */
  --cs-surface: #16281c;
  --cs-series-1: #1fa85a; /* brand green — primary */
  --cs-series-2: #3987e5; /* blue */
  --cs-series-3: #d95926; /* orange */
  --cs-ink: #ffffff;
  --cs-ink-2: #c3c2b7;
  --cs-muted: #8ea595;
  --cs-grid: rgba(255, 255, 255, 0.09);
  --cs-baseline: rgba(255, 255, 255, 0.22);
}

/* The homepage now uses a light theme (style.css), but the case-study
   pages keep their cohesive dark, cinematic design. Re-assert the dark
   page surface + light text here (loaded after style.css). */
body {
  background-color: #2a2a2a;
  background-image: linear-gradient(
    190deg,
    rgba(90, 90, 90, 1) 0%,
    rgba(42, 42, 42, 1) 100%
  );
  color: var(--text-color);
}

/* ---------- Sub-page nav ---------- */
.cs-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 6vw, 4rem);
  background: #30373242;
  position: relative;
  z-index: 9;
}

.cs-nav .logo img {
  width: 150px;
}

.cs-back {
  color: #d8eede;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid #2b5937;
  border-radius: 50px;
  padding: 0.45rem 1.2rem;
  transition: background 0.25s ease;
}

.cs-back:hover {
  background: #2b593760;
}

/* ---------- Hero ---------- */
.cs-hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 6vw, 2rem) 2rem;
  text-align: center;
  position: relative;
  z-index: 6;
}

.cs-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  color: var(--cs-series-1);
  margin: 0 0 0.75rem;
}

.cs-hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 1rem;
}

.cs-hero .cs-lede {
  font-size: 1.25rem;
  max-width: 640px;
  margin: 0 auto 2rem;
  color: #d8eede;
  opacity: 0.9;
}

.cs-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  margin: 2rem auto;
  padding: 1.25rem 1.5rem;
  max-width: 760px;
  border: 1px solid #2b5937;
  border-radius: 16px;
  background-color: #142e1b30;
}

.cs-meta div {
  text-align: left;
}

.cs-meta .k {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cs-muted);
  margin-bottom: 0.25rem;
}

.cs-meta .v {
  font-weight: 700;
  color: #f4fbf6;
}

.cs-hero-image {
  max-width: 900px;
  margin: 2.5rem auto 0;
}

.cs-hero-image img {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

/* ---------- Narrative body ---------- */
.cs-body {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 6vw, 2rem);
  position: relative;
  z-index: 6;
}

.cs-chapter {
  margin: 0 0 3.5rem;
}

.cs-chapter .cs-kicker {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cs-series-1);
  margin-bottom: 0.5rem;
}

.cs-chapter h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.2;
  margin: 0 0 1rem;
  color: #f4fbf6;
}

.cs-chapter p {
  font-size: 1.08rem;
  line-height: 1.7;
  color: #cdddce;
  margin: 0 0 1.1rem;
}

.cs-pull {
  border-left: 3px solid var(--cs-series-1);
  padding: 0.4rem 0 0.4rem 1.4rem;
  margin: 2rem 0;
  font-size: 1.35rem;
  line-height: 1.5;
  font-style: italic;
  color: #eafaf0;
}

/* ---------- Personas ---------- */
.cs-persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 1rem;
}

.cs-persona {
  border: 1px solid #2b5937;
  border-radius: 16px;
  background-color: #142e1b30;
  padding: 1.5rem;
}

.cs-persona-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.cs-persona-avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #0c1a11;
  background: linear-gradient(135deg, #35c95f, #1a9641);
}

.cs-persona-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #f4fbf6;
}

.cs-persona-head .role {
  margin: 0;
  font-size: 0.85rem;
  color: var(--cs-muted);
}

.cs-persona dl {
  margin: 0;
}

.cs-persona dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cs-series-1);
  margin-top: 0.85rem;
}

.cs-persona dd {
  margin: 0.2rem 0 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: #cdddce;
}

/* Feature cards reuse .cs-persona but with a bare heading + paragraph */
.cs-persona > h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  color: #f4fbf6;
}

.cs-feature {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #cdddce;
}

.cs-sub-note {
  font-size: 0.9rem;
  color: var(--cs-muted);
  margin-top: 0.75rem;
}

/* ---------- Stat tiles ---------- */
.cs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.cs-stat {
  border: 1px solid #2b5937;
  border-radius: 16px;
  background-color: #142e1b30;
  padding: 1.4rem 1.2rem;
  text-align: left;
}

.cs-stat .num {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: #f4fbf6;
}

.cs-stat .lab {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--cs-ink-2);
}

/* ---------- Charts ---------- */
.cs-figure {
  border: 1px solid #2b5937;
  border-radius: 16px;
  background-color: var(--cs-surface);
  padding: 1.5rem 1.5rem 1.25rem;
  margin: 2rem 0;
}

.cs-figure figcaption {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f4fbf6;
}

.cs-figure .cs-sub {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--cs-muted);
}

.cs-figure svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG roles */
.cs-grid-line {
  stroke: var(--cs-grid);
  stroke-width: 1;
}
.cs-baseline {
  stroke: var(--cs-baseline);
  stroke-width: 1;
}
.cs-axis-text {
  fill: var(--cs-muted);
  font-size: 12px;
  font-family: inherit;
}
.cs-value-text {
  fill: var(--cs-ink);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
}
.cs-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.cs-dot-ring {
  stroke: var(--cs-surface);
  stroke-width: 2;
}

.cs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--cs-ink-2);
}
.cs-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.cs-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* ---------- Placeholder marker ---------- */
.ph {
  border-bottom: 1px dashed #6f9a7e;
  color: #a7c9b4;
  cursor: help;
}

/* ---------- Tech stack ---------- */
.cs-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.cs-stack li {
  border: 1px solid #2e6642;
  border-radius: 50px;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
  color: #eafaf0;
  background-color: #2b593730;
}

/* ---------- Testimonial ---------- */
.cs-quote {
  border: 1px solid #2b5937;
  border-radius: 16px;
  background-color: #142e1b30;
  padding: 2rem;
  margin: 2rem 0;
}
.cs-quote blockquote {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.6;
  color: #eafaf0;
}
.cs-quote .cite {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--cs-muted);
}

/* ---------- Bottom CTA ---------- */
.cs-cta {
  text-align: center;
  padding: clamp(2.5rem, 8vw, 4rem) 1.25rem;
  background: linear-gradient(
    145deg,
    rgba(15, 40, 21, 1) 0%,
    rgba(23, 32, 25, 1) 100%
  );
}
.cs-cta h2 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  margin: 0 0 0.75rem;
  color: #f4fbf6;
}
.cs-cta p {
  color: #cdddce;
  max-width: 520px;
  margin: 0 auto 1.75rem;
}

/* ---------- Prev/next projects ---------- */
.cs-more {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 6vw, 2rem) 3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cs-more a {
  color: #d8eede;
  text-decoration: none;
  font-size: 0.95rem;
}
.cs-more a:hover {
  color: var(--cs-series-1);
}

@media (max-width: 640px) {
  .cs-nav {
    flex-direction: column;
    gap: 0.75rem;
  }
}
