/* Services Hub rail. One continuous horizontal row of the five service cards on the six Services
   Hub pages, loaded only there, after core.css. AI Search Authority, Brand Strategy and Identity,
   Customer Experience Design, Online Digital Presence and Brand Operational Standards keep that
   logical order in the DOM in every language; Arabic lays the row out from the right through the
   page's own direction, with no reversed flex direction.

   This file holds layout only. Every glass card rule in core.css (`.page-services .svc-hub-section
   ...`) still styles the cards, so their glass, typography, tags, call to action and hover stay as
   they are. The row is a native horizontal scroller here, which is the whole experience without
   JS, with reduced motion and on screens too short to pin. svc-rail.js adds the pinned, scroll
   controlled sequence on top by setting `svc-rail--pinned` (DBSP, Services Hub rail). */

.page-services .svc-hub-section.svc-rail {
  /* --svc-rail-vw is the section's own width, set by svc-rail.js, so a desktop scrollbar never
     shifts the row. Start and end spacing match the Introduction's content edge. About 1.1 cards
     show on a phone, 1.6 on a tablet or a phone on its side and 2.2 on a landscape screen, so the
     next card is always in view. */
  --svc-rail-vw: 100vw;
  --svc-rail-pad: max(var(--gutter, 1rem), (var(--svc-rail-vw) - var(--max-w, 80rem)) / 2);
  --svc-rail-gap: clamp(1rem, var(--svc-rail-vw) * 0.025, 2.5rem);
  --svc-rail-k: 1.12;
  --svc-rail-card: max(15rem, (var(--svc-rail-vw) - 2 * var(--svc-rail-pad) - (var(--svc-rail-k) - 1) * var(--svc-rail-gap)) / var(--svc-rail-k));
  /* Start and end inset that lets card 1 and card 5 centre like every other card, so each of the
     five cards has its own centred landing (Hamad, 19 November 2026). */
  --svc-rail-inset: max(0px, (var(--svc-rail-vw) - var(--svc-rail-card)) / 2);
  /* The desktop card height of the former paired sections, held to the screen's own height. */
  --svc-rail-h: min(clamp(460px, 100svh - 2 * clamp(76px, 14vh, 150px) - 2vw, 780px), 100svh - var(--header-h, 3.5rem) - 2rem);
  display: block;
  position: relative;
  z-index: 1;
  height: auto;
  min-height: 100svh;
  margin: 0;
  padding: calc(var(--header-h, 3.5rem) + 1rem) 0 clamp(2.5rem, 6vh, 4.5rem);
  overflow: visible;
  box-sizing: border-box;
}
@media (min-width: 600px) {
  .page-services .svc-hub-section.svc-rail { --svc-rail-k: 1.6; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .page-services .svc-hub-section.svc-rail { --svc-rail-k: 2.2; }
}

/* The shared hub video keeps its own core.css treatment, one backdrop behind the rail and the FAQ
   that the moving track never carries; svc-rail.js holds it still while the row is pinned. The
   wrapper clips with `clip`, which keeps the held video inside it and, unlike the phone rule's
   `overflow-x: hidden`, makes no scroll container, so the frame still pins. */
.page-services .svc-hub-wrap.svc-hub-wrap--rail {
  overflow: clip;
}

/* Native horizontal scroller, the foundation. */
.svc-rail__viewport {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--c-accent, #a8894c) 55%, transparent) transparent;
  /* Room for the hover lift and glow above and below the cards. */
  padding-block: 1.25rem;
}
.svc-rail__track {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--svc-rail-gap);
  width: max-content;
  padding-inline: var(--svc-rail-inset);
  box-sizing: border-box;
}

