/* ============================================================================
   SADER — SERVICES  (s-services)
   Theme: LIGHT (parchment / ivory).
   Reference: Hermès card refinement (only the image moves) + Porsche HomeStage
   tile-grid rhythm (one large feature tile + five standard tiles).
   Composes on .section, .card, .card__media, .card__body, .kicker, .card__title,
   .card__text, .btn--text, .media-overlay. Bespoke CSS below is layout only.
   All properties logical → RTL flips for free.
   ============================================================================ */

.s-services {
  background-color: var(--bg);
  --svc-hover-dur: 1500ms;
  /* one knob for BOTH hover animations: width + zoom */
  --svc-gap: clamp(var(--space-4), 1.4vw, var(--space-6));
  /* row gap + tile width calc */
}

/* --------------------------------------------------------------------------
   THE TILE GRID
   Desktop: a 3-column stage. The feature tile holds the inline-start 2 columns
   across the first 2 rows; tiles 02 & 03 stack on the end column; tiles 04–06
   complete the lower band. Tall, confident, generous gutters.
   -------------------------------------------------------------------------- */
.s-services__grid {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-4), 1.4vw, var(--space-6));
}

/* Each band of standard tiles is a flex row. The tiles share the inline space
   equally (flex-basis 0), so on hover the focused tile can expand while its
   neighbours yield — the Porsche HomeStage "expanding panels" behaviour. */
.s-services__row {
  display: flex;
  gap: var(--svc-gap);
}

.s-services__row>.s-services__tile {
  /* flex-basis:0 + flex-grow:1 splits available space (container - gap) by ratio,
     eliminating the per-frame shrink recalculation that caused the right-edge drift
     when inline-size percentages were used. */
  flex: 1 0 0;
  min-inline-size: 0;
  block-size: clamp(20rem, 31vw, 27rem);
  transition:
    flex-grow var(--svc-hover-dur) var(--ease-in-out),
    opacity var(--dur-reveal) var(--ease),
    transform var(--dur-reveal) var(--ease),
    border-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.s-services__tile {
  /* Each tile is image-led: a tall portrait/landscape stage with text resting
     over a gradient at the block-end. Softly rounded; the image is clipped to
     the curve by the inherited overflow:hidden on .card. */
  min-block-size: clamp(19rem, 29vw, 26rem);
  border-radius: 12px;
  isolation: isolate;
  transition:
    border-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.s-services__tile--feature {
  /* In the 2-up grid the feature matches its peers' size and typography. */
  min-block-size: clamp(19rem, 29vw, 26rem);
}

/* The whole tile is a single link; lay media + body in one stacked context. */
.s-services__link {
  display: grid;
  grid-template-rows: 1fr auto;
  block-size: 100%;
  color: inherit;
  text-decoration: none;
}

/* Media fills the tile and sits behind the body (single-cell stack). */
.s-services__media {
  grid-row: 1 / -1;
  grid-column: 1;
  block-size: 100%;
}

.s-services__media img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transform: scale(1);
  /* explicit resting value to interpolate from */
  transition: transform var(--svc-hover-dur) var(--ease-in-out);
  /* same timing/easing as the width */
  will-change: transform;
  /* only ~6 tiles — smooth, composited zoom */
}

/* Lower-anchored gradient so the serif title always reads cleanly on the image. */
.s-services__media .media-overlay {
  background:
    /* Porsche-style dark band across the top of the image (for the badge/kicker). */
    linear-gradient(to bottom,
      rgba(0, 0, 0, 0.50) 0%,
      rgba(0, 0, 0, 0.22) 14%,
      rgba(0, 0, 0, 0) 32%),
    /* Existing deeper wash at the foot so the title always reads. */
    linear-gradient(to top,
      rgba(0, 0, 0, 0.86) 0%,
      rgba(0, 0, 0, 0.52) 34%,
      rgba(0, 0, 0, 0.10) 62%,
      rgba(0, 0, 0, 0) 100%);
}

.s-services__tile--feature .s-services__media .media-overlay {
  background:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 0.50) 0%,
      rgba(0, 0, 0, 0.22) 16%,
      rgba(0, 0, 0, 0) 34%),
    linear-gradient(to top,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.50) 42%,
      rgba(0, 0, 0, 0.08) 74%,
      rgba(0, 0, 0, 0) 100%);
}

/* Body rests over the foot of the image. Text is always on warm off-white over
   the dark gradient — never on a brass fill. */
.s-services__body {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-row: 2;
  grid-column: 1;
  z-index: var(--z-base);
  gap: var(--space-3);
  column-gap: var(--space-5);
  padding: clamp(var(--space-5), 2.4vw, var(--space-8));
  align-content: end;
}

.s-services__body .card__title {
  grid-column: 1 / -1;
  color: var(--text-on-dark);
}

