/* cs.css — Swiss Authority case-study detail page styles. Verbatim port of the
   parts of site/_shared/cs.css that the customer detail + index pages need
   beyond the composed components (CtaBand owns `.cs-cta*`; global.css owns the
   `.btn*` + design tokens). Full-bleed hero with overlaid title + metrics →
   centered quote → 2-col article (prose + sticky sidebar) → optional Converge
   setup diagram → CTA. Plain CSS + var(--…) tokens (no Tailwind). */

:root {
  /* Only token missing from global.css; the rest (accent-soft/-mist, grad-2/3)
     already live there and stay the single source of truth. */
  --warm-deep: var(--color-role-warm-deep);
}

/* ── Full-bleed hero ─────────────────────────────────────────────────────── */
.cs-hero {
  position: relative;
  min-height: 600px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  color: #fff;
}
.cs-hero-bg {
  position: absolute;
  inset: 0;
  background-image: var(--cs-img);
  background-size: cover;
  background-position: var(--cs-pos, center);
}
.cs-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 16, 20, 0.5) 0%,
    rgba(14, 16, 20, 0.12) 26%,
    rgba(14, 16, 20, 0.18) 52%,
    rgba(14, 16, 20, 0.88) 100%
  );
}
.cs-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 30px;
  padding-bottom: 40px;
}
.cs-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cs-crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}
.cs-crumb a {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s var(--ease);
  white-space: nowrap;
}
.cs-crumb a:hover {
  color: #fff;
}
.cs-crumb-sep {
  color: rgba(255, 255, 255, 0.35);
}
.cs-crumb-current {
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .cs-crumb-current,
  .cs-crumb-sep:has(+ .cs-crumb-current) {
    display: none;
  }
}
.cs-hero-logo {
  height: 22px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 1px 8px rgba(0, 0, 0, 0.35));
  opacity: 0.95;
}
.cs-hero-body {
  margin-top: auto;
  padding-top: 56px;
}
.cs-hero-title {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: none;
  /* This is an <h1>; our global h1 color would override the white it should
     inherit from the dark hero. Re-inherit to match the prototype. */
  color: inherit;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.cs-metrics {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 880px;
}
.cs-metric {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cs-metric-line {
  font-size: clamp(25px, 2.6vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-wrap: balance;
}
.cs-metric-val {
  font-variant-numeric: tabular-nums;
}
.cs-metric-det {
  font-size: 15px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.7);
  max-width: 30ch;
}

/* ── Article: body + sticky sidebar ──────────────────────────────────────── */
.cs-article {
  display: grid;
  grid-template-columns: minmax(0, 680px) 300px;
  gap: 72px;
  justify-content: center;
  padding-top: 48px;
  padding-bottom: 56px;
  align-items: start;
}
.cs-body {
  min-width: 0;
}
.cs-intro {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.cs-intro:last-of-type {
  margin-bottom: 0;
}
/* Bridge: the MDX body renders its lede as bare direct-child <p> (the prototype
   authored them with class `.cs-intro`). Direct children only — Challenge/
   Solution prose lives deeper, under `.cs-prose`. Mirrors `.cs-intro`. */
.cs-body > p {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.cs-body > p:last-of-type {
  margin-bottom: 0;
}

.cs-section {
  margin-top: 36px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}
.cs-section > h2 {
  margin: 0 0 28px;
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.cs-cs {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.cs-block {
  padding: 0;
}
.cs-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cs-tag::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--cs-tag-ico) center / contain no-repeat;
  mask: var(--cs-tag-ico) center / contain no-repeat;
}
.cs-block.is-challenge .cs-tag {
  color: var(--warm-deep);
  --cs-tag-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Cpath%20d='M12%2016v-4'/%3E%3Cpath%20d='M12%208h.01'/%3E%3C/svg%3E");
}
.cs-block.is-solution .cs-tag {
  color: var(--accent-deep);
  --cs-tag-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='3'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M20%206%209%2017l-5-5'/%3E%3C/svg%3E");
}
/* Heading line-height leak fix: the prototype's shell.css sets no global
   heading line-height, so `.cs-block h3` inherits body 1.55; our global.css
   type scale would leave it at h3's 1.15. Pin it to the prototype's effective
   value. */
.cs-block h3 {
  margin: 10px 0 12px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.cs-prose {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-muted);
}
.cs-prose p {
  margin: 0 0 12px;
}
.cs-prose p:last-child {
  margin-bottom: 0;
}
.cs-prose strong {
  font-weight: 600;
  color: var(--ink);
}
.cs-prose ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cs-prose li {
  position: relative;
  padding-left: 22px;
  line-height: 1.5;
}
/* Default bullet for `.cs-prose` outside a Challenge/Solution block (i.e. a
   Prose block). `.cs-prose ul` sets `list-style: none` and the two dot rules
   below are scoped to the `is-*` modifiers, so a plain list would otherwise
   render with no marker at all. Those rules are more specific (0,3,1 vs 0,1,2),
   so they still win inside a Challenge/Solution. `ul > li` rather than `li`
   keeps ordered lists on their decimal marker. */
.cs-prose ul > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: var(--pill);
  background: var(--ink-subtle);
}
.cs-block.is-solution .cs-prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.cs-block.is-challenge .cs-prose li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--warm-deep);
}
/* Ordered lists render as native numbered lists — no bullet dot. The dot
   ::before and the 22px hanging indent above are for unordered (bulleted)
   items; ordered items keep their decimal marker instead. */
.cs-prose ol {
  margin: 10px 0 0;
  padding-left: 22px;
  list-style: decimal;
}
.cs-prose ol > li {
  padding-left: 6px;
}
.cs-prose ol > li + li {
  margin-top: 8px;
}
.cs-block.is-solution .cs-prose ol > li::before,
.cs-block.is-challenge .cs-prose ol > li::before {
  content: none;
}

/* ── In-body figure (chart / screenshot) ─────────────────────────────────── */
/* Hairline frame + --radius-lg + no shadow, matching the two other in-column
   frames on this page (`.cs-sidebar`, `.cs-setup-canvas`). Margins collapse
   rather than sum in every context `.cs-fig` can appear in (`.cs-prose` and
   `.cs-body` are plain blocks, not flex), so this one rule set covers
   figure-after-p, figure-before-p, and a figure directly under `.cs-body`. */
.cs-fig {
  margin: 18px 0;
}
/* Mirrors `.cs-prose p:last-child` — `.cs-cs` owns the gap between blocks, so a
   trailing figure must not add one. */
.cs-fig:last-child {
  margin-bottom: 0;
}
.cs-fig-frame {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-cool);
  cursor: zoom-in;
  transition: border-color 0.2s var(--ease);
}
.cs-fig-frame:hover {
  border-color: var(--line-strong);
}
/* `height: auto` is load-bearing: the <img> carries width/height attributes, so
   the global `img { max-width: 100% }` alone would squash the aspect ratio. */
