/* ============================================================================
   CASE STUDIES — library + article
   ----------------------------------------------------------------------------
   The page body carries `catalog-category-view`, added by the controller, so
   every .pl-* component from the product listing (hero, toolbar, grid, card,
   pager) is already live and inherits the real design system. This sheet only
   adds what a case study needs on top of it:

     · a 4:3 cover cropped with `cover` instead of the catalogue's contained 1:1
       product shot — a deployment photo is a scene, not a cut-out;
     · a lead card spanning two columns so the grid has a visual entry point;
     · an article that sets its body in two columns at desktop, with photographs
       breaking across both;
     · the pager markup the theme already dresses as square buttons.

   Every selector is rooted at body.cs-page. That lifts specificity to (0,2,1+),
   which beats the theme's :is(.catalog-category-view,…) rules at (0,2,0) — so
   these overrides hold at every breakpoint without resorting to !important.

   Loaded only on the two casestudies routes (see the layout files), not
   storefront-wide.
   ========================================================================== */

/* ---- 1. layout: one column, this page has no filter rail ---------------- */
/* The theme lays the catalogue out as a 224px filter rail plus the grid. There
   is no rail here, so the single track is declared explicitly rather than left
   to the absence of a sidebar. */
body.cs-page .page-main > .columns {
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
}
body.cs-page .page-main > .columns > .column.main {
  grid-column: 1;
  grid-row: 1;
}

/* ---- 2. banner: keep the listing's split hero, retune the crop ---------- */
/* The visible band is the right of a short strip, so the focal point has to sit
   slightly below centre or the container stacks get sliced into unreadable
   bands. */
body.cs-page .pl-hero-media img { object-position: 52% 58%; }

/* ---- 3. toolbar: total on the left, page counter on the right ----------- */
/* On the catalogue the toolbar butts straight up against the hero with no gap;
   the filter rail beside it starts at the same y and carries its own padding,
   so the seam never shows. Here the toolbar is the only thing under the banner
   and a 0px gap reads as a collision. The offset is deliberately slightly
   smaller than the toolbar's own bottom rhythm (14px pad + border + 26px), so
   the label sits closer to the banner above it than to the grid below. */
body.cs-page .cs-bar {
  margin-top: clamp(24px, 2.8vw, 36px);
}

body.cs-page .cs-bar-note {
  margin: 0;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* ---- 4. grid ----------------------------------------------------------- */
/* Three columns at desktop. The catalogue uses auto-fill/min 228px, which at
   1560px yields five; a deployment photo needs more width than a product
   thumbnail before the scene is legible. */
body.cs-page .pl-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.5vw, 22px);
  align-items: start;
}

/* ---- 5. cover ---------------------------------------------------------- */
/* No industry chip, no metric, no overlay label: the card is a photograph, a
   headline, a paragraph and a year. Anything else competes with the two things
   a reader actually scans — the picture and the title. */
body.cs-page .pl-media {
  aspect-ratio: 4 / 3;
  background: var(--mist);
}
body.cs-page .pl-media img {
  object-fit: cover;          /* overrides the catalogue's contain */
  object-position: 50% 50%;
}
/* The zoom is slower and shallower than the catalogue's 1.05 / 1.15s: a 4:3
   scene moving at product-photo speed reads as a glitch, not a hover. */
body.cs-page .pl-card:hover .pl-media img,
body.cs-page .pl-card:focus-within .pl-media img { transform: scale(1.035); }

/* the CTA pill from the listing, relabelled — same geometry, same reveal */
body.cs-page .pl-media-cta { font-size: 12px; letter-spacing: .06em; }

/* ---- 6. card body ------------------------------------------------------ */
/* Three lines, not four: the 4:3 cover already makes the card ~80px taller than
   a product card, and four lines push the year out of alignment between a
   two-line and a four-line neighbour. */
body.cs-page .pl-sub { -webkit-line-clamp: 3; }

/* The year is the only thing left in the meta row, so it goes to the right edge
   and reads as a dateline rather than a label with nothing beside it. */
body.cs-page .pl-meta { justify-content: flex-end; }