.s-services__body .card__text {
  grid-column: 1;
  grid-row: 2;
  color: var(--text-on-dark-soft);
  max-inline-size: 38ch;
  text-align: justify;
  text-justify: inter-word;
  /* Lead + intro flow as one block; clamp keeps cards uniform (source shows the
     full copy truncated with an ellipsis). */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.s-services__tile--feature .s-services__body .card__text {
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.s-services__tile--feature .s-services__body {
  gap: var(--space-3);
}

/* Porsche-style card CTA: a compact circular arrow that expands to reveal text. */
.s-services__body .s-services__cta {
  --svc-cta-size: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  inline-size: var(--svc-cta-size);
  min-inline-size: var(--svc-cta-size);
  block-size: var(--svc-cta-size);
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  margin-block-start: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--text-on-light);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  transition:
    inline-size var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  letter-spacing: 0;
  text-transform: none;
}

.s-services__body .s-services__cta::before {
  content: "→";
  display: grid;
  place-items: center;
  inline-size: var(--svc-cta-size);
  block-size: 100%;
  flex: 0 0 var(--svc-cta-size);
  font-size: 1rem;
  line-height: 1;
}

.s-services__body .s-services__cta::after {
  content: none;
}

.s-services__cta-label {
  display: inline-block;
  max-inline-size: 0;
  overflow: hidden;
  opacity: 0;
  color: inherit;
  transition:
    max-inline-size var(--dur-fast) var(--ease),
    opacity var(--dur-fast) var(--ease),
    padding-inline-end var(--dur-fast) var(--ease);
}

[dir="rtl"] .s-services__body {
  grid-template-columns: auto 1fr;
}

[dir="rtl"] .s-services__body .card__title {
  grid-column: 1 / -1;
}

[dir="rtl"] .s-services__body .card__text {
  grid-column: 2;
}

[dir="rtl"] .s-services__body .s-services__cta {
  grid-column: 1;
}

[dir="rtl"] .s-services__body .s-services__cta::before {
  content: "←";
}

.s-services__tile:hover .s-services__cta,
.s-services__tile:focus-within .s-services__cta {
  inline-size: clamp(7.5rem, 9vw, 8.75rem);
  background-color: #FFFFFF;
  border-color: #FFFFFF;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  transition-delay: 560ms;
}

.s-services__tile:hover .s-services__cta-label,
.s-services__tile:focus-within .s-services__cta-label {
  max-inline-size: 6rem;
  opacity: 1;
  padding-inline-end: var(--space-4);
  transition-delay: 560ms;
}

/* --------------------------------------------------------------------------
   HOVER / FOCUS — Hermès rule: only the IMAGE scales (handled by components
   .card:hover .card__media img). The frame stays still; we only warm the
   hairline to brass and lay a whisper-thin shadow on the light ground.
   -------------------------------------------------------------------------- */
.s-services__tile:hover,
.s-services__tile:focus-within {
  box-shadow: var(--shadow-luxe);
}

/* Porsche-style width expand: the hovered tile grows and its row-mates recede.
   flex-grow ratio 2.125:1 → 68% : 32% of available row space.
   Gated to real pointers; touch / reduced-motion keep equal tiles. */
@media (hover: hover) {
  .s-services__row>.s-services__tile:hover {
    flex-grow: 2.125;
  }
}

/* Image zoom on hover removed — the tile width expansion is the only motion. */
.s-services__tile:hover .card__media img,
.s-services__tile:focus-within .card__media img {
  transform: scale(1);
}


/* Brass focus ring on keyboard nav for the whole tile. */
.s-services__link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   ≤1080px: 2-column stage, feature spans the full inline width.
   ≤640px : single column, every tile a clean stacked stage.
   -------------------------------------------------------------------------- */
/* ≤640px: rows stack into a single column — every tile a clean stacked stage.
   The width-expand is already disabled here (hover query needs a real pointer). */
@media (max-width: 640px) {
  .s-services__grid {
    gap: var(--space-5);
  }

  .s-services__row {
    flex-direction: column;
    gap: var(--space-5);
  }

  .s-services__row>.s-services__tile {
    block-size: auto;
    /* natural height when stacked */
    inline-size: auto;
    /* full width when stacked */
  }

  .s-services__tile,
  .s-services__tile--feature {
    min-block-size: clamp(16rem, 64vw, 22rem);
  }
}

/* --------------------------------------------------------------------------
   DARK ON SCROLL
   As the section scrolls into view, app.js sets data-theme="dark" on the
   <section> (its tokens flip: bg → ink, heading text → light, brass → white,
   all via the global [data-theme="dark"] block) and adds .is-dark-zone to
   <body> so the page ground behind the section darkens too. Here we only add
   the smooth fade between the light and dark worlds.
   -------------------------------------------------------------------------- */
.s-services {
  transition: background-color var(--dur-slow) var(--ease);
}

.s-services .section-head__title,
.s-services .section-head__lead,
.s-services .eyebrow {
  transition: color var(--dur-slow) var(--ease);
}

body.is-dark-zone {
  background-color: #0E0E0E;
  transition: background-color var(--dur-slow) var(--ease);
}

@media (prefers-reduced-motion: reduce) {

  .s-services,
  .s-services .section-head__title,
  .s-services .section-head__lead,
  .s-services .eyebrow,
  body.is-dark-zone {
    transition: none;
  }
}