/* ============================================================
   assets/css/service-cards.css

   Five card templates for one grid.

   The grid itself is unchanged: three columns, a 1.5px gap showing the border
   colour through, which is what draws the hairlines between cards without any
   card owning a border. Everything below styles what sits inside a cell.

   Cache-busted by APP_VERSION in the layout, so a change here needs a version
   bump or nobody who has visited before will see it.

   Nothing here is hardcoded to a colour. Every value is a token from
   portal.css, so the dark theme and any future recolour reach these cards
   without this file being touched.
   ============================================================ */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5px;
  background: var(--border);
}

.svc-card {
  position: relative;
  background: var(--bg-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background var(--t) var(--ease);
}
.svc-card:hover { background: var(--bg-card); }

/* ── The media slot ──────────────────────────────────────────
   padding-top reserves the height before the file arrives. Without it every
   image landing shifts the row below it, which on a slow connection is the
   page rearranging itself under somebody's cursor. */

.svc-media {
  position: relative;
  width: 100%;
  height: 0;                 /* height comes entirely from padding-top */
  overflow: hidden;
  background: var(--accent-light);
  flex-shrink: 0;
}
.svc-media-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;         /* object-position is set inline, per service */
  display: block;
}
.svc-media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.svc-media-fallback svg { stroke: currentColor; fill: none; stroke-width: 1.4; }

/* The image never flips. Mirroring a photograph mirrors any text, any logo
   and any face inside it, and Arabic changes the direction of the page, not
   the direction of a photograph. */
[dir="rtl"] .svc-media-img,
.rtl .svc-media-img { transform: none; }

/* ── Shared card furniture ───────────────────────────────── */

.svc-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--fg);
  margin: 0 0 0.85rem;
  line-height: 1.25;
}
.svc-desc {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--fg-muted);
  margin: 0 0 1.75rem;
}
.svc-link {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;          /* links line up across a row of uneven text */
  align-self: flex-start;
  transition: gap var(--t) var(--ease);
}
.svc-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.svc-card:hover .svc-link { gap: 0.9rem; }

/* Arabic reads right to left, so the arrow points left. */
[dir="rtl"] .svc-link svg,
.rtl .svc-link svg { transform: scaleX(-1); }

.svc-num {
  position: absolute;
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 300;
  color: var(--border-2);
  line-height: 1;
  pointer-events: none;
  transition: color var(--t) var(--ease);
}
.svc-card:hover .svc-num { color: rgba(var(--accent-rgb), 0.12); }

.svc-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-2);
  color: var(--accent);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.svc-card:hover .svc-icon { border-color: var(--accent); background: var(--accent-light); }
.svc-icon svg { stroke: currentColor; fill: none; }

/* ── A: banner above ────────────────────────────────────── */

