/* ==========================================================================
   Work — /work
   Paper artboard "12 Work" (174-0). Everything shared comes from site.css;
   this file holds only what is particular to this page. Tokens only, logical
   properties only, every rule under .page-work.
   ========================================================================== */

/* ---- 01 Hero (1F7-0) ---- */

/* Paper: 40px above the breadcrumbs, then 72 / 72 / 88 down to the brand rule. */
.page-work .work-hero { padding-block-start: calc(var(--header-offset) + var(--space-10)); }

.page-work .work-hero .hero__copy {
  --hero-top: clamp(2.5rem, 5vw, 4.5rem);          /* 72 */
  --hero-gap: clamp(2.5rem, 5vw, 4.5rem);          /* 72 */
  --hero-bottom: clamp(3rem, 6.1111vw, 5.5rem);    /* 88 */
}

.page-work .work-hero__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);             /* 36 */
}

/* The oversized display line: 152 / 139 at 1440. The size is a share of the viewport, so the longer line
   ("Distinct experiences.", about 8.3em) keeps to one line of the container at every width down to 360px. */
.page-work .work-hero__title {
  font-size: clamp(2.25rem, 10.5556vw, 9.5rem);
  line-height: calc(139 / 152);
}

/* Arabic needs its own, taller line (the token), not Paper's Latin leading. */
.page-work:lang(ar) .work-hero__title { line-height: var(--lh-display); }

.page-work .work-hero__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* The three facts sit in the start columns, on the last line of the text beside them. In the source they
   follow the text, which is the reading order once the row stacks. */
.page-work .work-hero__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  grid-row: 1;
  grid-column: 1 / span 5;
}

.page-work .work-hero__facts li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  white-space: nowrap;
}

.page-work .work-hero__facts li + li::before {
  content: "";
  flex: none;
  inline-size: 4px;
  block-size: 4px;
  background-color: var(--c-muted);
}

/* Paper starts this page's brand rule 40px in from the content edge (120px from the page edge). */
.page-work .work-hero .rule--brand { --brand-rule-inset: var(--space-10); }

/* ---- 02 Featured project (1GR-0) ---- */

/* 96 above, 136 below. Emerald glow low on the end side over the soft fan of the waveform, which leaves
   through the lower right corner: 700px wide, 160px past the right edge, 239px past the bottom edge
   (Paper: "900px 835px" in a 1440 × 1204 frame; the file is 948 × 823). Physical sides on purpose:
   the waveform artwork is not mirrored. */
.page-work .work-feature {
  padding-block: clamp(3.5rem, 6.6667vw, 6rem) clamp(4.5rem, 9.4444vw, 8.5rem);
  background-image:
    radial-gradient(50% 34% at 88% 80%, color-mix(in srgb, var(--color-emerald) 9%, transparent) 0%, transparent 70%),
    url("/assets/images/brand/waveform-fan-soft.webp");
  background-size: 100% 100%, 700px auto;
  background-position: 50% 50%, right -160px bottom -239px;
  background-repeat: no-repeat;
}

/* Arabic: the layout mirrors, so the project name sits where the fan is. The glow mirrors; the wave becomes
   the crest cut, which enters from the left edge, in the lower left corner under the phone. Neither file is flipped. */
.page-work:lang(ar) .work-feature {
  background-image:
    radial-gradient(50% 34% at 12% 80%, color-mix(in srgb, var(--color-emerald) 9%, transparent) 0%, transparent 70%),
    url("/assets/images/brand/waveform-crest-soft.webp");
  background-size: 100% 100%, 620px auto;
  background-position: 50% 50%, left -70px bottom -330px;
}

/* A block-level label: as an inline box it would sit in a taller text line and push the frame down. */
.page-work .work-feature .eyebrow { display: flex; }

.page-work .work-feature__card {
  display: block;
  margin-block-start: var(--space-12);             /* 48 under the label */
}

.page-work .work-feature__visual { position: relative; }