body.cs-page .cs-year {
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* ---- 7. lead card ------------------------------------------------------ */
/* One card per page opens across two columns. It gives the grid an entry point
   and, more practically, lets the widest photo in the set be shown at something
   close to its intended aspect instead of being cropped square. */
body.cs-page .cs-card--featured { grid-column: span 2; }
body.cs-page .cs-card--featured .pl-media { aspect-ratio: 2.4 / 1; }
body.cs-page .cs-card--featured .pl-title { font-size: clamp(17px, 1.5vw, 21px); }
body.cs-page .cs-card--featured .pl-sub { -webkit-line-clamp: 2; }
body.cs-page .cs-card--featured .pl-body { padding: 18px 20px 16px; }

/* ---- 8. pager ---------------------------------------------------------- */
/* `.pages` already exists in the theme (38px square buttons, inverted current
   page). Only the row's vertical rhythm is adjusted, because a case grid is
   taller than a product grid and the default gap reads tight. */
body.cs-page .pl-pager-bar {
  margin-top: clamp(32px, 3.6vw, 52px);
  padding-top: 20px;            /* same as the catalogue's .pl-pager-bar */
}
body.cs-page .pl-range { font-variant-numeric: tabular-nums; }
/* a disabled arrow must not look clickable */
body.cs-page .pages .item .action[aria-disabled="true"] { opacity: .32; cursor: default; }

/* ============================================================================
   ARTICLE
   ========================================================================== */

/* ---- 9. banner: the photograph, and nothing printed on it -------------- */
/* A category hero works because a hero is a header. On an article, copy set on
   a dark slab above the reading text reads as a poster — the page then has two
   visual worlds. The banner is a photograph with no overlay, the headline sits
   on paper below it, and the two share one left edge. */
body.cs-page .cs-banner {
  margin: clamp(16px, 2vw, 26px) 0 0;   /* the same top rhythm as the hero */
  background: var(--mist);
}
/* The asset is cropped to 2.9:1 upstream, so `cover` is a no-op at the right
   aspect and only absorbs sub-pixel rounding. Declaring the ratio keeps the box
   from collapsing before the image decodes. */
body.cs-page .cs-banner img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.9 / 1;
  object-fit: cover;
  object-position: 50% 50%;
}

/* ---- 10. headline and dateline ----------------------------------------- */
/* The article's edges line up with the banner's. The measure comes from the two
   columns inside it: at 1440 the container is 1319px, each column ~630px, which
   at 16px lands on roughly 70 characters. */
body.cs-page .cs-article {
  margin: clamp(26px, 3vw, 42px) 0 0;
}

body.cs-page .cs-title {
  margin: 0;
  font-size: calc(var(--h-scale, 1) * clamp(1.75rem, 3vw, 3rem));
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.018em;
  color: var(--ink);
  text-wrap: balance;
}

/* Dateline. The separators carry their own padding instead of coming from a
   flex gap, so "Singapore · 2026" keeps exactly one dot whether it sits on the
   desktop row or wraps on a phone. */