.svc-t-banner .svc-body {
  position: relative;
  padding: 2.25rem 2.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.svc-t-banner .svc-num { top: 1.75rem; right: 2.25rem; font-size: 3.25rem; }
[dir="rtl"] .svc-t-banner .svc-num,
.rtl .svc-t-banner .svc-num { right: auto; left: 2.25rem; }
.svc-t-banner .svc-title { font-size: 1.4rem; padding-right: 3.5rem; }
[dir="rtl"] .svc-t-banner .svc-title,
.rtl .svc-t-banner .svc-title { padding-right: 0; padding-left: 3.5rem; }

/* ── B: thumbnail in the icon slot ──────────────────────── */

.svc-t-thumb { padding: 2.5rem; }
.svc-t-thumb .svc-media,
.svc-t-thumb .svc-media-sq {
  width: 64px;
  height: 64px;
  padding-top: 0 !important;  /* the square wins over the site ratio */
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
}
.svc-t-thumb .svc-num { top: 2rem; right: 2rem; }
[dir="rtl"] .svc-t-thumb .svc-num,
.rtl .svc-t-thumb .svc-num { right: auto; left: 2rem; }

/* ── C: image behind the card ───────────────────────────── */

.svc-t-fullbleed { min-height: 22rem; }
.svc-t-fullbleed .svc-media,
.svc-t-fullbleed .svc-media-fill {
  position: absolute;
  inset: 0;
  height: 100%;
  padding-top: 0 !important;
}
/* The scrim is not styling. Without it, whether the description is readable
   depends on a file somebody uploads next year. */
.svc-t-fullbleed .svc-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
              rgba(4, 8, 20, 0.45) 0%,
              rgba(4, 8, 20, 0.86) 62%,
              rgba(4, 8, 20, 0.94) 100%);
}
.svc-t-fullbleed .svc-body {
  position: relative;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
}
.svc-t-fullbleed .svc-title { color: #FFFFFF; }
.svc-t-fullbleed .svc-desc  { color: rgba(255, 255, 255, 0.86); }
.svc-t-fullbleed .svc-link  { color: var(--accent-b); }
.svc-t-fullbleed .svc-num   { top: 1.75rem; right: 2.25rem; color: rgba(255, 255, 255, 0.26); }
[dir="rtl"] .svc-t-fullbleed .svc-num,
.rtl .svc-t-fullbleed .svc-num { right: auto; left: 2.25rem; }
.svc-t-fullbleed:hover .svc-num { color: rgba(255, 255, 255, 0.4); }
/* No image: the scrim over a flat tint is close to black and the card reads
   as a hole. Drop it and let the tint and the accent text carry the card. */
.svc-t-fullbleed .svc-media-fallback ~ .svc-scrim { display: none; }

/* ── D: corner wash ─────────────────────────────────────── */

.svc-t-wash { padding: 2.5rem; }
.svc-wash-img {
  position: absolute;
  top: 0; right: 0;
  width: 74%;
  height: 74%;
  object-fit: cover;
  opacity: 0.16;
  pointer-events: none;
  transition: opacity var(--t) var(--ease), width var(--t) var(--ease), height var(--t) var(--ease);
  -webkit-mask-image: linear-gradient(215deg, rgba(0,0,0,1) 8%, rgba(0,0,0,0) 72%);
          mask-image: linear-gradient(215deg, rgba(0,0,0,1) 8%, rgba(0,0,0,0) 72%);
}
.svc-t-wash:hover .svc-wash-img { opacity: 0.32; width: 84%; height: 84%; }
.svc-t-wash .svc-num { top: 2rem; right: 2rem; }
/* The wash mirrors to the other corner, and so does its mask. Flipping the
   element would flip the photograph with it. */
[dir="rtl"] .svc-wash-img,
.rtl .svc-wash-img {
  right: auto; left: 0;
  -webkit-mask-image: linear-gradient(145deg, rgba(0,0,0,1) 8%, rgba(0,0,0,0) 72%);
          mask-image: linear-gradient(145deg, rgba(0,0,0,1) 8%, rgba(0,0,0,0) 72%);
}
[dir="rtl"] .svc-t-wash .svc-num,
.rtl .svc-t-wash .svc-num { right: auto; left: 2rem; }
.svc-t-wash .svc-icon,
.svc-t-wash .svc-title,
.svc-t-wash .svc-desc,
.svc-t-wash .svc-link { position: relative; }

/* ── E: icon only ───────────────────────────────────────── */

.svc-t-icon { padding: 2.5rem; }
.svc-t-icon .svc-num { top: 2rem; right: 2rem; }
[dir="rtl"] .svc-t-icon .svc-num,
.rtl .svc-t-icon .svc-num { right: auto; left: 2rem; }

/* ── Arabic sets its own measure ─────────────────────────
   Almarai needs more leading than Inter at the same size, and the same
   sentence runs about a fifth longer. Cards grow with their text rather than
   fixing a height, so this only has to loosen the lines. */

[dir="rtl"] .svc-desc,
.rtl .svc-desc { line-height: 1.95; font-size: 0.88rem; }
[dir="rtl"] .svc-title,
.rtl .svc-title { line-height: 1.5; }

/* ── Narrower screens ───────────────────────────────────── */

@media (max-width: 1024px) {
  .services-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .services-grid { grid-template-columns: 1fr; }
  .svc-t-thumb, .svc-t-wash, .svc-t-icon { padding: 1.75rem; }
  .svc-t-banner .svc-body, .svc-t-fullbleed .svc-body { padding: 1.75rem; }
  .svc-num { font-size: 3rem; }
}

/* Somebody who has asked for less motion gets the card, not the animation. */
@media (prefers-reduced-motion: reduce) {
  .svc-card, .svc-link, .svc-num, .svc-icon, .svc-wash-img { transition: none; }
}