/* The phone stands on the photograph and hangs below it: 264 × 528 at left 960, top 330 of the 1280 × 720 frame. */
.page-work .work-feature__phone {
  position: absolute;
  inset-block-start: 45.83%;
  inset-inline-start: 75%;
  inline-size: 20.625%;
  max-inline-size: none;
}

/* Arabic: the phone moves to the other side, 32px from the edge, so it covers the laptop's bezel
   and not the first letters of its headline. */
.page-work:lang(ar) .work-feature__phone { inset-inline-start: 76.875%; }

.page-work .work-feature__body {
  align-items: start;
  margin-block-start: var(--space-14);             /* 56 */
}

.page-work .work-feature__name {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.page-work .work-feature__text {
  display: flex;
  flex-direction: column;
  max-inline-size: 31.3125rem;                     /* 501 */
  padding-block-start: 0.625rem;
}

.page-work .work-feature__text .project-card__actions { padding-block-start: var(--space-6); }

/* ---- 03 Portfolio filters (1HE-0) ---- */

.page-work .work-filters {
  padding-block: var(--space-14);                  /* 56 */
  border-block: 1px solid var(--c-rule);
  background-color: var(--color-surface);
}

.page-work .work-filters__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--grid-gap);
}

.page-work .work-filters__count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-ink);
  white-space: nowrap;
}

/* The visible count. portfolio-filter.js writes data-filter-active on the group whenever a filter is applied:
   on a press, and at once on a linked or reloaded filtered view (where it writes its status line for screen
   readers as well). The number follows that attribute: every project, the three of one service, the one of an
   industry. The unfiltered page carries no attribute, writes no status and shows every project. */
.page-work .work-count { display: none; }

.page-work .work-portfolio:not([data-filter-active]) .work-count--all,
.page-work .work-portfolio[data-filter-active="all"] .work-count--all,
.page-work .work-portfolio:is([data-filter-active="design"], [data-filter-active="redesign"]) .work-count--service,
.page-work .work-portfolio[data-filter-active]:not([data-filter-active="all"], [data-filter-active="design"], [data-filter-active="redesign"]) .work-count--industry { display: inline; }

.page-work .work-filters__rows { margin-block-start: var(--space-10); }   /* 40 */

.page-work .work-filters__row {
  display: flex;
  align-items: center;
  gap: var(--grid-gap);
  padding-block: var(--space-5);
  border-block-start: 1px solid var(--c-rule);
}

.page-work .work-filters__row:last-child { padding-block-end: 0; }

.page-work .work-filters__label {
  flex: none;
  inline-size: 8rem;                               /* 128 */
}

.page-work .filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-inline-size: 0;
}

/* 40px drawn, as in Paper; the pseudo-element makes the touch target 44px. */
.page-work .filter__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-block-size: 2.5rem;
  padding-inline: var(--space-4);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;                             /* 14: no token between caption and small */
  font-weight: var(--weight-medium);
  line-height: calc(20 / 14);
  letter-spacing: var(--tracking-normal);
  color: var(--c-ink);
  white-space: nowrap;
}

.page-work:lang(ar) .filter__button {
  font-size: 0.9375rem;
  line-height: var(--lh-ui);
}

.page-work .filter__button::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}

.page-work .filter__button[aria-pressed="true"] {
  border-color: var(--c-ink);
  background-color: var(--c-ink);
  color: var(--c-on-ink);
}

@media (hover: hover) {
  .page-work .filter__button[aria-pressed="false"]:hover { border-color: var(--c-ink); }
}

/* Without JavaScript the buttons would do nothing: every project is simply listed. */
.no-js .page-work .work-filters__rows { display: none; }

/* ---- 04 Project gallery (1OW-0) ---- */

.page-work .work-gallery {
  padding-block: clamp(4rem, 7.7778vw, 7rem) var(--section-pad);   /* 112 / 160 */
  background-color: var(--color-background);
}