/* Each card's section becomes one slide of the row, the width of one card. */
.page-services .svc-hub-section.svc-rail .svc-discipline {
  flex: 0 0 var(--svc-rail-card);
  width: var(--svc-rail-card);
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: visible;
  contain: none;
  scroll-snap-align: center;
}
/* The gold rule that separated stacked phone sections has no place between cards in a row. */
.page-services .svc-hub-section.svc-rail .svc-discipline::after { display: none; }
.page-services .svc-hub-section.svc-rail .svc-discipline > .wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
.page-services .svc-hub-section.svc-rail .svc-glass-link {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: var(--svc-rail-h);
  max-height: none;
  margin: 0;
}

/* Pinned, scroll controlled sequence (svc-rail.js). The frame holds one screen while the track
   moves against the reading direction, and every card takes the measured height of the tallest. */
.page-services .svc-hub-section.svc-rail.svc-rail--pinned {
  min-height: 0;
  padding: 0;
}
.svc-rail--pinned > .svc-rail__viewport {
  position: sticky;
  top: 0;
  height: 100svh;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  scroll-snap-type: none;
}
.svc-rail--pinned .svc-rail__track {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  will-change: transform;
}
/* The fitted card height (svc-rail.js), one for all five cards, in the pinned sequence and in the
   fitted native row alike. */
.page-services .svc-hub-section.svc-rail[data-rail-fit="fit"] .svc-glass-link {
  height: var(--svc-rail-card-h, auto);
  min-height: 0;
}
/* Full size native row where no fit step fits (data-rail-fit="unmet"), its minimum height topped up
   to the tallest card's content (svc-rail.js). */
.page-services .svc-hub-section.svc-rail[data-rail-fit="unmet"] .svc-glass-link {
  min-height: max(var(--svc-rail-h), var(--svc-rail-nat, 0px));
}
/* Fitted native row (reduced motion). One screen tall, the cards at the fitted top, so each landing
   shows a whole card with the end rule 2vw above the screen's foot. */
.page-services .svc-hub-section.svc-rail[data-rail-fit="fit"]:not(.svc-rail--pinned) {
  min-height: 0;
  padding: 0;
}
.svc-rail[data-rail-fit="fit"]:not(.svc-rail--pinned) > .svc-rail__viewport {
  height: 100svh;
  box-sizing: border-box;
  padding-block: var(--svc-rail-top, 0px) 0;
}
/* While the track moves the cards take no pointer, so none starts its hover lift under a resting
   mouse and the row travels on one level plane. */
.svc-rail--moving .svc-rail__track {
  pointer-events: none;
}
/* The gold end rule, 2vw above the screen's foot beneath the scroll button (scroll snap skill
   section 7). While pinned, svc-rail.js holds the section's own rule in the frame, outside the
   moving track, where `section > .section-end-rule` no longer reaches it, so the same approved
   declarations apply here. Phones in portrait show it, as on the home rail; phones on their side
   keep the sitewide rule that hides every end rule. */