.cs-fig-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.cs-fig figcaption {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-subtle);
}
/* Charts want more width than the 680px prose measure, so a figure bleeds
   symmetrically out of the body column. 48px is the ceiling: the right side eats
   into the 72px grid gap and must stop clear of the sticky sidebar, and the
   gate is the viewport where the centered grid (680 + 72 + 300 = 1052px) has
   48px of slack on the left too — 1052 + 96 = 1148px of container content, i.e.
   1148 + 2×40px padding. Below that the figure stays at the column width, so it
   can never push past `.container-page`'s gutter. */
@media (min-width: 1240px) {
  .cs-fig {
    width: calc(100% + 96px);
    margin-left: -48px;
  }
}

/* ── Pull quote — markdown `> …` inside a Prose block ────────────────────── */
/* Deliberately quieter than the centered `.cs-quote` band above the article:
   20px on a 2px accent rule, not 24–32px centered. Author convention is the
   quote paragraph(s) first, attribution as the last one (`> **Name**`), with a
   bare `>` separator line between them. */
.cs-prose blockquote {
  margin: 24px 0;
  padding-left: 22px;
  border-left: 2px solid var(--accent);
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.cs-prose blockquote:last-child {
  margin-bottom: 0;
}
/* Attribution line. `:not(:only-child)` so a single-paragraph quote doesn't
   shrink itself. The name's <strong> already picks up 600/--ink from
   `.cs-prose strong`. */
.cs-prose blockquote p:last-child:not(:only-child) {
  margin-top: 14px;
  font-size: 15px;
  letter-spacing: 0;
  color: var(--ink-muted);
}

/* ── Figure lightbox ─────────────────────────────────────────────────────── */
/* The overlay element is built by the script in Figure.astro, so it never gets
   Astro's scope attribute — these rules have to live in this page stylesheet
   rather than a scoped \3c style> block. z-index clears the nav's 50. */
.cs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgba(14, 16, 20, 0.86);
}
.cs-lightbox[hidden] {
  display: none;
}
/* Fits the viewport rather than showing the original at 1:1 — these are wide
   charts, and 100dvh keeps the mobile toolbars from clipping the bottom. */
