/* ==========================================================================
   ARRCO — Case Studies
   Extends the global design system in styles.css. Defines no new colour
   primitives beyond a dark surface used for project presentation, so the
   case-study pages stay recognisably ARRCO while letting each project's own
   imagery carry the visual weight.
   ========================================================================== */

:root {
  --cs-dark: #050a14;
  --cs-dark-2: #0b1424;
  --cs-dark-line: rgba(255, 255, 255, .14);
  --cs-dark-text: rgba(255, 255, 255, .78);
  --cs-space: clamp(56px, 8vw, 116px);
}

/* Shared width for reading columns. */
.cs-measure { max-width: var(--max); }

.cs-prose,
.cs-section .cs-prose {
  font-size: clamp(1.02rem, .45vw + .92rem, 1.18rem);
  line-height: 1.75;
  color: var(--muted);
  max-width: 68ch;
}
.cs-prose + .cs-prose { margin-top: 1.1em; }

/* --------------------------------------------------------------------------
   Listing page
   -------------------------------------------------------------------------- */

.cs-index-hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-soft) 60%, #16305a 100%);
  color: #fff;
  padding: clamp(64px, 9vw, 132px) 0 clamp(48px, 7vw, 96px);
}
.cs-index-hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: .18em 0 .38em;
  color: #fff;
}
.cs-eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--lime);
  margin: 0;
}
.cs-index-intro {
  font-size: clamp(1.05rem, .5vw + .95rem, 1.3rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, .82);
  max-width: 62ch;
  margin: 0;
}

.cs-index-body { padding: var(--cs-space) 0; background: var(--paper); }

.cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: clamp(24px, 3vw, 40px);
}

.cs-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cs-card:hover,
.cs-card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow); }

.cs-card-featured { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .cs-card-featured { flex-direction: row; align-items: stretch; }
  .cs-card-featured .cs-card-media { flex: 1 1 54%; min-height: 340px; }
  .cs-card-featured .cs-card-body { flex: 1 1 46%; justify-content: center; }
  .cs-card-featured .cs-card-title { font-size: clamp(1.7rem, 2vw, 2.15rem); }
}

.cs-card-media {
  display: block;
  background: var(--cs-dark);
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.cs-card-featured .cs-card-media { aspect-ratio: auto; }
.cs-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.cs-card-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .06) 25%, transparent 25%) 0 0/28px 28px,
    var(--cs-dark-2);
}

.cs-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(22px, 2.6vw, 34px);
}
.cs-card-meta {
  margin: 0;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 700;
  color: var(--primary);
}
.cs-card-client { margin: 0; font-weight: 700; color: var(--ink); }
.cs-card-title { margin: 0; font-size: 1.45rem; line-height: 1.22; letter-spacing: -.01em; }
.cs-card-title a { color: var(--ink); text-decoration: none; }
.cs-card-title a:hover { color: var(--primary); }
.cs-card-summary { margin: 0; color: var(--muted); line-height: 1.65; }

.cs-card-services {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.cs-card-services li {
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary-deep);
  background: rgba(7, 75, 255, .08);
  border-radius: 999px;
  padding: 5px 12px;
}

.cs-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.cs-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* --------------------------------------------------------------------------
   Detail hero
   -------------------------------------------------------------------------- */

.cs-hero {
  position: relative;
  isolation: isolate;
  background: var(--cs-dark);
  color: #fff;
  overflow: hidden;
}
.cs-hero-media { position: absolute; inset: 0; z-index: -2; }
.cs-hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.cs-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(5, 10, 20, .58) 0%, rgba(5, 10, 20, .78) 55%, rgba(5, 10, 20, .95) 100%);
}
.cs-hero-inner { padding: clamp(60px, 9vw, 140px) 0 clamp(44px, 6vw, 84px); }