.svc-rail--pinned > .svc-rail__viewport > .section-end-rule {
  position: absolute;
  bottom: calc(2vw + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  width: 60%;
  margin-inline: auto;
  transform: none;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, #a8894c 15%, #a8894c 85%, transparent 100%);
  border: none;
  z-index: 3;
  pointer-events: none;
}
@media (max-width: 768px) and (orientation: portrait) {
  .page-services .svc-hub-section.svc-rail .section-end-rule { display: block; }
}

/* Measuring pass, natural card height. Phones in portrait space their card rows evenly with no
   gap of their own, so the pass reserves a minimum gap around each row there. */
.page-services .svc-hub-section.svc-rail[data-svc-measure] .svc-glass-link {
  height: auto;
  min-height: 0;
}
@media (max-width: 768px) and (orientation: portrait) {
  .page-services .svc-hub-section.svc-rail[data-svc-measure] .svc-glass-content {
    row-gap: var(--svc-measure-gap, 0.875rem);
    padding-block: var(--svc-measure-gap, 0.875rem);
  }
}

/* Fit ladder (svc-rail.js, data-svc-fit), the same step for all five cards, each step keeping the
   ones before it. w widens the cards, s tightens their spacing, t and u step the type down to its
   floors (heading 20px, subtitle and description 14px, tags and call to action 11px), never
   below the design's own size. */
.page-services .svc-hub-section.svc-rail[data-svc-fit~="w"] { --svc-rail-k: 1.04; }
@media (min-width: 600px) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="w"] { --svc-rail-k: 1.3; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="w"] { --svc-rail-k: 1.6; }
}
.page-services .svc-hub-section.svc-rail[data-svc-fit~="s"] .svc-glass-content {
  padding-inline: clamp(0.875rem, 2vw, 1.5rem);
  --svc-measure-gap: 0.5rem;
}
@media (min-width: 769px), (orientation: landscape) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="s"] .svc-glass-content {
    padding-block: 0.875rem;
    gap: 0.75rem;
  }
}
@media (max-width: 1024px) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="s"] .deliverable-tags {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr));
  }
}
/* On a wide card the tags flow in rows, as on the desktop cards, in place of the narrow grid. */
@media (max-width: 1024px) and (orientation: landscape) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="s"] .deliverable-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}
.page-services .svc-hub-section.svc-rail[data-svc-fit~="t"] .svc-glass-link h2 { font-size: var(--svc-fit-h); }
.page-services .svc-hub-section.svc-rail[data-svc-fit~="t"] .svc-glass-link .svc-subtitle em { font-size: var(--svc-fit-s); }
.page-services .svc-hub-section.svc-rail[data-svc-fit~="t"] .svc-glass-link p.svc-proposition { font-size: var(--svc-fit-p); line-height: 1.5; }
.page-services .svc-hub-section.svc-rail[data-svc-fit~="t"] .svc-glass-link .deliverable-tags li { font-size: var(--svc-fit-t); }
.page-services .svc-hub-section.svc-rail[data-svc-fit~="t"] .svc-glass-link .svc-enter { font-size: var(--svc-fit-e); }
.page-services .svc-hub-section.svc-rail[data-svc-fit~="u"] .svc-glass-link p.svc-proposition { line-height: 1.45; }
@media (min-width: 769px), (orientation: landscape) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="u"] .svc-glass-content {
    padding-block: 0.5rem;
    gap: 0.5rem;
  }
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="u"] .deliverable-tags { gap: 0.25rem 0.375rem; }
}
/* Last step, a landscape screen under 640px tall only. The heading and its subtitle take the start column and
   the description, tags and call to action the end column, in the same reading order as the DOM,
   so a wide, shallow card holds all its content at the readable floors. Arabic mirrors the
   columns through the page's own direction. */
@media (orientation: landscape) and (max-height: 640px) {
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="c"] .svc-glass-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
    grid-template-rows: auto auto auto;
    align-content: center;
    column-gap: 1.25rem;
    row-gap: 0.5rem;
  }
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="c"] .svc-glass-content > h2 { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="c"] .svc-glass-content > .svc-proposition { grid-column: 2; grid-row: 1; }
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="c"] .svc-glass-content > .deliverable-tags { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .page-services .svc-hub-section.svc-rail[data-svc-fit~="c"] .svc-glass-content > .svc-enter { grid-column: 2; grid-row: 3; justify-content: flex-start; }
}

/* Print. Every card in full, in reading order, whatever the mode on screen. */
@media print {
  .page-services .svc-hub-section.svc-rail { height: auto !important; min-height: 0 !important; padding: 0 !important; }
  .svc-rail .svc-rail__viewport { position: static !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  .svc-rail .svc-rail__track { position: static !important; transform: none !important; width: auto !important; flex-wrap: wrap !important; padding: 0 !important; }
  .page-services .svc-hub-section.svc-rail .svc-discipline { flex: 1 1 45% !important; width: auto !important; break-inside: avoid; }
  .page-services .svc-hub-section.svc-rail .svc-glass-link { height: auto !important; min-height: 0 !important; opacity: 1 !important; visibility: visible !important; }
  .page-services .svc-hub-wrap--rail > .svc-hub-video-bg { display: none !important; }
}
