/* =========================================================
   Our work — home teaser and case study pages
   Client colours appear only in client artwork, never as UI colours.
   ========================================================= */

/* ---------- device frames ---------- */
.frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.frame__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  direction: ltr;
}
.frame__dots { display: flex; gap: 6px; }
.frame__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.frame__url {
  flex: 1;
  min-width: 0;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame img { width: 100%; height: auto; }

.phone {
  width: 100%;
  max-width: 220px;
  padding: 8px;
  border-radius: 30px;
  background: #050816;
  border: 1px solid #1a2550;
}
.phone img { width: 100%; height: auto; border-radius: 22px; }

/* ---------- home: work teaser ---------- */
.work-card {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(20px, 3.5vw, 40px);
  background: var(--surface);
  border: 1px solid var(--border);
  --cut: 32px;
}
.work-card__media { position: relative; padding-bottom: 32px; padding-inline-end: 48px; }
.work-card__media .phone {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 30%;
  max-width: 170px;
  padding: 6px;
  border-radius: 22px;
  transition: transform 0.6s var(--ease-out);
}
.work-card__media .phone img { border-radius: 16px; }
.work-card:hover .work-card__media .phone { transform: translateY(-8px); }
.work-card__copy { display: grid; gap: 18px; justify-items: start; }
.work-card__ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.btn .ext { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .btn .ext { transform: scaleX(-1); }
.work-card__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.work-card__title { font-size: clamp(2.25rem, 5vw, 3.5rem); }
.work-card__logos { display: flex; align-items: center; gap: 14px; }
.work-card__logos img { height: 56px; width: auto; }
.work-card__logos .old { border-radius: 50%; width: 56px; height: 56px; object-fit: cover; }
.work-card__logos .arrow { color: var(--accent); font-family: var(--font-mono); }
[dir="rtl"] .work-card__logos .arrow { transform: scaleX(-1); }
.work-card__logos .new { padding: 10px 14px; height: 56px; background: #11150f; border-radius: var(--radius-md); }

/* ---------- case study: hero ---------- */
.cs-hero { min-height: 0; padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 7vw, 96px); display: block; }
.cs-hero .hero__glow { bottom: -80%; left: 30%; opacity: 0.6; }
[dir="rtl"] .cs-hero .hero__glow { left: auto; right: 30%; }
.cs-hero__head { display: grid; gap: 22px; max-width: 900px; margin-bottom: clamp(36px, 5vw, 56px); }
.cs-hero__back { font-size: 0.8125rem; color: var(--muted); display: inline-flex; gap: 8px; }
.cs-hero__back:hover { color: var(--text); }
[dir="rtl"] .cs-hero__back .arrow { transform: scaleX(-1); }
.cs-hero .display { font-size: clamp(2.5rem, 7vw, 5rem); }

.cs-cover { position: relative; }
.cs-cover .phone {
  position: absolute;
  inset-inline-end: clamp(12px, 4vw, 48px);
  bottom: clamp(-40px, -3vw, -16px);
  width: 22%;
  max-width: 220px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 0;
  margin-top: clamp(56px, 7vw, 88px);
  border-top: 1px solid var(--border);
}
.facts div { padding: 18px 20px 18px 0; display: grid; gap: 6px; align-content: start; }
[dir="rtl"] .facts div { padding: 18px 0 18px 20px; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { font-weight: 500; }

.disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--muted);
}
.disclaimer .tag { flex: none; }

/* ---------- case study: chapters ---------- */
.chapter { border-top: 1px solid var(--border); }
.chapter__grid {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 32px clamp(32px, 6vw, 80px);
  align-items: start;
}
.chapter__head { display: grid; gap: 14px; position: sticky; top: 104px; }
.chapter__body { display: grid; gap: 28px; min-width: 0; }
.chapter__body > p { color: var(--muted); max-width: 62ch; }
.chapter__wide { margin-top: clamp(40px, 6vw, 64px); }

.quote {
  font: 700 clamp(1.5rem, 3vw, 2.25rem)/1.25 var(--font-display);
  letter-spacing: -0.02em;
  padding-inline-start: 20px;
  border-inline-start: 3px solid var(--accent);
}
[lang="ar"] .quote { letter-spacing: 0; line-height: 1.5; }

/* chat mock for the "before" */
.chat {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  max-width: 460px;
}
.chat p { padding: 10px 14px; border-radius: 14px; font-size: 0.9375rem; max-width: 85%; width: fit-content; }
.chat .in { background: var(--surface-2); border-end-start-radius: 4px; }
.chat .out { justify-self: end; background: var(--tag-blue-bg); color: var(--text); border-end-end-radius: 4px; }
.chat__head { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }

.pains { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pain {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: grid;
  gap: 8px;
  align-content: start;
}
.pain p { color: var(--muted); font-size: 0.9375rem; }

/* before / after */
.ba {
  display: grid;
  grid-template-columns: 1fr auto 1.3fr;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ba__side { display: grid; gap: 16px; align-content: space-between; padding: clamp(20px, 3vw, 32px); min-height: 280px; }
.ba__side--before { background: #dde3d3; color: #11150f; }
.ba__side--after { background: #11150f; color: #f4f7ef; }
.ba__label { font: 500 0.75rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
[lang="ar"] .ba__label { letter-spacing: 0; }
.ba__side img { margin: auto; }
.ba__side--before img { width: min(180px, 70%); border-radius: 50%; }
.ba__side--after img { width: min(320px, 90%); }
.ba__side small { font-size: 0.8125rem; opacity: 0.8; }
.ba__arrow {
  display: grid;
  place-items: center;
  width: 44px;
  background: var(--surface-2);
  color: var(--accent);
  font-family: var(--font-mono);
}
[dir="rtl"] .ba__arrow span { transform: scaleX(-1); display: inline-block; }

/* idea steps: strain → turn → loaded bowl */
.idea { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: idea; }
.idea li {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: grid;
  gap: 8px;
  align-content: start;
}
.idea li p { color: var(--muted); font-size: 0.9375rem; }

/* what changed */
.changes { display: grid; border-top: 1px solid var(--border); }
.changes li {
  display: grid;
  grid-template-columns: 9rem 11.5rem 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.changes strong { font-weight: 600; }
.changes span:last-child { color: var(--muted); font-size: 0.9375rem; }
.tag--red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* galleries */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.gallery--3 { grid-template-columns: repeat(3, 1fr); }
.shot { display: grid; gap: 10px; margin: 0; min-width: 0; }
.shot__open {
  display: block;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}
.shot__open img { width: 100%; height: auto; transition: transform 0.8s var(--ease-out); }
.shot__open:hover img { transform: scale(1.03); }
.shot__open.frame { cursor: zoom-in; }
.shot figcaption { font-size: 0.875rem; color: var(--muted); }
.shot figcaption b { color: var(--text); font-weight: 600; }
.shot--span { grid-column: 1 / -1; }

/* customer flow */
.flow {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 16px;
  counter-reset: flow;
}
.flow .shot { scroll-snap-align: start; }
.flow figcaption::before {
  counter-increment: flow;
  content: counter(flow, decimal-leading-zero) " · ";
  font-family: var(--font-mono);
  color: var(--accent);
}
.phones { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.phones .shot { flex: 1 1 150px; max-width: 220px; }
.phones .shot__open { border-radius: 24px; padding: 6px; background: #050816; border-color: #1a2550; }
.phones .shot__open img { border-radius: 18px; }

/* engineering */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  gap: 4px;
  align-content: start;
}
.stat__num { font: 800 clamp(1.75rem, 3.5vw, 2.5rem)/1.1 var(--font-display); letter-spacing: -0.03em; color: var(--text); }
.stat p { color: var(--muted); font-size: 0.875rem; }
.eng { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.eng li {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: grid;
  gap: 8px;
  align-content: start;
}
.eng li p { color: var(--muted); font-size: 0.9375rem; }
.stack { display: flex; flex-wrap: wrap; gap: 8px; }

/* timeline */
.timeline { display: grid; border-inline-start: 1px solid var(--border); }
.timeline li { position: relative; display: grid; gap: 4px; padding: 0 0 22px 24px; }
[dir="rtl"] .timeline li { padding: 0 24px 22px 0; }
.timeline li::before {
  content: "";
  position: absolute;
  inset-inline-start: -5px;
  top: 7px;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--accent);
  background: var(--bg);
  transform: rotate(45deg);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { background: var(--success); border-color: var(--success); }
.timeline .mono { font-size: 0.75rem; color: var(--accent); }
.timeline p { color: var(--muted); font-size: 0.9375rem; }

/* closing */
.cs-end { text-align: center; display: grid; gap: 20px; justify-items: center; }
.cs-end .hero__ctas { justify-content: center; }

/* ---------- lightbox ---------- */
.lightbox {
  width: min(1400px, 100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid #1a2550;
  border-radius: var(--radius-lg);
  background: #050816;
  color: #e6ecf5;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}
.lightbox::backdrop { background: rgba(5, 8, 22, 0.82); backdrop-filter: blur(6px); }
.lightbox img { width: 100%; height: auto; max-height: calc(100vh - 110px); object-fit: contain; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; font-size: 0.875rem; }
.lightbox__bar .icon-btn { background: #0a1230; border-color: #1a2550; color: #e6ecf5; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .gallery--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .work-card, .chapter__grid { grid-template-columns: 1fr; }
  .chapter__head { position: static; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .idea { grid-template-columns: 1fr; }
  .changes li { grid-template-columns: 1fr auto; }
  .changes span:last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .pains, .eng, .gallery, .gallery--3 { grid-template-columns: 1fr; }
  .ba { grid-template-columns: 1fr; }
  .ba__arrow { width: auto; height: 36px; }
  .ba__arrow span { transform: rotate(90deg); display: inline-block; }
  [dir="rtl"] .ba__arrow span { transform: rotate(90deg); }
  .ba__side { min-height: 220px; }
  .cs-cover .phone { width: 30%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 16px; }
  .work-card__media { padding-inline-end: 28px; }
  .phones .shot { flex: 1 1 40%; }
}