.cs-breadcrumb {
  font-size: .84rem;
  color: rgba(255, 255, 255, .62);
  margin-bottom: clamp(24px, 4vw, 44px);
}
.cs-breadcrumb a { color: rgba(255, 255, 255, .82); text-decoration: none; }
.cs-breadcrumb a:hover { color: #fff; text-decoration: underline; }
.cs-breadcrumb span { margin: 0 6px; }

.cs-hero-client {
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--lime);
  margin: 0 0 .5em;
}
.cs-hero-title {
  font-size: clamp(2.3rem, 6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin: 0;
  color: #fff;
  max-width: 18ch;
}
.cs-hero-type {
  margin: .7em 0 0;
  font-size: clamp(1rem, .5vw + .9rem, 1.22rem);
  color: rgba(255, 255, 255, .74);
  font-weight: 600;
}
.cs-hero-intro { margin-top: clamp(20px, 2.6vw, 30px); max-width: 62ch; }
.cs-hero-intro p {
  color: var(--cs-dark-text);
  font-size: clamp(1.02rem, .45vw + .92rem, 1.18rem);
  line-height: 1.72;
  margin: 0 0 1em;
}
.cs-hero-actions { margin-top: clamp(24px, 3vw, 36px); }

.cs-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: clamp(18px, 2.4vw, 34px);
  margin: clamp(38px, 5vw, 64px) 0 0;
  padding-top: clamp(26px, 3vw, 38px);
  border-top: 1px solid var(--cs-dark-line);
}
.cs-meta-item dt {
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .55);
  margin-bottom: .6em;
}
.cs-meta-item dd { margin: 0; color: #fff; font-weight: 600; line-height: 1.5; }
.cs-meta-services { grid-column: 1 / -1; }
.cs-meta-services dd { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-meta-services dd span {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--cs-dark-line);
  border-radius: 999px;
  padding: 6px 13px;
}
@media (min-width: 760px) {
  .cs-meta-services { grid-column: auto; }
  .cs-meta { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* --------------------------------------------------------------------------
   Content sections
   -------------------------------------------------------------------------- */

.cs-section { padding: var(--cs-space) 0; background: #fff; }
.cs-section:nth-of-type(even) { background: var(--paper); }
.cs-section-heading {
  font-size: clamp(1.7rem, 3.2vw, 2.7rem);
  line-height: 1.14;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 .7em;
  max-width: 22ch;
}

.cs-list { margin: 1.6em 0 0; padding: 0 0 0 1.1em; max-width: 68ch; }
.cs-list li { margin-bottom: .75em; color: var(--muted); line-height: 1.7; }
.cs-list li::marker { color: var(--primary); }

.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 1.8em 0 0;
  padding: 0;
}
.cs-tag {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary-deep);
  background: #fff;
  border: 1px solid rgba(7, 75, 255, .26);
  border-radius: 999px;
  padding: 11px 20px;
  box-shadow: var(--shadow-soft);
}

/* Journey / conversion flow */
.cs-flow {
  list-style: none;
  margin: clamp(28px, 4vw, 44px) 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  counter-reset: step;
}
.cs-flow-step {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.cs-flow-step + .cs-flow-step::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 34px;
  width: 2px;
  height: 12px;
  background: rgba(7, 75, 255, .32);
}
.cs-flow-index {
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  padding: 6px 9px;
  letter-spacing: .04em;
}
.cs-flow-label {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  font-size: clamp(.98rem, .3vw + .9rem, 1.08rem);
}
@media (min-width: 880px) {
  .cs-flow { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
  .cs-flow-step { flex-direction: column; align-items: flex-start; gap: 12px; height: 100%; }
  .cs-flow-step + .cs-flow-step::before { top: 50%; left: -10px; width: 8px; height: 2px; }
}

/* Feature + service cards */
.cs-features,
.cs-services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: clamp(16px, 2vw, 26px);
  margin-top: clamp(30px, 4vw, 48px);
}
.cs-feature,
.cs-service {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(22px, 2.4vw, 30px);
  box-shadow: var(--shadow-soft);
}
.cs-section:nth-of-type(even) .cs-feature,
.cs-section:nth-of-type(even) .cs-service { background: #fff; }
.cs-feature h3,
.cs-service h3 {
  margin: 0 0 .55em;
  font-size: 1.12rem;
  line-height: 1.3;
  color: var(--ink);
}
.cs-service h3 {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .82rem;
  color: var(--primary);
}
.cs-feature p,
.cs-service p { margin: 0; color: var(--muted); line-height: 1.68; font-size: .97rem; }

/* --------------------------------------------------------------------------
   Device showcase
   -------------------------------------------------------------------------- */

.cs-section.cs-section-wide,
.cs-section.cs-section-wide:nth-of-type(even) { background: linear-gradient(180deg, var(--navy) 0%, var(--cs-dark) 100%); }
.cs-section-wide .cs-section-heading { color: #fff; }
.cs-section-wide .cs-prose { color: rgba(255, 255, 255, .74); }

.cs-devices {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  margin-top: clamp(34px, 4.5vw, 56px);
  align-items: end;
}
@media (min-width: 900px) {
  .cs-devices { grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); }
}
.cs-device { margin: 0; min-width: 0; }
.cs-device figcaption {
  margin-top: 14px;
  font-size: .84rem;
  color: rgba(255, 255, 255, .6);
  text-align: center;
}
.cs-device-shot { width: 100%; height: auto; display: block; }

.cs-browser {
  border-radius: 12px;
  overflow: hidden;
  background: #1b2434;
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .55);
}
.cs-browser-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: #222c3e;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.cs-browser-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
}

.cs-phone {
  position: relative;
  margin: 0 auto;
  max-width: 300px;
  border-radius: 38px;
  padding: 11px;
  background: #10161f;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 34px 70px rgba(0, 0, 0, .55);
}
.cs-phone .cs-device-shot { border-radius: 28px; }
.cs-phone-notch {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 44%;
  height: 22px;
  background: #10161f;
  border-radius: 0 0 14px 14px;
  z-index: 2;
}

/* Multi-column rather than grid: project imagery arrives at wildly different
   aspect ratios (a portrait book cover next to a wide full-page capture), and a
   fixed grid either crops them or strands large gaps. Columns let each figure
   keep its true proportions and flow naturally. */
.cs-gallery {
  columns: 1;
  column-gap: clamp(16px, 2vw, 26px);
  margin-top: clamp(28px, 3.5vw, 46px);
}
@media (min-width: 620px) { .cs-gallery { columns: 2; } }
@media (min-width: 1040px) { .cs-gallery { columns: 3; } }
.cs-gallery-item {
  margin: 0 0 clamp(16px, 2vw, 26px);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}
.cs-gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
}
.cs-gallery-item figcaption {
  margin-top: 10px;
  font-size: .82rem;
  color: rgba(255, 255, 255, .58);
}