/* Three rows: 4 + 8, 7 + 5, 6 + 6 columns, 120px apart. One card of each row starts lower. */
.page-work .work-gallery__grid {
  align-items: start;
  row-gap: clamp(3.5rem, 8.3333vw, 7.5rem);
}

.page-work .work-gallery__item--sora { padding-block-start: min(11.6667vw, 10.5rem); }       /* 168 */
.page-work .work-gallery__item--alrasikh { padding-block-start: min(8.5417vw, 7.6875rem); }  /* 123 */
.page-work .work-gallery__item--riyadh { padding-block-start: min(6.6667vw, 6rem); }         /* 96 */

/* A filtered view is a plain list: the offsets belong to the full composition only. */
.page-work .work-portfolio[data-filter-active]:not([data-filter-active="all"]) .work-gallery__item { padding-block-start: 0; }

/* Name, sector · service (ink here), description, actions: 8px apart, 16 more above the actions. */
.page-work .work-gallery .project-card__body { gap: var(--space-2); }
.page-work .work-gallery .project-card__meta { color: var(--c-ink); }
.page-work .work-gallery .project-card__actions { padding-block-start: var(--space-4); }

.page-work .work-gallery__text { max-inline-size: 31.25rem; }                                /* 500 */
.page-work .work-gallery__item--sora .work-gallery__text { max-inline-size: 25rem; }         /* 400 */
.page-work .work-gallery__item--alnamaa .work-gallery__text { max-inline-size: 33.75rem; }   /* 540 */
.page-work .work-gallery__item--alrasikh .work-gallery__text { max-inline-size: 30rem; }     /* 480 */

/* ---- 05 Before / after showcase (2B7-0) ---- */

/* Header: label (3 columns), title and intro (7), the instruction at the end on the title's first line. */
.page-work .work-compare__header .section-header__title { grid-column: 4 / span 7; }

.page-work .work-compare__intro {
  grid-column: 4 / span 7;
  max-inline-size: 32.4375rem;                     /* 519 */
  margin-block-start: var(--space-6);
}

/* "Drag to compare" is the shared hint line (interactive.css; data-ba-hint shows it once a slider works).
   Here it is placed in the header grid: the last two columns, centred on the title's first line. */
.page-work .work-compare__hint {
  grid-row: 1;
  grid-column: 11 / -1;
  justify-self: end;
  min-block-size: calc(var(--fs-h2) * var(--lh-h2));
  white-space: nowrap;
}

/* Large comparison: details beside it, spread over its height. */
.page-work .work-compare__details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding-block: var(--space-1);
}