body.cs-page .cs-article .cs-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 0;
  font-size: 12px;
  letter-spacing:.04em;
  color: var(--muted-2);
}
body.cs-page .cs-article .cs-meta b { font-weight: 400; color: var(--ink-2); }
body.cs-page .cs-article .cs-meta i { font-style: normal; color: #CFCFC8; padding: 0 .5em; }

/* ---- 11. body ---------------------------------------------------------- */
/* The body is authored in the admin's WYSIWYG editor, so it arrives as plain
   <h2> / <p> / <ul> / <figure> with no wrapper classes. Two columns at desktop
   because one would be 1319px wide, which at 16px is ~147 characters per line —
   past the point where the eye finds the start of the next line. Heading and
   figure break across both, which is what turns the flow into chapters. */
body.cs-page .cs-body {
  margin: clamp(22px, 2.4vw, 32px) 0 0;
  font-size: 16px;
  line-height: 1.66;
  color: var(--muted);
}

body.cs-page .cs-body > h2 {
  column-span: all;
  margin: clamp(28px, 3vw, 42px) 0 14px;
  font-size: clamp(20px, 1.7vw, 26px);
  font-weight: 500;
  line-height: 1.26;
  letter-spacing: -.01em;
  color: var(--ink);
}
body.cs-page .cs-body > h2:first-child { margin-top: 0; }

body.cs-page .cs-body > h3 {
  column-span: all;
  margin: clamp(22px, 2.4vw, 32px) 0 10px;
  font-size: clamp(17px, 1.3vw, 20px);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

body.cs-page .cs-body p {
  margin: 0 0 15px;
  font-size: 16px;
  line-height: 1.66;
  color: var(--muted);
}

/* The first paragraph carries the deck: one step up in size, no decoration, so
   the opening reads as a standfirst without a second component to maintain. */
body.cs-page .cs-body > p:first-child {
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.66;
  color: var(--ink-2);
  margin-bottom: 18px;
}

body.cs-page .cs-body strong { font-weight: 500; color: var(--ink); }
body.cs-page .cs-body a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
body.cs-page .cs-body a:hover { color: var(--accent); border-color: var(--accent); }

/* a plain bullet list, marker drawn rather than inherited, so it matches the
   accent rule used elsewhere on the site */
body.cs-page .cs-body ul {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  break-inside: avoid;
}
body.cs-page .cs-body ul li {
  position: relative;
  padding: 0 0 0 20px;
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.66;
  color: var(--muted);
}
body.cs-page .cs-body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 7px;
  height: 1px;
  background: var(--accent);
}
body.cs-page .cs-body ol {
  margin: 0 0 16px 20px;
  padding: 0;
  break-inside: avoid;
}
body.cs-page .cs-body ol li { margin: 0 0 10px; font-size: 16px; line-height: 1.66; color: var(--muted); }

body.cs-page .cs-body blockquote {
  margin: clamp(20px, 2.2vw, 28px) 0;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--accent);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.5;
  color: var(--ink);
  break-inside: avoid;
}
body.cs-page .cs-body blockquote p { font-size: inherit; line-height: inherit; color: inherit; margin: 0; }

/* ---- 12. figures inside the body --------------------------------------- */
/* Full width and across both columns, so a photograph inside the text lines up
   with the photograph at the top of the page. A 4:3 crop across 1319px would
   stand ~990px tall and swallow the article, so the admin is expected to upload
   2.4:1 assets; `cover` absorbs the rest. */
body.cs-page .cs-body figure {
  column-span: all;
  margin: clamp(26px, 2.8vw, 38px) 0;
}
body.cs-page .cs-body figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.4 / 1;
  object-fit: cover;
  background: var(--mist);
}
/* A caption is a note, not a second paragraph. At the full 1319px it would run
   ~150 characters on one line and read as a strapline for the whole page. */
body.cs-page .cs-body figcaption {
  max-width: 78ch;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: .02em;
  color: var(--muted-2);
  padding-left: 14px;
  border-left: 2px solid var(--line);
}

/* An editor-inserted image with no figure wrapper: keep it inside its column
   rather than letting it blow out the track. */
body.cs-page .cs-body img {
  max-width: 100%;
  height: auto;
}

/* ---- 13. gallery: extra frames from the record ------------------------- */
body.cs-page .cs-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.1vw, 14px);
  margin: clamp(26px, 2.8vw, 38px) 0;
}
/* The ratio belongs on the figure, not the img. With `height:100%` on the img
   and no height on the figure, the two reference each other: an image that has
   not decoded yet collapses to zero and the row loses its shape. */
body.cs-page .cs-gallery figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--mist);
}
body.cs-page .cs-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- 14. closing line -------------------------------------------------- */
/* A case study that reads well ends with a question; a card in the margin
   interrupts it. */