/* --------------------------------------------------------------------------
   Visit + CTA
   -------------------------------------------------------------------------- */

.cs-visit {
  padding: var(--cs-space) 0;
  background: var(--paper);
  text-align: center;
}
.cs-visit h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin: 0 0 .5em;
  color: var(--ink);
  letter-spacing: -.02em;
}
.cs-visit .cs-prose { margin: 0 auto 1.8em; }
.cs-visit-url {
  margin: 1.4em 0 0;
  font-size: .88rem;
  letter-spacing: .06em;
  color: var(--muted);
  word-break: break-word;
}
.btn.btn-large { padding: 16px 34px; font-size: 1.02rem; }

.cs-cta {
  padding: var(--cs-space) 0;
  background: linear-gradient(140deg, var(--primary-deep) 0%, var(--primary) 55%, var(--primary-bright) 100%);
  color: #fff;
  text-align: center;
}
.cs-cta h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.85rem);
  line-height: 1.16;
  letter-spacing: -.02em;
  margin: 0 auto .55em;
  max-width: 22ch;
  color: #fff;
}
.cs-cta p {
  color: rgba(255, 255, 255, .88);
  font-size: clamp(1.02rem, .45vw + .92rem, 1.2rem);
  margin: 0 auto;
  max-width: 54ch;
  line-height: 1.65;
}
.cs-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: clamp(26px, 3vw, 38px);
}
.cs-cta .btn-outline { border-color: rgba(255, 255, 255, .7); color: #fff; }
.cs-cta .btn-outline:hover { background: rgba(255, 255, 255, .14); }
.cs-cta .btn-primary { background: #fff; color: var(--primary-deep); }
.cs-cta .btn-primary:hover { background: var(--lime); color: var(--navy); }

/* --------------------------------------------------------------------------
   Safety nets — nothing may overflow horizontally at any width
   -------------------------------------------------------------------------- */

.cs-article img { max-width: 100%; }
.cs-article { overflow-x: clip; }

@media (max-width: 420px) {
  .cs-hero-title { letter-spacing: -.015em; }
  .cs-card-actions .btn { width: 100%; justify-content: center; }
  .cs-cta-actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 360px) {
  :root { --cs-space: 46px; }
  .cs-hero-title { font-size: 2rem; }
  .cs-section-heading { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-card { transition: none; }
  .cs-card:hover, .cs-card:focus-within { transform: none; }
}

/* ==========================================================================
   Public — components added by the CMS
   ========================================================================== */

.cs-section-sub {
  font-size: clamp(1rem, .4vw + .9rem, 1.14rem);
  color: var(--muted);
  margin: -.4em 0 1.2em;
  max-width: 62ch;
}
.cs-section-wide .cs-section-sub { color: rgba(255, 255, 255, .7); }

.cs-list-note { color: var(--muted); opacity: .85; }
.cs-flow-body {
  display: block;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 400;
}

/* Metrics — only ever rendered from figures ARRCO entered. */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: clamp(16px, 2vw, 26px);
  margin-top: clamp(28px, 3.5vw, 44px);
}
.cs-metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(22px, 2.4vw, 30px);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-metric-value {
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--primary);
}
.cs-metric-label {
  font-weight: 700;
  color: var(--ink);
  font-size: .95rem;
}
.cs-metric-note { font-size: .86rem; color: var(--muted); line-height: 1.5; }

/* Quotes and testimonials */
.cs-testimonial { padding: var(--cs-space) 0; background: var(--navy); }
.cs-section-quote { background: var(--paper); }
.cs-quote { margin: 0; }
.cs-quote p {
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  line-height: 1.45;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0;
  position: relative;
  padding-left: clamp(20px, 3vw, 36px);
  border-left: 4px solid var(--primary);
}
.cs-testimonial .cs-quote p { color: #fff; border-left-color: var(--lime); }
.cs-quote cite {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding-left: clamp(24px, 3vw, 40px);
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}
.cs-testimonial .cs-quote cite { color: rgba(255, 255, 255, .8); }
.cs-quote-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.cs-callout {
  background: linear-gradient(135deg, rgba(7, 75, 255, .07), rgba(19, 186, 246, .09));
  border: 1px solid rgba(7, 75, 255, .2);
  border-radius: 18px;
  padding: clamp(24px, 3vw, 40px);
}
.cs-callout h2 { margin: 0 0 .5em; font-size: clamp(1.3rem, 2.2vw, 1.8rem); color: var(--ink); }
.cs-callout p { margin: 0 0 .8em; color: var(--muted); line-height: 1.7; }
.cs-callout p:last-child { margin-bottom: 0; }

.cs-block-figure { margin: clamp(26px, 3vw, 40px) 0 0; }
.cs-block-figure img { width: 100%; height: auto; border-radius: 16px; display: block; }
.cs-block-figure figcaption { margin-top: 12px; font-size: .86rem; color: var(--muted); }

.cs-before-after {
  display: grid;
  gap: clamp(16px, 2vw, 26px);
  margin-top: clamp(26px, 3vw, 40px);
}
@media (min-width: 720px) { .cs-before-after { grid-template-columns: 1fr 1fr; } }
.cs-before-after figure { margin: 0; }
.cs-before-after img { width: 100%; height: auto; border-radius: 14px; display: block; }
.cs-before-after figcaption {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.cs-video-link { margin-top: clamp(22px, 2.6vw, 32px); }

/* Draft preview banner — only ever shown to an authenticated developer. */
.cs-preview-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--warning);
  color: #2b1a00;
  font-size: .9rem;
}
.cs-preview-banner strong {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  background: rgba(0, 0, 0, .16);
  padding: 3px 9px;
  border-radius: 999px;
}
.cs-preview-banner a { color: #2b1a00; font-weight: 700; margin-left: auto; }

/* ==========================================================================
   Case Studies — developer dashboard
   Loaded by admin.html only. Everything is scoped under .cs-admin* so the
   public styles above and the dashboard cannot affect one another.
   ========================================================================== */

.cs-admin-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.cs-admin-head h2 { margin: 0 0 6px; }
.cs-admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cs-admin-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1180px) {
  .cs-admin-layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
}

/* --- listing --- */

.cs-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cs-filter {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.cs-filter:hover { border-color: var(--primary); color: var(--primary); }
.cs-filter.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

.cs-search {
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.cs-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cs-row:hover { border-color: var(--primary); }
.cs-row.is-current { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7, 75, 255, .12); }
.cs-row-thumb {
  flex: 0 0 76px;
  width: 76px;
  height: 58px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cs-dark-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .4);
}
.cs-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cs-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cs-row-main strong { color: var(--ink); line-height: 1.3; }
.cs-row-main small { color: var(--muted); font-size: .8rem; word-break: break-word; }
.cs-row-slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem !important; }
.cs-row-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 2px; }
.cs-row-order { font-size: .74rem; font-weight: 700; color: var(--muted); }
.cs-row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cs-row-actions .btn { padding: 5px 11px; font-size: .76rem; }

