/* Shared styles for the static case-study detail pages.
   Loaded by every case-study-<slug>/index.html. Keep the type scale and
   section spacing below authoritative for all of them, so the pages stay
   visually uniform as new case studies are added.
   NOTE: never write a directory glob with a star-slash inside a CSS comment
   here - it terminates the comment early and silently kills the next rule. */

.csd-page {
  /* Type scale */
  --csd-fs-eyebrow: 13px;
  --csd-fs-section-title: 15px;
  --csd-fs-body: 17px;
  --csd-fs-small: 13px;
  --csd-fs-meta: 15px;
  --csd-fs-stat: 24px;
  --csd-lh-body: 1.75;

  /* Palette */
  --csd-accent: #1a6fb5;
  --csd-ink: #10243f;
  --csd-body-color: #454f5b;
  --csd-muted: #6b7280;
  --csd-tint: #f6f8fa;
  --csd-line: #e6e9ed;
}

/* ---------------------------------------------------------------- Hero --- */

/* Pages set only `background-image` inline; everything else is shared so the
   hero is identical across case studies. */
.csd-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 460px;
  padding: 150px 0 60px;
  background-color: var(--csd-ink);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.csd-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.62) 45%,
    rgba(0, 0, 0, 0.4) 100%
  );
}

.csd-hero > .container {
  position: relative;
  z-index: 1;
}

.csd-hero-inner {
  max-width: 760px;
}

.csd-hero-eyebrow {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--csd-fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.csd-hero-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.14;
  font-weight: 600;
}

.csd-hero-deck {
  margin: 18px 0 0;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--csd-fs-body);
  line-height: 1.6;
}

.csd-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

/* Chip used in the hero and in the tech-stack row. Defined here because the
   detail pages do not load case-study.css (the listing page's stylesheet). */
.csd-page .tag-item {
  padding: 5px 12px;
  border-radius: 5px;
  background-color: rgba(182, 211, 234, 0.3);
  color: #ffffff;
  font-size: var(--csd-fs-small);
  font-weight: 500;
  line-height: 1.5;
}

/* ------------------------------------------------------------ Sections --- */

.csd-section {
  padding: 84px 0;
}

.csd-section--tint {
  background: var(--csd-tint);
}

/* Section directly under the overlapping facts card needs less top padding. */
.csd-section--after-facts {
  padding-top: 64px;
}

.csd-section-head {
  margin-bottom: 34px;
}

.csd-section-head--center {
  text-align: center;
}

.csd-section-head h2.csd-section-title {
  margin-bottom: 18px;
}

/* Neutral grouping wrapper (title + copy). Successive blocks in one section
   need breathing room between them. */
.csd-block + .csd-block {
  margin-top: 44px;
}

.csd-block + .csd-list,
.csd-block + .csd-architecture,
.csd-block + .csd-team-table-wrap,
.csd-block + .csd-stack {
  margin-top: 26px;
}

h2.csd-section-title {
  position: relative;
  margin: 0 0 24px;
  padding-bottom: 12px;
  color: var(--csd-accent);
  font-size: var(--csd-fs-section-title);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

h2.csd-section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: var(--csd-accent);
}

.csd-section-head--center h2.csd-section-title::after {
  left: 50%;
  transform: translateX(-50%);
}

.csd-section-lead {
  margin: 0 auto;
  max-width: 640px;
  color: var(--csd-muted);
  font-size: var(--csd-fs-body);
  line-height: 1.65;
}

/* ---------------------------------------------------------- Body copy --- */

.csd-body {
  max-width: 820px;
  color: var(--csd-body-color);
  font-size: var(--csd-fs-body);
  line-height: var(--csd-lh-body);
}

.csd-body p {
  margin-bottom: 18px;
}

.csd-body p:last-child {
  margin-bottom: 0;
}

.csd-body + .csd-list,
.csd-body + .csd-team-table-wrap,
.csd-body + .csd-architecture {
  margin-top: 24px;
}

.csd-list {
  margin: 0;
  padding-left: 0;
  max-width: 820px;
  list-style: none;
}

.csd-list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 14px;
  color: var(--csd-body-color);
  font-size: var(--csd-fs-body);
  line-height: var(--csd-lh-body);
}

.csd-list li:last-child {
  margin-bottom: 0;
}

.csd-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--csd-fs-body) * var(--csd-lh-body) / 2 - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--csd-accent);
}

.csd-list li strong {
  color: var(--csd-ink);
  font-weight: 600;
}

