/* ─────────────────────────────────────────────────────────────────────────
   /work/<slug>/ — shared stylesheet for the static case-study pages.

   Deliberately built on the same design language as the portfolio home page
   (css/style.css): the #080808 canvas, gold #C9A84C accent, Bebas Neue
   display type, DM Serif Display ledes, square uppercase buttons, 1px
   hairlines and 12px card corners. No JavaScript — language switching is
   plain links, so these pages stay very cheap.
   ───────────────────────────────────────────────────────────────────────── */

@font-face { font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/bebasneue-latin.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 300 600; font-display: swap; src: url('/fonts/dmsans-latin.woff2') format('woff2'); }
@font-face { font-family: 'DM Serif Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/dmserifdisplay-latin.woff2') format('woff2'); }

:root {
  --bg:            #080808;
  --bg-2:          #0f0f0f;
  --bg-3:          #141414;
  --surface:       rgba(255,255,255,0.03);
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.15);
  --gold:          #C9A84C;
  --gold-lt:       #E8C97A;
  --text:          #F0EDEA;
  --muted:         #8A8782;
  --font-disp: 'Bebas Neue', 'Impact', 'Arial Black', sans-serif;
  --font-ser:  'DM Serif Display', 'Georgia', 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --pad-x:     clamp(1.25rem, 4vw, 3rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.cs-wrap {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.cs-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem var(--pad-x);
  background: rgba(8,8,8,0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.cs-back {
  margin-inline-end: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s var(--ease);
}
.cs-back:hover { color: var(--gold); }
.cs-back .arw { display: inline-block; }

/* ── Buttons — mirrors .btn-primary / .btn-secondary on the home page ────── */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1rem 2.2rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s;
}
.btn-primary { background: var(--gold); color: var(--bg); }
.btn-primary:hover { background: var(--gold-lt); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(201,168,76,0.3); }
.btn-secondary { border: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }
.btn-primary .arw,
.btn-secondary .arw { display: inline-block; }

.cs-toolbar-cta { display: inline-flex; }
.cs-toolbar .btn-primary { padding: 0.62rem 1.15rem; font-size: 0.7rem; gap: 0.45rem; }
.cs-toolbar .btn-primary:hover { transform: none; }

/* ── Language switcher — mirrors the home-page control ──────────────────── */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2rem;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
.lang-btn {
  padding: 0.4rem 1rem;
  border-radius: 1.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.6;
  transition: color 0.3s, background 0.3s, opacity 0.3s;
}
.lang-btn:hover { color: var(--gold); opacity: 1; }
.lang-btn.is-active { color: var(--bg); background: var(--gold); opacity: 1; box-shadow: 0 2px 8px rgba(201,168,76,0.35); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.cs-hero {
  padding-top: clamp(3.5rem, 8vw, 7rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.section-label::before {
  content: '';
  flex: 0 0 auto;
  width: 28px;
  height: 1px;
  background: var(--gold);
}

.cs-title {
  margin: 0 0 1.5rem;
  max-width: 20ch;
  font-family: var(--font-disp);
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.cs-lede {
  margin: 0 0 2rem;
  max-width: 60ch;
  font-family: var(--font-ser);
  font-size: clamp(1.05rem, 2.3vw, 1.4rem);
  line-height: 1.55;
  color: var(--muted);
}

.cs-meta { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; margin-bottom: 1.5rem; }
.cs-meta .k {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.cs-meta .v { font-size: 0.95rem; color: var(--text); }

.cs-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem; }
.chip {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 2rem;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.cs-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }

.cs-heroimg {
  margin: 0;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 40px 80px -50px rgba(0,0,0,0.95);
}

/* ── Metrics strip ──────────────────────────────────────────────────────── */
.cs-metrics-wrap { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.cs-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cs-metric { flex: 1 1 160px; padding: 1.6rem 1.4rem; background: var(--bg-2); }
.cs-metric-val {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-disp);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--gold);
}
.cs-metric-label { display: block; font-size: 0.82rem; line-height: 1.4; color: var(--muted); }

/* ── Sections ───────────────────────────────────────────────────────────── */
.cs-section {
  padding-block: clamp(3rem, 6.5vw, 5.5rem);
  border-top: 1px solid var(--border);
}
.cs-section .section-label { margin-bottom: 1rem; }
.cs-section .section-title {
  margin: 0 0 1.75rem;
  font-family: var(--font-disp);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.cs-list { display: grid; gap: 1rem; max-width: 76ch; margin: 0; padding: 0; list-style: none; }
.cs-list li {
  position: relative;
  padding-inline-start: 1.5rem;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}
.cs-list li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  background: var(--gold);
}
.cs-list li strong { margin-inline-end: 0.15rem; color: var(--text); font-weight: 600; }

/* ── Gallery ────────────────────────────────────────────────────────────── */
.cs-gallery { display: grid; gap: 1.75rem; }
.cs-gallery figure { margin: 0; }
.cs-gallery img {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-2);
}
.cs-gallery figcaption { margin-top: 0.7rem; font-size: 0.85rem; line-height: 1.5; color: var(--muted); }

@media (min-width: 760px) {
  .cs-gallery--two { grid-template-columns: 1fr 1fr; }
}

/* ── Impact callout ─────────────────────────────────────────────────────── */
.cs-impact-wrap { padding-block: clamp(0.5rem, 2vw, 1rem); }
.cs-impact {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--gold);
  border-radius: 12px;
}
.cs-impact-label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.cs-impact p {
  margin: 0;
  max-width: 62ch;
  font-family: var(--font-ser);
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  line-height: 1.5;
  color: var(--text);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.cs-foot-wrap {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 4rem;
  border-top: 1px solid var(--border);
}
.cs-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.cs-foot .grow { margin-inline-end: auto; }
.cs-foot a { color: var(--text); transition: color 0.25s var(--ease); }
.cs-foot a:hover { color: var(--gold); }

/* ── Arabic / RTL ───────────────────────────────────────────────────────────
   Arabic is cursive, so letter-spacing is forced off (it breaks glyph
   joining). Bebas Neue has no Arabic glyphs, so the Arabic pages fall back to
   a system Arabic stack — the same approach the home page and résumé use.  */
html[lang="ar"] {
  --font-disp: 'Noto Kufi Arabic', 'Noto Naskh Arabic', 'Segoe UI', Tahoma, 'Geeza Pro', Arial, sans-serif;
  --font-body: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, 'Geeza Pro', Arial, sans-serif;
  --font-ser:  'Noto Naskh Arabic', 'Segoe UI', Tahoma, 'Geeza Pro', Arial, sans-serif;
}
html[lang="ar"] .section-label,
html[lang="ar"] .cs-meta .k,
html[lang="ar"] .cs-impact-label,
html[lang="ar"] .cs-back,
html[lang="ar"] .lang-btn,
html[lang="ar"] .btn-primary,
html[lang="ar"] .btn-secondary { letter-spacing: 0; }
html[lang="ar"] .cs-title,
html[lang="ar"] .cs-section .section-title { text-transform: none; }
html[lang="ar"] .cs-title { max-width: none; font-size: clamp(2rem, 6.5vw, 3.4rem); line-height: 1.2; }
html[lang="ar"] .cs-section .section-title { font-size: clamp(1.6rem, 4.2vw, 2.4rem); line-height: 1.25; }
html[lang="ar"] .cs-lede,
html[lang="ar"] .cs-impact p { font-size: clamp(1rem, 2.2vw, 1.25rem); line-height: 1.7; }

html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .cs-back .arw,
html[dir="rtl"] .btn-primary .arw,
html[dir="rtl"] .btn-secondary .arw { display: inline-block; transform: scaleX(-1); }

/* ── Phone type floors ──────────────────────────────────────────────────────
   Kept at the very end of the sheet so it wins the cascade against the base
   label rules above (equal specificity — later wins). The eyebrow/label
   styles render at ~11px, which is below a comfortable reading size on a
   phone; this lifts just those labels at phone widths, leaving desktop
   untouched. */
@media (max-width: 759px) {
  .section-label   { font-size: 0.78rem; }
  .cs-meta .k      { font-size: 0.75rem; }
  .chip            { font-size: 0.78rem; }
  .cs-impact-label { font-size: 0.75rem; }

  /* Sticky toolbar: keep it to a single row on phones. The "Visit live site"
     CTA is redundant here (the hero already carries one), so drop it and
     tighten the row so the back link + language switcher fit on one line. */
  .cs-toolbar     { gap: 0.4rem; padding-block: 0.55rem; }
  .cs-toolbar-cta { display: none; }
  /* Standalone footer links (back / contact) get a full-height hit area; the
     cross-links inside the "More case studies" sentence stay inline. */
  .cs-foot > a    { display: inline-flex; align-items: center; min-height: 44px; }
  .cs-back        { min-height: 44px; letter-spacing: 0.04em; }
  .lang-switcher  { padding: 0.15rem; }
  .lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0.4rem 0.6rem;
  }
}

/* ── Print / Save-as-PDF ────────────────────────────────────────────────────
   These pages are dark by default, so sending one to a printer put #F0EDEA
   text on white paper — effectively invisible. Reset the palette to ink on
   white the same way /resume/ does, and neutralise the element that paints
   light text on a coloured fill (.btn-primary) so it survives a print dialog
   with "background graphics" turned off, which is the default. */
@media print {
  :root {
    --bg:            #ffffff;
    --bg-2:          #ffffff;
    --bg-3:          #ffffff;
    --surface:       #ffffff;
    --border:        #d5d5d5;
    --border-strong: #b3b3b3;
    --gold:          #7a6529;   /* 5.5:1 on white — darker than the screen #C9A84C */
    --gold-lt:       #7a6529;
    --text:          #111111;
    --muted:         #3d3d3d;
  }

  /* Freeze transitions: otherwise the snapshot can catch a half-finished fade
     from the screen palette into the values below. */
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  body { background: #fff; color: #111; font-size: 11pt; line-height: 1.5; }
  a { color: inherit; text-decoration: none; }

  /* Sticky chrome and the oversized hero padding mean nothing on paper. */
  .cs-toolbar { display: none !important; }
  .cs-wrap { max-width: none; padding-inline: 0; }
  .cs-hero { padding-top: 0; padding-bottom: 1.25rem; }
  .cs-section { padding-block: 1.25rem; }
  .cs-title { font-size: 26pt; max-width: none; color: #000; }
  .cs-section .section-title { font-size: 15pt; color: #000; }
  .cs-lede, .cs-impact p { font-size: 1.1rem; }
  .section-label::before { background: #7a6529; }

  /* Outlined instead of gold-filled: with background graphics off, the button's
     light label would otherwise print white-on-white. */
  .btn-primary,
  .btn-secondary {
    background: none !important;
    color: #111 !important;
    border: 1px solid #999;
    padding: 0.55rem 1rem;
    box-shadow: none !important;
  }

  .cs-metrics { background: #d5d5d5; border-color: #d5d5d5; }
  .cs-metric { background: #fff; }
  .cs-impact { background: #fff; border-color: #d5d5d5; }
  .chip { border-color: #b3b3b3; }
  .cs-heroimg, .cs-gallery img { border-color: #b3b3b3; box-shadow: none; background: #fff; }
  .cs-foot a { color: #000; }

  /* Keep cards, figures and the impact callout off a sheet boundary. */
  .cs-section, .cs-impact, .cs-metric, .cs-gallery figure, .cs-heroimg { break-inside: avoid; }

  /* The one outbound link that matters, printed as a destination. */
  .cs-cta a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #3d3d3d; }

  @page { margin: 1.4cm; }
}