.cs-admin-move { display: flex; flex-direction: column; gap: 4px; }
.cs-admin-move button,
.cs-block-tools button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  font-size: .74rem;
}
.cs-admin-move button:hover:not(:disabled),
.cs-block-tools button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.cs-admin-move button:disabled,
.cs-block-tools button:disabled { opacity: .35; cursor: default; }
.cs-block-danger:hover { border-color: var(--danger) !important; color: var(--danger) !important; }

.cs-pill {
  display: inline-block;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 9px;
}
.cs-pill-published { background: rgba(36, 180, 126, .15); color: #14805a; }
.cs-pill-draft { background: rgba(245, 165, 36, .18); color: #8a5605; }
.cs-pill-archived { background: rgba(100, 116, 139, .16); color: #475569; }
.cs-pill-featured { background: rgba(7, 75, 255, .12); color: var(--primary-deep); }

/* --- editor --- */

.cs-admin-editor { min-width: 0; }
.cs-admin-empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 52px 24px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}
.cs-editor-form { display: flex; flex-direction: column; gap: 12px; }

.cs-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.cs-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: var(--paper);
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.cs-panel-head:hover { background: #eef2f9; }
.cs-panel-head small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.cs-panel-chevron { margin-left: auto; color: var(--muted); font-size: 1.1rem; line-height: 1; }
.cs-panel-body { padding: 18px; }
.cs-panel-body > h4 {
  margin: 22px 0 10px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--primary);
}
.cs-panel-body > h4:first-child { margin-top: 0; }

.cs-admin-hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.cs-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }

.cs-block {
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--paper);
  min-width: 0;
}
.cs-block-section { border-left-color: var(--cyan); }
.cs-subblock { background: #fff; border-left-color: var(--line); }
.cs-block-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cs-block-head strong {
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.cs-block-tools { display: flex; gap: 5px; flex-wrap: wrap; }

/* --- image slots --- */

.cs-file-input { display: none; }
.cs-image-slot { margin: 12px 0; }
.cs-image-slot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--paper);
}
.cs-image-preview {
  flex: 0 0 170px;
  width: 170px;
  height: 116px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cs-dark-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-image-preview-small { flex-basis: 120px; width: 120px; height: 84px; }
.cs-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.cs-image-empty { color: rgba(255, 255, 255, .45); font-size: .82rem; }
.cs-image-controls { flex: 1; min-width: 220px; }
.cs-image-controls > strong { display: block; color: var(--ink); margin-bottom: 4px; }
.cs-image-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.cs-gallery-row-body { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.cs-gallery-row-body .form-grid { flex: 1; min-width: 240px; }

/* --- save bar --- */

.cs-admin-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 -6px 24px rgba(15, 23, 42, .08);
}
.cs-admin-savebar .cs-spacer { flex: 1; }
.cs-dirty {
  font-size: .8rem;
  font-weight: 700;
  color: var(--warning);
  background: rgba(245, 165, 36, .14);
  padding: 5px 11px;
  border-radius: 999px;
}

/* --- dashboard responsiveness --- */

@media (max-width: 700px) {
  .cs-admin-head { flex-direction: column; }
  .cs-admin-actions .btn { flex: 1; }
  .cs-row { flex-wrap: wrap; }
  .cs-row-thumb { flex-basis: 60px; width: 60px; height: 46px; }
  .cs-admin-move { flex-direction: row; }
  .cs-image-slot-inner { flex-direction: column; }
  .cs-image-preview { flex-basis: auto; width: 100%; height: 150px; }
  .cs-admin-savebar { flex-direction: column; align-items: stretch; }
  .cs-admin-savebar .btn { width: 100%; justify-content: center; }
  .cs-admin-savebar .cs-spacer { display: none; }
}

/* Nothing in the dashboard may overflow its column. */
.cs-admin-editor input,
.cs-admin-editor textarea,
.cs-admin-editor select { max-width: 100%; }
.cs-admin-editor textarea { min-height: 84px; resize: vertical; font-family: inherit; }

/* The global .btn-outline is white-on-transparent, which is correct on the dark
   hero sections of the public site but invisible inside the light dashboard
   panels. Re-skin it for this context only; the public rules are untouched. */
#admin-case-studies .btn-outline {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}
#admin-case-studies .btn-outline:hover,
#admin-case-studies .btn-outline:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff;
}
#admin-case-studies .btn-outline.cs-block-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* --------------------------------------------------------------------------
   Drag-and-drop reordering (dashboard)
   The handle is the only drag surface: making the whole card draggable makes
   text impossible to select and turns every touch-scroll into a drag.
   -------------------------------------------------------------------------- */