/* ------------------------------------------------------ Quick facts --- */

.csd-facts-wrap {
  position: relative;
  z-index: 2;
  margin-top: -48px;
}

.csd-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(15, 30, 60, 0.12);
}

.csd-facts--3 {
  grid-template-columns: repeat(3, 1fr);
}

.csd-facts--2 {
  grid-template-columns: repeat(2, 1fr);
}

.csd-fact {
  padding: 0 18px;
  text-align: center;
  border-right: 1px solid #eef0f3;
}

.csd-fact:last-child {
  border-right: none;
}

.csd-fact strong {
  display: block;
  margin-bottom: 6px;
  color: var(--csd-ink);
  font-size: var(--csd-fs-stat);
  font-weight: 700;
  line-height: 1.2;
}

.csd-fact span {
  display: block;
  color: var(--csd-muted);
  font-size: var(--csd-fs-small);
  line-height: 1.45;
}

/* ------------------------------------------ Architecture illustrations --- */

.csd-architecture {
  max-width: 1160px;
  margin: 42px auto 0;
  overflow-x: auto;
  border-radius: 20px;
  -webkit-overflow-scrolling: touch;
}

.csd-architecture img {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.csd-architecture figcaption {
  margin-top: 12px;
  color: var(--csd-muted);
  font-size: var(--csd-fs-small);
  line-height: 1.5;
  text-align: center;
}

/* ------------------------------------------------------- Team table --- */

.csd-team-table-wrap {
  max-width: 820px;
  overflow-x: auto;
}

.csd-team-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.csd-team-table th,
.csd-team-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid #eef0f3;
}

.csd-team-table th {
  background: var(--csd-tint);
  color: var(--csd-ink);
  font-size: var(--csd-fs-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.csd-section--tint .csd-team-table th {
  background: #ffffff;
}

.csd-team-table td {
  color: var(--csd-body-color);
  font-size: var(--csd-fs-meta);
}

/* -------------------------------------------------------- Tech stack --- */

.csd-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

/* Stack chips sit on light backgrounds, so they need readable text. */
.csd-page .csd-stack .tag-item {
  background-color: rgba(26, 111, 181, 0.1);
  color: var(--csd-accent);
  font-weight: 600;
}

/* --------------------------------------------------------------- CTA --- */

.csd-cta {
  padding: 84px 0;
  text-align: center;
}

.csd-cta-eyebrow {
  margin: 0;
  color: var(--csd-accent);
  font-size: var(--csd-fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.csd-cta-title {
  margin: 14px 0 0;
  color: var(--csd-ink);
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.25;
  font-weight: 600;
}

.csd-cta-text {
  margin: 18px auto 32px;
  max-width: 600px;
  color: var(--csd-muted);
  font-size: var(--csd-fs-body);
  line-height: 1.65;
}

.csd-cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

/* ------------------------------------------------------- Responsive --- */

@media (max-width: 991px) {
  .csd-section,
  .csd-cta {
    padding: 64px 0;
  }

  .csd-section--after-facts {
    padding-top: 52px;
  }
}

@media (max-width: 767px) {
  .csd-page {
    --csd-fs-body: 16px;
    --csd-fs-stat: 21px;
    --csd-lh-body: 1.7;
  }

  .csd-hero {
    min-height: 400px;
    padding: 130px 0 48px;
  }

  .csd-section,
  .csd-cta {
    padding: 52px 0;
  }

  .csd-section--after-facts {
    padding-top: 44px;
  }

  .csd-facts-wrap {
    margin-top: -32px;
  }

  .csd-facts,
  .csd-facts--2,
  .csd-facts--3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 22px 12px;
    padding: 24px 14px;
  }

  /* Dividers do not survive wrapping, so separate with gap alone. */
  .csd-fact {
    padding: 0 6px;
    border-right: none;
  }

  .csd-architecture {
    margin-top: 32px;
    border: 1px solid var(--csd-line);
  }

  .csd-architecture figcaption {
    padding: 0 14px 12px;
  }

  .csd-architecture::after {
    content: "Swipe horizontally to view the complete system map →";
    display: block;
    padding: 0 14px 14px;
    color: var(--csd-accent);
    font-size: var(--csd-fs-small);
    font-weight: 600;
    text-align: center;
  }
}

@media (max-width: 479px) {
  .csd-facts,
  .csd-facts--2,
  .csd-facts--3 {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .csd-fact {
    padding: 0;
  }
}