.page-work .work-compare__title {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.page-work .work-compare__kicker { color: var(--c-marker); }

.page-work .work-compare__point {
  display: flex;
  gap: var(--space-4);
  padding-block: 0.875rem;
  border-block-start: 1px solid var(--c-rule);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  letter-spacing: var(--tracking-normal);
}

.page-work .work-compare__point:last-child { border-block-end: 1px solid var(--c-rule); }

.page-work .work-compare__point dt {
  flex: none;
  inline-size: 6.875rem;                           /* 110 */
  color: var(--c-text);
}

.page-work .work-compare__point dd { color: var(--c-muted); }

/* Compact comparisons and the service link: three columns, 88px under the large one. */
.page-work .work-compare__compact { margin-block-start: var(--section-gap); }

.page-work .work-compare__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* The two small comparisons are the shared slider's compact size. Paper draws them on this page a little
   differently from the component: the 25px media radius, a 36px handle with the standard handle shadow, and
   tags 14px from the corners. These are the slider's own properties; no part of it is restyled. */
.page-work .work-compare__item .before-after {
  --ba-radius: var(--radius-lg);
  --ba-handle: 2.25rem;
  --ba-handle-shadow: 0 8px 24px rgb(3 9 15 / 0.45);
  --ba-tag-inset: 0.875rem;
}

.page-work .work-compare__caption {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.page-work .work-compare__caption .small { max-inline-size: 23.75rem; }   /* 380 */

/* The case-study links stand alone here (no card link behind them): a 44px touch target on the 20px row. */
.page-work .work-compare .project-actions .link { position: relative; }

.page-work .work-compare .project-actions .link::after {
  content: "";
  position: absolute;
  inset: -0.75rem -0.5rem;
}
.page-work .work-compare__caption .project-actions { padding-block-start: var(--space-4); }

.page-work .work-compare__service {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding-block-start: var(--space-7);
  border-block-start: 1px solid var(--c-rule);
}

.page-work .work-compare__service .h4 { max-inline-size: 23.75rem; }      /* 380 */

/* ---- 06 Industry navigation (36L-0) ---- */

.page-work .work-sectors__list { border-block-end: 1px solid var(--c-rule); }

.page-work .work-sectors__row {
  display: flex;
  align-items: center;
  gap: var(--grid-gap);
  padding-block: 1.875rem;                         /* 30 */
  border-block-start: 1px solid var(--c-rule);
}

.page-work .work-sectors__num {
  flex: none;
  inline-size: 5.25rem;                            /* 84 */
  font-size: var(--fs-label);
  font-weight: var(--weight-light);
  line-height: var(--lh-label);
  letter-spacing: var(--tracking-normal);
  color: var(--c-muted);
}

/* 52 / 60 at 1440: between H2 and H3, so it has no token. */
.page-work .work-sectors__list {
  --sector-fs: clamp(1.75rem, 1.25rem + 2.2222vw, 3.25rem);
  --sector-lh: calc(60 / 52);
}

.page-work:lang(ar) .work-sectors__list { --sector-lh: var(--lh-h3); }

.page-work .work-sectors__name {
  flex: 1 1 auto;
  min-inline-size: 0;
  font-size: var(--sector-fs);
  line-height: var(--sector-lh);
  letter-spacing: var(--tracking-tight);
  color: var(--c-heading);
}

.page-work .work-sectors__count {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-1);
  inline-size: 13.75rem;                           /* 220 */
}

.page-work .work-sectors__arrow {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-sm);
  color: var(--c-ink);
  transition:
    background-color var(--dur-base) var(--ease-standard),
    border-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard);
}

.page-work .work-sectors__arrow .icon { transition: translate var(--dur-base) var(--ease-out); }

@media (hover: hover) {
  .page-work .work-sectors__row:hover .work-sectors__arrow {
    border-color: var(--c-ink);
    background-color: var(--c-ink);
    color: var(--c-on-ink);
  }

  .page-work .work-sectors__row:hover .work-sectors__arrow .icon { translate: calc(2px * var(--dir)) 0; }
}

.page-work .work-sectors__row:focus-visible { outline-offset: -2px; }

/* ---- Arabic: a Latin project name inside an Arabic heading keeps Paper's tracking ---- */
.page-work :is(h2, h3) span[lang="en"] { letter-spacing: var(--tracking-tight); }

/* ---- 07 Final CTA (3DO-0) ---- */
.page-work .cta-closing__statement { max-inline-size: 68.75rem; }          /* 1100 */