body.cs-page .cs-article .cs-cta-line {
  margin: clamp(26px, 2.8vw, 34px) 0 0;
  padding-top: clamp(20px, 2.2vw, 26px);
  border-top: 1px solid var(--line);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--muted);
}
body.cs-page .cs-cta-line a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color .25s, border-color .25s;
}
body.cs-page .cs-cta-line a:hover { color: var(--accent); border-color: var(--accent); }
body.cs-page .cs-cta-line svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* ---- 15. more case studies ------------------------------------------- */
body.cs-page .cs-more {
  margin-top: clamp(44px, 5vw, 76px);
  padding-top: clamp(30px, 3.4vw, 48px);
  border-top: 1px solid var(--line);
}
body.cs-page .cs-more-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: clamp(20px, 2.2vw, 28px);
}
body.cs-page .cs-more-title {
  margin: 0;
  font-size: calc(var(--h-scale, 1) * clamp(1.25rem, 1.7vw, 1.6rem));
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
}
body.cs-page .cs-more-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  letter-spacing: .02em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: color .25s, border-color .25s;
}
body.cs-page .cs-more-link:hover { color: var(--accent); border-color: var(--accent); }
body.cs-page .cs-more-link svg { width: 13px; height: 13px; }
body.cs-page .cs-more .pl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ============================================================================
   RESPONSIVE
   Declared after every base rule on purpose: a media query adds no specificity,
   so a responsive override only wins by coming later in the sheet.
   ========================================================================== */

/* Two text columns only where two columns can hold a measure. At 1024 the
   container is 938px, which leaves ~445px each — 50 characters, tight but
   legible. */
@media (min-width: 1024px) {
  body.cs-page .cs-body {
    columns: 2;
    column-gap: clamp(32px, 3.6vw, 56px);
  }
}

@media (max-width: 1023px) {
  body.cs-page .cs-card--featured .pl-media { aspect-ratio: 16 / 9; }
  /* 2.9:1 is a cinema band; on a 768px tablet it is a 243px stripe. Open it up
     to 2.4 and let cover take the sides. */
  body.cs-page .cs-banner img { aspect-ratio: 2.4 / 1; }
}

@media (max-width: 820px) {
  /* On mobile the theme lays the banner photo full-bleed behind the copy and
     stacks an 88/60/75% black gradient on top, which leaves the photograph
     effectively invisible behind 180px of text. This page is sold on its
     photography, so the overlay is pulled back — text sits in the top two
     thirds at 84% black, the bottom third clears to 62% and the image reads. */
  body.cs-page .pl-hero-media { opacity: .62; }
  body.cs-page .pl-hero-media::after {
    background: linear-gradient(180deg,
      rgba(14, 15, 16, .84) 0%,
      rgba(14, 15, 16, .46) 54%,
      rgba(14, 15, 16, .68) 100%);
  }
  /* the theme drops .pl-grid to two columns here; the lead card still spans both */
  body.cs-page .pl-grid,
  body.cs-page .cs-more .pl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  /* One column: at 390px a two-up grid leaves a 175px cover, which is a
     thumbnail of a scene rather than a scene. */
  body.cs-page .pl-grid,
  body.cs-page .cs-more .pl-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  body.cs-page .cs-card--featured { grid-column: span 1; }
  body.cs-page .cs-card--featured .pl-media { aspect-ratio: 4 / 3; }
  body.cs-page .pl-sub { -webkit-line-clamp: 4; }
  body.cs-page .cs-card--featured .pl-body { padding: 15px 16px 14px; }
  /* a pair stops reading as a pair below ~330px per frame */
  body.cs-page .cs-gallery { grid-template-columns: minmax(0, 1fr); }
  body.cs-page .cs-more-head { flex-direction: column; gap: 12px; }
  /* A 2.9:1 band on a 350px phone is a 120px letterbox — the photograph turns
     into a stripe. Both the banner and the body figures open up to about 2:1
     and let `cover` take the sides. */
  body.cs-page .cs-banner img { aspect-ratio: 2 / 1; }
  body.cs-page .cs-body figure img { aspect-ratio: 1.68 / 1; }
  body.cs-page .cs-title { font-size: calc(var(--h-scale, 1) * 1.7rem); }
  body.cs-page .cs-article .cs-meta {
    flex-direction: column;
    align-items: flex-start;
    letter-spacing: .08em;
  }
  body.cs-page .cs-article .cs-meta .cs-meta-sep { display: none; }
}

/* Motion: the cover zoom is the only animation on these pages, and it is
   decoration — drop it rather than shorten it. */
@media (prefers-reduced-motion: reduce) {
  body.cs-page .pl-card:hover .pl-media img,
  body.cs-page .pl-card:focus-within .pl-media img { transform: none; }
}
