/* ============================================================
   CASE RENDERER — shared atoms for the inline /work case view
   AND the standalone /work/:slug page. These rules previously
   lived in casePanel.css; the slide-in overlay was removed in
   task #342 but the renderer atoms are still required by both
   surfaces (caseRenderer.js and casePage.js). The CTA strip at
   the foot of each rendered case keeps the canonical pair
   (Talk to us / Back to all work).
   ============================================================ */
.case-renderer {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.case-renderer__hero {
  padding: var(--sp-16) var(--sp-8) 44px;
  background: var(--ink-2);
  color: var(--paper);
  position: relative;
  /* Hero is a flex column so the metric line can be visually lifted
     above the client name via `order` without changing the source
     DOM order — which keeps semantic h1 → metric reading order intact
     for assistive tech. Task #488 Phase 3. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.case-renderer__hero-meta { order: 1; }
.case-renderer__client { order: 2; margin-top: 0; }
.case-renderer__case-title { order: 3; }
/* Hero metric sits below the client name + case title. */
.case-renderer__metric { order: 4; margin-top: 18px; margin-bottom: 0; }
.case-renderer[data-sector="hospitality"] .case-renderer__hero {
  background: var(--sec-hospitality);
  color: var(--ink, #0e0e10);
}
.case-renderer[data-sector="retail"] .case-renderer__hero {
  background: var(--sec-retail);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="finance"] .case-renderer__hero {
  background: var(--sec-finance);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="technology"] .case-renderer__hero {
  background: var(--sec-technology);
  color: var(--paper, #f4f1ea);
}
/* Task #685: formerly-neutral sectors now carry brand colours. */
.case-renderer[data-sector="public-sector"] .case-renderer__hero {
  background: var(--sec-public-sector, #6c5fbf);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="media"] .case-renderer__hero {
  background: var(--sec-media, #b8433c);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="professional-services"] .case-renderer__hero {
  background: var(--sec-professional-services, #2a727e);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="energy-utilities"] .case-renderer__hero {
  background: var(--sec-energy-utilities, #55701e);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="industrial"] .case-renderer__hero {
  background: var(--sec-industrial, #96552b);
  color: var(--paper, #f4f1ea);
}
.case-renderer[data-sector="education-research"] .case-renderer__hero {
  background: var(--sec-education-research, #245c69);
  color: var(--paper, #f4f1ea);
}

.case-renderer__hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-nav);
  text-transform: uppercase;
  opacity: 0.85;
}

.case-renderer__eyebrow {
  /* Section-intro tier (Task #541) — case study hero opener. The
     parent .case-renderer__hero-meta sets the row's micro size for
     metadata siblings; the eyebrow itself promotes to the larger
     section-intro size + tighter caps tracking. */
  font-size: var(--fs-eyebrow-section);
  letter-spacing: var(--ls-caps-section);
  font-weight: var(--fw-medium);
}

/* Close × moved out of the hero typography flow into a chrome layer
   that sits on the panel's top-right corner OUTSIDE the hero block.
   This stops the button overlapping the eyebrow / client headline /
   metric line on cases like Bank of Cyprus where the hero copy ran
   to the right edge. The chrome relies on the case-renderer flex
   column being the positioning context. */
.case-renderer { position: relative; }
.case-renderer__chrome {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.case-renderer__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(14, 14, 16, 0.55);
  color: var(--paper, #f4f1ea);
  font-size: var(--fs-h3);
  line-height: var(--lh-tight);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.case-renderer__close:hover {
  background: rgba(14, 14, 16, 0.85);
  border-color: var(--paper, #f4f1ea);
}
.case-renderer__close:focus-visible {
  outline: 2px solid var(--be-yellow, #FFC217);
  outline-offset: 2px;
}

.case-renderer__client {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-headline);
  text-transform: uppercase;
  margin: 0 0 6px 0;
  color: inherit;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
}

/* Case title — the work description that follows the " – " separator
   in the source title. Rendered at h1 scale (subordinate to the
   display-size client name above it) in the same display typeface. */
.case-renderer__case-title {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-headline);
  text-transform: uppercase;
  margin: 0 0 0 0;
  color: inherit;
  opacity: 0.75;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
}

/* The hero metric line replaces the legacy italic headline AND the
   metrics grid with a single bold one-liner — matches the reference
   sample. Both the curated metric and (when no metric exists) the
   derived headline render in the same metric weight; the modifier
   class lets us tighten the size for the longer headline fallback. */
/* Locked metric-colour rule (docs/TYPOGRAPHY.md, Task #527):
   - On the default --ink-2 hero (no sector data attribute) the
     metric renders in --be-yellow.
   - On every sector-coloured hero (hospitality, retail, finance,
     technology, public-sector, media) the metric renders in
     --text (white) — including hospitality, whose tile text
     colour is otherwise --ink. The earlier "inherits sector hero
     text colour" behaviour is removed for consistency. */
.case-renderer__metric {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-body);
  margin: 0;
  color: var(--be-yellow);
  max-width: 32ch;
}
.case-renderer[data-sector] .case-renderer__metric {
  color: var(--text);
}
.case-renderer__metric--headline {
  font-size: var(--fs-h1);
  line-height: var(--lh-snug);
  max-width: 38ch;
  font-weight: var(--fw-display);
}

.case-renderer__body {
  padding: var(--sp-10) var(--sp-8) var(--sp-10);
  background: var(--black, #0a0a0a);
  color: var(--white, #fff);
  flex: 1;
}

.case-renderer__section {
  margin: 0 0 var(--sp-6);
}
.case-renderer__section:first-child {
  margin-top: 0;
}

/* Heading hierarchy follows the source — h2 is the dominant section
   eyebrow (matches the sample's stylised "ABOUT THE CLIENT" / "THE
   WORK" headings). h3/h4 step down. Tracking + uppercase mirrors the
   editorial feel without needing a separate accent element. */
.case-renderer__heading {
  font-family: var(--display);
  color: var(--white, #fff);
  margin: var(--sp-8) 0 14px;
  letter-spacing: var(--ls-body);
  line-height: var(--lh-snug);
}
.case-renderer__section:first-child .case-renderer__heading,
.case-renderer__section:first-child .case-renderer__heading:first-child {
  margin-top: 0;
}
.case-renderer__heading--h2 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-display);
  text-transform: uppercase;
  letter-spacing: var(--ls-body);
  position: relative;
  padding-top: var(--sp-3);
}
.case-renderer__heading--h2::before {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--yellow, #ffc217);
  margin-bottom: 14px;
}
.case-renderer__heading--h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-body);
}
.case-renderer__heading--h4 {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-body);
  color: rgba(255,255,255,0.7);
}

.case-renderer__p {
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: rgba(255,255,255,0.82);
  margin: 0 0 1em 0;
}
.case-renderer__p--empty {
  opacity: 0.6;
}

/* Single-column full-bleed media. Drops the legacy 2-column gallery
   grid on case detail (kept on the work index). Every image and
   video block is 100% of the body's content width. Margins are
   generous so each asset reads as its own beat in the scroll. */
.case-renderer__media {
  margin: var(--sp-8) 0;
  padding: 0;
  background: var(--ink-2);
  border-radius: var(--r-xs);
  overflow: hidden;
}
.case-renderer__media:first-child {
  margin-top: 0;
}
.case-renderer__media img,
.case-renderer__media video {
  display: block;
  width: 100%;
  height: auto;
}

/* ============================================================
   CANONICAL SECTIONS — Challenge / Approach / Results.
   Triggered by an h2 matching the canonical vocabulary; the
   renderer wraps that h2 + its prose in a section with a
   yellow-rule eyebrow primitive (.eyebrow--rule) above the h2.
   ============================================================ */
.case-renderer__section--cs {
  margin-bottom: 44px;
}
/* Challenge / Approach / Results section labels — styled to match
   the non-canonical .case-renderer__heading--h2 treatment (white bold
   display text with a short yellow rule above). */
.case-renderer__cs-eyebrow {
  display: block;
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-body);
  text-transform: uppercase;
  color: var(--white, #fff);
  position: relative;
  padding-top: var(--sp-3);
  margin: var(--sp-8) 0 14px;
}
.case-renderer__cs-eyebrow::before {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--yellow, #ffc217);
  margin-bottom: 14px;
}

/* Approach: ghost discipline pills below the prose. */
.case-renderer__pills {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.case-renderer__pill {
  /* Canonical tag-pill register (docs/TYPOGRAPHY.md §Tag pill) — was
     drifted to DM Sans / --ls-body; corrected to DM Mono --fs-label
     to match .work-list__pill and every other metadata pill (Task #702). */
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-nav);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--r-full);
  padding: 6px var(--sp-3);
}

/* Results: DM Sans 900 yellow callout pulled from the leading
   metric phrase of a paragraph. Sized to .aiops-stats__num
   (canonical 56px) clamped down to fit the 60ch body column on
   smaller surfaces. */
.case-renderer__metric-callout {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-headline);
  color: var(--be-yellow, #FFC217);
  margin: var(--sp-2) 0 var(--sp-3);
}
.case-renderer__metric-callout + .case-renderer__p {
  margin-top: 0;
}

.case-renderer__actions {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.case-renderer__action {
  /* Canonical button register (docs/TYPOGRAPHY.md §Nav link / button) —
     was drifted to DM Sans; corrected to DM Mono (Task #702). */
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-nav);
  text-transform: uppercase;
  color: var(--white, #fff);
  background: transparent;
  padding: 11px 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--r-full);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.case-renderer__action:hover {
  border-color: var(--yellow, #ffc217);
  color: var(--yellow, #ffc217);
  transform: translateY(-1px);
}
.case-renderer__action--primary {
  background: var(--yellow, #ffc217);
  color: var(--black, #0a0a0a);
  border-color: var(--yellow, #ffc217);
}
.case-renderer__action--primary:hover {
  background: transparent;
  color: var(--yellow, #ffc217);
}

@media (max-width: 639px) {
  .case-renderer__hero { padding: var(--sp-10) var(--sp-5) var(--sp-8); }
  .case-renderer__client { font-size: var(--fs-display); }
  .case-renderer__body { padding: var(--sp-6) var(--sp-5) var(--sp-8); }
  .case-renderer__media { margin: var(--sp-5) 0; }
  .case-renderer__heading--h2 { font-size: var(--fs-h3); }
}

/* ============================================================
   /WORK COLUMN VARIANT — task #262.
   When the case study renders inside the /work right-column
   swap (rather than the slide-in panel), the shared renderer
   needs to fill the full chat-panel column width: no inner max
   width, no panel-content padding, hero + media flush with the
   column edges. The body still respects the 60ch readability
   cap on prose paragraphs (inherited from .case-renderer__
   section's max-width), which is the only readability cap we
   want to keep on this surface.
   ============================================================ */
.work-case-shared {
  width: 100%;
}
.work-case-shared .case-renderer { width: 100%; min-height: 100%; }
.chat-panel-col .panel-content:has(.work-case-shared) { padding: 0; margin: 0; }


/* ============================================================
   RELATED WORK STRIP (#357)
   Rendered at the bottom of the standalone /work/:slug page.
   Reuses the .work-tile atom from proof.css so
   the visual treatment cannot drift between the index and the
   related strip. Keeps a lightweight three-up layout that
   collapses to two then one column on smaller viewports.
   ============================================================ */
.work-related {
  margin-top: var(--sp-12);
  padding-top: var(--sp-8);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.work-related__inner {
  max-width: var(--case-renderer-content-max, 1200px);
  margin: 0 auto;
  padding: 0 clamp(var(--sp-5), 4vw, var(--sp-12));
}
.work-related__eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 18px;
}
.work-related__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 1279px) {
  .work-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .work-related__grid { grid-template-columns: 1fr; }
}
.work-related .work-tile { min-height: 240px; }
.work-related .work-tile .work-tile__client {
  font-size: var(--fs-h1);
}