.cs-rows { min-height: 8px; }

.cs-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: grab;
  font-size: .9rem;
  line-height: 1;
  /* Let vertical panning through so the list still scrolls on touch. */
  touch-action: pan-y;
  user-select: none;
}
.cs-drag:hover { border-color: var(--primary); color: var(--primary); }
.cs-drag:active { cursor: grabbing; }

.cs-block-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cs-block-title strong { min-width: 0; overflow-wrap: anywhere; }

/* The row being dragged */
.cs-drag-chosen { outline: 2px solid var(--primary); outline-offset: 1px; }
.cs-drag-active { opacity: .96; }
/* The gap showing where it will land */
.cs-drag-ghost {
  opacity: .45;
  background: rgba(7, 75, 255, .08) !important;
  border-style: dashed !important;
  border-color: var(--primary) !important;
}
/* Suppress text selection only while a drag is in progress. */
.sortable-drag, .sortable-chosen { user-select: none; }

/* Listing rows carry the handle at their left edge. */
.cs-row > .cs-drag { align-self: center; }

@media (max-width: 700px) {
  .cs-drag { width: 34px; height: 34px; }   /* comfortable touch target */
}

@media (prefers-reduced-motion: reduce) {
  .cs-drag-ghost, .cs-drag-active, .cs-drag-chosen { transition: none !important; }
}