.cs-lightbox-img {
  max-width: 100%;
  max-height: calc(100dvh - 96px);
  width: auto;
  height: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 40px 80px -32px rgba(14, 16, 20, 0.6);
}
.cs-lightbox-cap {
  margin: 0;
  max-width: 900px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}
.cs-lightbox-cap[hidden] {
  display: none;
}
/* X drawn with a mask, matching how `.cs-tag::before` does its icon — no inline
   SVG needed in the script. */
.cs-lightbox-x {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.cs-lightbox-x::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  background: #fff;
  -webkit-mask: var(--cs-x-ico) center / contain no-repeat;
  mask: var(--cs-x-ico) center / contain no-repeat;
  --cs-x-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18%206%206%2018'/%3E%3Cpath%20d='m6%206%2012%2012'/%3E%3C/svg%3E");
}
.cs-lightbox-x:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
}
/* Scroll lock while the overlay is up. */
.cs-lightbox-open {
  overflow: hidden;
}

/* Sidebar */
.cs-sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-cool);
}
.cs-meta-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin-bottom: 5px;
}
/* `display: block` is what makes the declared 1.45 actually apply. As inline
   <span>s these values took their leading from the wrapper's strut (1.55 × 18px
   ≈ 28px) instead, so any value that wrapped to a second line rendered looser
   than its own line-height — and looser than a blockified sibling, which is
   visible as two different rhythms inside one field. */
.cs-meta-val {
  display: block;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}
/* `painPoint` accepts `string | string[]` and SidebarMeta renders each array
   item as its own `.cs-meta-val`, so siblings need a gap; without one, two pain
   points run together mid-sentence. */
.cs-meta-val + .cs-meta-val {
  margin-top: 8px;
}
.cs-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-sidebar ul a {
  font-size: 14px;
  color: var(--accent);
  transition: color 0.2s var(--ease);
}
.cs-sidebar ul a:hover {
  color: var(--accent-deep);
}

/* ── Quote band ──────────────────────────────────────────────────────────── */
.cs-quote {
  border-top: 1px solid var(--line);
  background: transparent;
}
.cs-quote-inner {
  max-width: 820px;
  margin: 0 auto;
  padding-top: 64px;
  padding-bottom: 64px;
  text-align: center;
}
.cs-quote blockquote {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
}
.cs-quote-attr {
  margin-top: 28px;
  font-size: 15px;
  color: var(--ink-muted);
}
.cs-quote-attr b {
  color: var(--ink);
  font-weight: 600;
}

/* ── Converge setup diagram ──────────────────────────────────────────────── */
.cs-setup {
  padding-top: 8px;
  padding-bottom: 64px;
}
.cs-setup-title {
  margin: 0 0 22px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}
.cs-setup-canvas {
  background: var(--paper-cool);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  overflow: hidden;
}
.cs-setup-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}
.cs-setup-rail {
  fill: none;
  stroke: var(--accent);
}
@keyframes cs-setup-sweep {
  from {
    x: -100%;
  }
  to {
    x: 100%;
  }
}
.cs-setup-sweep {
  animation: cs-setup-sweep 3s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .cs-setup-sweep {
    animation: none;
  }
}
.cs-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cs-node-tile {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(14, 16, 20, 0.05);
}
.cs-node-tile img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.cs-node-tile.is-icon {
  border-radius: 999px;
  color: var(--accent);
}
.cs-node-tile.is-icon svg {
  width: 19px;
  height: 19px;
}
.cs-node-cap {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
}
.cs-node.is-text {
  height: 100%;
  justify-content: center;
}
.cs-node-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(14, 16, 20, 0.05);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .cs-quote-inner {
    padding-bottom: 8px;
  }
  body > section.cs-article::before {
    display: none;
  }
  .cs-article {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 8px;
  }
  .cs-sidebar {
    position: static;
    order: -1;
  }
  .cs-metrics {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .cs-hero {
    min-height: 520px;
  }
  .cs-hero-scrim {
    background: linear-gradient(
      180deg,
      rgba(14, 16, 20, 0.55) 0%,
      rgba(14, 16, 20, 0.45) 35%,
      rgba(14, 16, 20, 0.62) 65%,
      rgba(14, 16, 20, 0.9) 100%
    );
  }
  .cs-hero-title,
  .cs-metric-line,
  .cs-metric-det {
    text-shadow:
      0 1px 2px rgba(14, 16, 20, 0.45),
      0 2px 14px rgba(14, 16, 20, 0.35);
  }
  .cs-metric-det {
    color: rgba(255, 255, 255, 0.88);
  }
}