/* ---- Tablet ---- */
@media (max-width: 1024px) {
  /* Hero: the text at a readable measure, then the facts under it */
  .page-work .work-hero__intro { max-inline-size: 39.25rem; }

  .page-work .work-hero__facts {
    grid-row: auto;
    grid-column: 1 / -1;
  }

  /* Featured project: name, then text, both clear of the phone that hangs at the end side */
  .page-work .work-feature { background-size: 100% 100%, 520px auto; background-position: 50% 50%, right -119px bottom -177px; }
  .page-work:lang(ar) .work-feature { background-size: 100% 100%, 480px auto; background-position: 50% 50%, left -55px bottom -255px; }
  .page-work .work-feature__body { --grid-row-gap: var(--space-5); margin-block-start: var(--space-10); }
  .page-work .work-feature__name,
  .page-work .work-feature__text { max-inline-size: 70%; }
  .page-work .work-feature__text { padding-block-start: 0; }

  /* Filters: the buttons may wrap, so each label sits on the first line of its buttons */
  .page-work .work-filters { padding-block: var(--space-12); }
  .page-work .work-filters__row { align-items: flex-start; }
  .page-work .work-filters__label { padding-block-start: var(--space-3); }

  /* Gallery: the same three rows, closer together */
  .page-work .work-gallery__grid { row-gap: var(--space-18); }

  /* Before / after: the instruction goes under the intro; details under the large comparison */
  .page-work .work-compare__header .section-header__title,
  .page-work .work-compare__intro,
  .page-work .work-compare__hint { grid-column: 1 / -1; }

  .page-work .work-compare__intro { margin-block-start: 0; }

  .page-work .work-compare__hint {
    grid-row: auto;
    justify-self: start;
    min-block-size: 0;
  }

  .page-work .work-compare__details { padding-block: 0; }

  .page-work .work-compare__service { gap: var(--space-8); }

  /* Sectors: the project note narrows */
  .page-work .work-sectors__num { inline-size: 3rem; }
  .page-work .work-sectors__count { inline-size: 11rem; }
}

/* ---- Phone ---- */
@media (max-width: 768px) {
  .page-work .work-hero__title { line-height: 0.96; }
  .page-work:lang(ar) .work-hero__title { line-height: var(--lh-display); }
  .page-work .work-hero .rule--brand { --brand-rule-inset: var(--space-5); }

  /* Featured project: a larger phone; the name sits beside its overhang, the text runs full width under it */
  .page-work .work-feature { background-size: 100% 100%, 360px auto; background-position: 50% 50%, right -110px bottom -150px; }
  .page-work:lang(ar) .work-feature { background-size: 100% 100%, 340px auto; background-position: 50% 50%, left -50px bottom -190px; }
  .page-work .work-feature__card { margin-block-start: var(--space-8); }

  .page-work .work-feature__phone {
    inset-block-start: 30%;
    inset-inline-start: 70%;
    inline-size: 26%;
  }

  /* Arabic: nearer the edge, clear of the first letters of the laptop's headline */
  .page-work:lang(ar) .work-feature__phone { inset-inline-start: 76%; }

  .page-work .work-feature__body { margin-block-start: var(--space-6); }
  .page-work .work-feature__name { gap: var(--space-3); max-inline-size: 64%; }
  .page-work .work-feature__text { max-inline-size: none; }

  /* Filters: each label sits above its buttons, which wrap */
  .page-work .work-filters { padding-block: var(--space-10); }
  .page-work .work-filters__rows { margin-block-start: var(--space-8); }

  .page-work .work-filters__row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .page-work .work-filters__label { inline-size: auto; padding-block-start: 0; }
  .page-work .filter__button { min-block-size: 2.75rem; }
  .page-work .filter__button::after { content: none; }

  /* Gallery: two projects per row, no offsets */
  .page-work .work-gallery__grid { row-gap: var(--space-14); }
  .page-work .work-gallery__item { padding-block-start: 0; }

  /* Before / after */
  .page-work .work-compare__point dt { inline-size: 6rem; }

  /* Sectors: number, name and arrow on one line; the project under the name */
  .page-work .work-sectors__row {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-4);
    row-gap: var(--space-2);
    padding-block: var(--space-6);
  }

  /* the numeral sits on the first line of the name */
  .page-work .work-sectors__num {
    align-self: start;
    inline-size: auto;
    line-height: calc(var(--sector-fs) * var(--sector-lh));
  }

  .page-work .work-sectors__count {
    grid-row: 2;
    grid-column: 2;
    inline-size: auto;
  }

  .page-work .work-sectors__arrow {
    grid-row: 1 / span 2;
    grid-column: 3;
  }
}

@media (max-width: 480px) {
  .page-work .work-hero__facts { column-gap: var(--space-3); }
  .page-work .work-hero__facts li { gap: var(--space-3); }

  /* One project and one comparison per row */
  .page-work .work-gallery__item,
  .page-work .work-compare__item { grid-column: 1 / -1; }
}
