/* Compact overview; detail content lives in native modal dialogs. */
.work-showcase { max-width: 1200px; margin-inline: auto; padding-block: 24px 32px; }
.work-intro h2 { margin-bottom: 8px; font-size: clamp(1.5rem, 3vw, 2rem); }
.work-intro p { margin-bottom: 24px; color: var(--ink-soft); max-width: 60ch; }
.work-group h3 { font-size: 1rem; line-height: 1.5; margin: 0 0 8px; }
.work-group + .work-group { margin-top: 24px; }
.project-grid { display: grid; list-style: none; padding: 0; margin: 0; gap: 12px; }
.product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.project-grid li { min-width: 0; }
.project-card { min-width: 0; height: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--card); transition: border-color 160ms ease; }
.project-card:hover, .project-card:focus-within { border-color: var(--blue); }
.project-open { width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 16px 4px; appearance: none; border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-align: start; cursor: pointer; }
.project-open img, .project-initials { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px; }
.project-initials { display: grid; place-items: center; background: var(--surface-soft); color: var(--ink-soft); font-weight: 700; }
.project-card-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.project-card-copy strong { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.project-card-copy > span { color: var(--ink-soft); font-size: .875rem; line-height: 1.5; }
.project-chevron { width: 16px; height: 16px; flex: 0 0 16px; stroke: var(--muted); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .project-chevron { transform: scaleX(-1); }
.project-card-meta { padding: 0 16px 4px 72px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 10px; min-height: 44px; font-size: .8125rem; color: var(--muted); }
html[dir="rtl"] .project-card-meta { padding-inline: 72px 16px; }
.project-card-meta bdi { white-space: normal; }
.project-store { min-height: 44px; }
.work-showcase a.work-destination { position: relative; z-index: 2; text-decoration: none; }
.project-availability { color: var(--muted); font-size: .875rem; }
.work-showcase :focus-visible, .project-dialog :focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
/* A product story: fixed identity and destination, one reading surface. */
.project-dialog {
  --story-tint: var(--surface-soft);
  --story-accent: var(--blue);
  width: min(960px, calc(100% - 48px)); max-width: none;
  max-height: 90vh; max-height: 90dvh; padding: 0; margin: auto;
  border: 0; border-radius: 20px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25); overflow: hidden;
}
.project-dialog[data-brand="nashra"] { --story-tint: #e6f1f4; --story-accent: #205c7a; }
.project-dialog[data-brand="rifqa"] { --story-tint: #edf3eb; --story-accent: #28634d; }
.project-dialog[data-brand="daftar"] { --story-tint: #f3eee2; --story-accent: #755623; }
:root[data-theme="dark"] .project-dialog[data-brand="nashra"] { --story-tint: #172e3b; --story-accent: #9acfe8; }
:root[data-theme="dark"] .project-dialog[data-brand="rifqa"] { --story-tint: #192e28; --story-accent: #9bd4b8; }
:root[data-theme="dark"] .project-dialog[data-brand="daftar"] { --story-tint: #302a20; --story-accent: #e3c68f; }
.project-dialog::backdrop { background: rgba(10, 18, 31, .66); }
.project-dialog[open] { animation: story-enter 180ms ease-out both; }
.project-dialog.is-closing { animation: story-exit 140ms ease-in both; pointer-events: none; }
.project-dialog-shell { display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh; min-height: 0; }
.project-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; flex: 0 0 auto; border-bottom: 1px solid var(--line); background: var(--surface); z-index: 2; }
.story-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.story-identity img, .story-monogram { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; object-fit: contain; }
.story-monogram { display: grid; place-items: center; font-weight: 700; background: var(--surface-soft); color: var(--ink); }
.project-dialog-header h2 { font-size: 1.125rem; line-height: 1.45; margin: 0; }
.project-close { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); cursor: pointer; }
.project-close svg, .story-store svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.project-close:hover { background: var(--surface-soft); }
.project-dialog-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 28px; scrollbar-gutter: stable; scrollbar-color: var(--muted) var(--surface); }
.project-dialog-content > * { min-width: 0; }
.project-dialog-value { max-width: 36ch; font-size: clamp(1.35rem, 2.3vw, 1.8rem); font-weight: 700; line-height: 1.4; margin: 0 0 12px; text-wrap: balance; }
.project-platforms { font-size: .8125rem; color: var(--muted); margin: 0 0 24px; }
.story-intro { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.story-intro > * { min-width: 0; }
.project-figure { margin: 0; }
.project-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--story-tint); }
.project-poster, .project-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
.project-media video { background: #0c111d; }
.project-dialog [hidden] { display: none !important; }
.project-play { position: absolute; inset-inline-start: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; white-space: nowrap; background: #101828; color: #fff; border: 1px solid #667085; border-radius: 10px; font-size: .875rem; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
html[dir="rtl"] .project-play { transform: translateX(50%); }
.project-play:hover { background: #344054; }
.project-play svg { width: 18px; height: 18px; fill: currentColor; }
.project-figure figcaption { margin-top: 10px; font-size: .8125rem; line-height: 1.6; color: var(--muted); }
.story-video-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .8125rem; color: var(--story-accent); text-underline-offset: 4px; }
.project-video-status { font-size: .875rem; color: var(--ink-soft); line-height: 1.6; margin: 8px 0; }
.project-video-status:empty { display: none; }
.project-placeholder { padding: 20px; color: var(--ink); line-height: 1.6; }
.story-contribution h3 { font-size: .875rem; color: var(--story-accent); margin: 0 0 6px; line-height: 1.5; }
.story-contribution p { font-size: .9375rem; line-height: 1.7; color: var(--ink-soft); margin: 0 0 20px; }
.project-steps { margin: 0; padding-inline-start: 20px; color: var(--ink-soft); font-size: .875rem; line-height: 1.7; }
.project-steps li + li { margin-top: 8px; }
.story-company-mark { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 28px; gap: 20px; min-height: 220px; border-radius: 12px; background: var(--story-tint); text-align: center; }
.story-company-mark img, .story-company-mark .story-monogram { width: 76px; height: 76px; flex-basis: 76px; border-radius: 16px; object-fit: contain; }
.story-company-mark p { font-size: .875rem; line-height: 1.7; margin: 0; color: var(--ink-soft); }
.story-engineering { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.story-engineering > h3, .story-section-heading h3 { font-size: 1.125rem; margin: 0; line-height: 1.5; }
.story-decisions { list-style: none; padding: 0; margin: 20px 0 0; }
.story-decisions > li { display: flex; align-items: baseline; gap: 16px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.story-decisions > li:first-child { padding-top: 0; }
.story-number { flex: 0 0 26px; font-size: .8125rem; color: var(--story-accent); font-variant-numeric: tabular-nums; }
.story-decisions h4 { margin: 0 0 6px; font-size: 1rem; font-weight: 700; line-height: 1.5; }
.story-decisions p { margin: 0; color: var(--ink-soft); font-size: .9375rem; line-height: 1.75; max-width: 70ch; }
.project-dialog details { margin-top: 16px; }
.project-dialog summary { cursor: pointer; padding-block: 12px; min-height: 44px; color: var(--story-accent); font-size: .9375rem; font-weight: 600; }
.project-detail-body { padding: 4px 0 12px; color: var(--ink-soft); font-size: .9375rem; line-height: 1.75; }
.project-detail-body p { margin: 0; }
.story-gallery { margin-top: 32px; min-width: 0; }
.story-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.story-gallery-controls { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8125rem; }
.story-gallery-controls button { min-width: 44px; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
.story-gallery-controls button:disabled { opacity: .45; cursor: default; }
.story-screens { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: 4px 4px 16px; scrollbar-color: var(--muted) var(--surface); }
.story-shot { flex: 0 0 240px; min-width: 0; margin: 0; scroll-snap-align: start; }
.story-shot img { display: block; width: 100%; height: auto; aspect-ratio: 9/16; object-fit: contain; border-radius: 12px; background: var(--story-tint); }
.story-shot figcaption { font-size: .875rem; line-height: 1.6; color: var(--ink-soft); margin-top: 12px; }
.story-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.story-footer > span:first-child { font-size: .8125rem; color: var(--muted); }
.story-store { min-height: 48px; display: inline-flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 24px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: .9375rem; font-weight: 700; text-decoration: none; }
.story-store:hover { background: var(--ink-soft); color: var(--surface); text-decoration: none; }
.story-availability { display: flex; align-items: center; min-height: 48px; font-size: .875rem; color: var(--ink-soft); }
.project-dialog ::selection { background: var(--story-accent); color: var(--surface); }
@keyframes story-enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes story-exit { to { opacity: 0; transform: translateY(16px); } }
@media (max-width: 959px) { .product-grid { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .story-intro { grid-template-columns: 1fr; gap: 24px; }
  .story-company-mark { flex-direction: row; justify-content: flex-start; min-height: 0; padding: 20px; text-align: start; }
  .story-company-mark img, .story-company-mark .story-monogram { width: 56px; height: 56px; flex-basis: 56px; }
}
@media (max-width: 640px) {
  .work-showcase { padding-block: 16px 24px; }
  .work-intro p { font-size: .9375rem; margin-bottom: 20px; }
  .project-grid { grid-template-columns: 1fr; gap: 16px; }
  .project-card { height: auto; padding: 14px; border-radius: 8px; }
  .project-open { padding: 0; gap: 14px; align-items: flex-start; }
  .project-open img, .project-initials { width: 64px; height: 64px; flex-basis: 64px; border-radius: 14px; }
  .project-card-meta, html[dir="rtl"] .project-card-meta { padding: 0; padding-inline-start: 78px; min-height: 40px; }
  .project-dialog { width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .project-dialog-shell { max-height: 92vh; max-height: 92dvh; }
  .project-dialog-header { padding: 12px 20px; }
  .project-dialog-content { padding: 20px; scrollbar-gutter: auto; }
  .project-dialog-value { font-size: 1.375rem; }
  .story-footer { padding-inline: 20px; }
  .story-footer > span:first-child { display: none; }
  .story-store, .story-availability { width: 100%; justify-content: center; }
  .story-gallery-controls button { display: none; }
  .story-decisions > li { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .project-card, .project-dialog[open], .project-dialog.is-closing { animation: none; transition: none; }
}

/* Team cards keep the original card look; the title button's overlay makes the whole card open its sheet. */
.work-showcase .featured-work { align-items: start; }
.work-showcase .work-item, .work-showcase .work-item-content { min-height: 0; }
.work-showcase .tag-list { margin-top: 0; }
@media (min-width: 1181px) {
  .work-showcase .featured-work { align-items: stretch; }
  .work-showcase .work-item-content { align-self: stretch; }
  .work-showcase .tag-list { margin-top: auto; }
}
.work-open { all: unset; cursor: pointer; }
.work-open::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.work-item:has(.work-open):hover { background: var(--surface-blue); border-color: var(--blue); transform: translateY(-3px); }
.work-showcase .work-open:focus-visible { outline: none; }
.work-item:has(.work-open:focus-visible) { outline: 3px solid var(--blue); outline-offset: 4px; transform: translateY(-3px); }

.story-gallery-controls output { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* The same real app content in platform-specific presentation frames. */
.nashra-stage {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) 86px minmax(0, 1fr);
  align-items: center; gap: 12px; padding: 24px 3px;
  max-width: 530px; margin-inline: auto; isolation: isolate;
}
.nashra-stage::before { content: ''; position: absolute; inset-inline: 18%; top: calc(50% + 16px); border-top: 1px dashed var(--blue); z-index: -1; }
.nashra-device { min-width: 0; width: 100%; max-width: 210px; margin: 0; justify-self: center; }
.nashra-device .device-label { display: flex; justify-content: center; align-items: center; direction: ltr; height: 22px; gap: 7px; margin-bottom: 14px; font-size: .8125rem; line-height: 1; }
.nashra-device .device-label .icon { width: 17px; height: 17px; flex: 0 0 17px; }
.nashra-phone {
  --frame-radius: 27px; --bezel: 5px;
  position: relative; width: 100%; padding: var(--bezel);
  background: #15191f; border-radius: var(--frame-radius);
  box-shadow: 0 16px 30px rgba(16, 24, 40, .2);
  container-type: inline-size;
}
.nashra-phone--ios { --frame-radius: 34px; background: #191c20; }
.nashra-phone::after { content: ''; position: absolute; inset: 1px; border: 1px solid #68717a; border-radius: calc(var(--frame-radius) - 1px); pointer-events: none; }
.nashra-display { position: relative; overflow: hidden; border-radius: calc(var(--frame-radius) - var(--bezel)); background: #c0dde9; }
.nashra-display img { display: block; width: 100%; height: auto; }
.nashra-app-content { position: relative; aspect-ratio: 2160 / 4512; }
.nashra-app-content img { height: 100%; }
/* The EN capture exposes the top of a clipped card at source y=4211–4254.
   Mask only that sliver; retain the complete app navigation and its labels. */
html[lang="en"] .nashra-app-content::after { content: ''; position: absolute; inset-inline: 0; top: 90%; height: 1.14%; background: #dce5ee; pointer-events: none; }
.nashra-status { position: relative; aspect-ratio: 6 / 1; direction: ltr; color: #17252e; background: #c0dde9; }
.nashra-system-status { display: block; width: 100%; height: 100%; }
.nashra-camera { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 5%; aspect-ratio: 1; border-radius: 50%; background: #080b10; box-shadow: inset 0 0 0 1px #36404b; }
.nashra-phone--ios .nashra-camera { width: 30%; height: 43%; aspect-ratio: auto; border-radius: 999px; box-shadow: none; }
.nashra-phone--ios .nashra-camera::after { content: ''; position: absolute; width: 8%; aspect-ratio: 1; top: 50%; right: 10%; transform: translateY(-50%); border-radius: 50%; background: #182333; }
.nashra-gesture { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 1; background: #f9fcfd; }
.nashra-gesture span { width: 27%; height: 2px; border-radius: 99px; background: #465057; }
.nashra-phone--ios .nashra-gesture span { width: 36%; height: 3px; background: #182027; }
.nashra-phone::before, .nashra-side-button { content: ''; position: absolute; right: -2px; top: 29%; width: 2px; height: 12%; border-radius: 0 2px 2px 0; background: #626b75; }
.nashra-phone--android::before { top: 35%; height: 7%; }
.nashra-phone--android .nashra-side-button { top: 20%; height: 11%; }
.nashra-phone--ios .nashra-side-button { left: -2px; right: auto; top: 26%; height: 7%; border-radius: 2px 0 0 2px; }
.nashra-phone--ios .nashra-side-button::before, .nashra-phone--ios .nashra-side-button::after { content: ''; position: absolute; left: 0; width: 2px; height: 100%; border-radius: inherit; background: inherit; }
.nashra-phone--ios .nashra-side-button::before { top: 135%; }
.nashra-phone--ios .nashra-side-button::after { top: -130%; height: 50%; }
:root[data-theme="dark"] .nashra-phone { box-shadow: 0 18px 38px rgba(0, 0, 0, .42); }
:root[data-theme="dark"] .nashra-phone::after { border-color: #8b939d; }
.nashra-core { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px 5px; margin-top: 36px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: center; }
.nashra-core svg { color: var(--blue); }
.nashra-core strong { font-size: .75rem; line-height: 1.5; }
.nashra-core > span { font-size: .625rem; line-height: 1.6; color: var(--ink-soft); }
.nashra-hero-caption { text-align: center; margin-top: 4px; }
.nashra-hero-caption strong { font-size: .9375rem; }
.nashra-hero-caption p { font-size: .75rem; line-height: 1.7; color: var(--muted); margin: 8px auto 0; max-width: 46ch; }
.nashra-story-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px; background: transparent; color: var(--blue); border: 0; cursor: pointer; font-size: .875rem; font-weight: 600; }
.nashra-story-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.nashra-story-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
@media (min-width: 1024px) {
  /* Only the copy contributes to the row height. Its normal block flow,
     including the original stats margin, is intentionally untouched. */
  .hero { min-height: 0; align-items: stretch; padding-block: 28px 24px; }
  .hero + .section-work .work-showcase { padding-top: 8px; }
  .hero > .product-visual { contain: size; display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
  .hero .nashra-stage { width: 100%; flex: 1 1 0; min-height: 0; container-type: size; grid-template-rows: minmax(0, 1fr); padding-block: 0; }
  /* 2.318056 = app crop (4512/2160) + status (1/6) + gesture (1/16).
     Subtract the 30px label and 6px bezel before solving for screen width. */
  .hero .nashra-device { container-type: inline-size; max-width: min(210px, calc((100cqh - 36px) / 2.318056 + 6px)); }
  .hero .nashra-device .device-label { margin-bottom: 8px; }
  .hero .nashra-phone { --bezel: 3px; --frame-radius: clamp(14px, 13.5cqw, 27px); }
  .hero .nashra-phone--ios { --frame-radius: clamp(18px, 17cqw, 34px); }
  .hero .nashra-core { margin-top: 30px; }
  .hero .nashra-stage::before { top: calc(50% + 15px); }
  .hero .nashra-hero-caption { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; margin: 0; }
  .hero .nashra-hero-caption p { margin-block-start: 4px; }
  .hero .nashra-story-link { align-items: flex-end; padding-block-end: 0; }
}
@media (min-width: 1024px) and (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; }
}
@media (min-width: 1181px) {
  /* EN reference: two title lines, three lede lines and two caption lines.
     Match its fluid title/stats metrics without stretching the English hero.
     Recheck this budget if the English hero copy or typography changes. */
  html[lang="ar"] .nashra-stage {
    --reference-phone-width: calc((134.05px + clamp(37px, 2.93vw, 45px) * 2.36 + clamp(14px, 1.05vw, 16px) + clamp(8.5px, .62vw, 9.5px) * 1.3) / 2.318056 + 6px);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  html[lang="ar"] .nashra-stage > * { grid-row: 2; }
  html[lang="ar"] .hero .nashra-device { max-width: var(--reference-phone-width); }
  html[lang="ar"] .nashra-stage::before { top: auto; bottom: calc((var(--reference-phone-width) - 6px) * 2.318056 / 2 + 3px); }
}
@media (max-width: 640px) {
  .nashra-stage { grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr); gap: 8px; padding-block: 18px; }
  .nashra-phone { --bezel: 3px; --frame-radius: 20px; }
  .nashra-phone--ios { --frame-radius: 25px; }
  .nashra-device .device-label { font-size: .75rem; gap: 5px; margin-bottom: 10px; }
  .nashra-device .device-label .icon { width: 15px; height: 15px; flex-basis: 15px; }
  .nashra-core { gap: 8px; padding: 12px 3px; margin-top: 32px; border-radius: 10px; }
  .nashra-core strong { font-size: .625rem; }
  .nashra-core > span { font-size: .5625rem; }
  .nashra-core svg { width: 22px; height: 22px; }
  .nashra-phone--ios .nashra-gesture span { height: 2px; }
}

/* Outer frame around the whole work section, as in the previous design. */
.work-showcase { max-width: none; padding: 20px 34px 22px; border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 640px) { .work-showcase { padding: 16px; } }
