/* Services: a full-screen (100vh) pinned card with 5 tabs, as in the Figma prototype.
   The card is edge to edge; the content uses the footer container (min(73.4vw, 1410px)), sized from the screen height too, and the panel scales with its own width using container query units. */
.services { --edge: 1.8vw; padding-bottom: 5vw; }   /* --edge = card inset from the screen sides (Figma: 35px of 1920) */

.services__card {
  position: relative; overflow: hidden; isolation: isolate;
  width: calc(100% - 2 * var(--edge)); height: 100vh; height: 100svh; margin: 0 auto;
  border-radius: 2.1vw; color: #fff;
  /* static fallback if WebGL is unavailable; the canvas below paints the liquid gradient on top */
  background:
    radial-gradient(60% 70% at 25% 40%, #a8082f 0%, rgba(168,8,47,0) 70%),
    radial-gradient(55% 60% at 80% 15%, #ff8a00 0%, rgba(255,138,0,0) 70%),
    radial-gradient(60% 60% at 85% 85%, #f26a2e 0%, rgba(242,106,46,0) 70%),
    #d4262c;
}

/* Liquid gradient canvas (Three.js shader). Sits behind all the text. */
.services__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.services__canvas { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--ease); }
.services__canvas.is-ready { opacity: 1; }

/* Content: exactly the same container as the footer and the Figma content group (1410px at 1920 = 73.4vw) */
.services__inner {
  /* Everything below is derived from the SCREEN HEIGHT too, so the title, tabs and panel always fit without overlapping. */
  --padTop: clamp(6.5rem, 13vh, 9rem);                          /* always clears the fixed header */
  --padBottom: clamp(1.5rem, 5vh, 3.5rem);
  --tfs: clamp(2rem, min(4.17vw, 6.6vh), 5.2rem);                /* title font size */
  --titleH: calc(var(--tfs) * 3.3);                              /* 3 lines at line-height 1.1 */
  --rowH: calc(100svh - var(--padTop) - var(--padBottom) - var(--titleH) - 1.5rem);   /* height left for tabs + panel */

  width: min(73.4vw, 1410px); height: 100%; margin-inline: auto; padding-block: var(--padTop) var(--padBottom);
  display: grid; grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); grid-template-rows: auto minmax(0, 1fr);
}

.services__eyebrow {
  grid-area: 1 / 1; align-self: start; margin-top: .6rem;
  display: flex; align-items: center; gap: .6rem; height: fit-content;
  font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.services__eyebrow img { width: 15px; height: auto; }

.services__title {
  grid-area: 1 / 2; max-width: 7.6em;
  font-size: var(--tfs); line-height: 1.1; font-weight: 600; letter-spacing: -.02em; text-transform: capitalize;
}

/* ---------- Tabs ---------- */
.services__tabs { --tabH: clamp(2.6rem, min(4.58vw, calc(var(--rowH) / 5.6)), 5.2rem); grid-area: 2 / 1; align-self: center; width: min(88%, 31rem); display: flex; flex-direction: column; }
.services-tab {
  display: flex; align-items: center; gap: 1.1rem; height: var(--tabH); padding: 0; text-align: left; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.22); color: rgba(255,255,255,.45);
  transition: color .4s var(--ease), border-color .4s;
}
.services-tab__num { width: 1.9rem; font-size: .75rem; font-weight: 500; flex: none; }
.services-tab__name { font-size: calc(var(--tabH) * .45); line-height: 1; font-weight: 600; letter-spacing: -.01em; transition: transform .4s var(--ease); }
.services-tab:hover { color: rgba(255,255,255,.8); }
.services-tab:hover .services-tab__name { transform: translateX(.5rem); }
.services-tab.is-active { color: #fff; border-color: rgba(255,255,255,.6); }

/* ---------- Panel (sized from its own width: 1cqw = 1% of the stage) ---------- */
.services__stage {
  grid-area: 2 / 2; align-self: center; position: relative; container-type: inline-size;
  /* never wider than the column, and never taller than the space under the title */
  width: max(22rem, min(97.3%, calc(var(--rowH) * 1.58))); aspect-ratio: 38.4 / 24.3;   /* 97.3%: the image overhangs the panel by 2.8cqw and ends on the container edge */
}
.services-panel { position: absolute; inset: 0; transition: opacity .5s var(--ease), visibility .5s; }
.services-panel[hidden] { display: block; visibility: hidden; opacity: 0; }   /* kept in layout so it can fade; visibility removes it from tab order */
.services-panel.is-active { visibility: visible; opacity: 1; }

.services-panel__box {
  position: absolute; left: 0; top: 0; width: 96.6cqw; height: 100%; padding: 5cqw 5.4cqw;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 4.2cqw;
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: flex; flex-direction: column; box-shadow: 0 3.8cqw 10cqw rgba(120,0,20,.18);
}
.services-panel__text { width: 36cqw; font-size: max(11px, 2.3cqw); line-height: 1.55; font-weight: 500; }
.services-panel__list { margin-top: 3.2cqw; display: grid; gap: 1.2cqw; font-size: max(10.5px, 2.1cqw); line-height: 1.3; font-weight: 500; }
.services-panel__list li { display: flex; align-items: center; gap: 1.5cqw; }
.services-panel__list li::before { content: ''; width: max(4px, .8cqw); height: max(4px, .8cqw); border-radius: 50%; background: #fff; }
.services-panel__play {
  margin-top: auto; width: max(32px, 7.5cqw); height: max(32px, 7.5cqw); border-radius: 2cqw;
  display: grid; place-items: center; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.3);
  transition: background .3s, transform .4s var(--ease);
}
.services-panel__play:hover { background: #fff; color: var(--c-primary); transform: scale(1.08); }

.services-panel__img { position: absolute; left: 54cqw; top: 2.7cqw; width: 48.8cqw; margin: 0; border-radius: 3.1cqw; overflow: hidden; box-shadow: 0 3.8cqw 9cqw rgba(90,0,10,.28); }
.services-panel__img img { width: 100%; height: auto; transform: scale(1.12); transition: transform 1.1s var(--ease); }
.services-panel.is-active .services-panel__img img { transform: scale(1); }

/* entrance of the active panel content */
.services-panel__text, .services-panel__list li, .services-panel__play, .services-panel__img { opacity: 0; transform: translateY(3cqw); transition: opacity .6s var(--ease), transform .7s var(--ease); }
.services-panel.is-active .services-panel__text,
.services-panel.is-active .services-panel__list li,
.services-panel.is-active .services-panel__play,
.services-panel.is-active .services-panel__img { opacity: 1; transform: none; }
.services-panel.is-active .services-panel__text { transition-delay: .12s; }
.services-panel.is-active .services-panel__list li:nth-child(1) { transition-delay: .2s; }
.services-panel.is-active .services-panel__list li:nth-child(2) { transition-delay: .26s; }
.services-panel.is-active .services-panel__list li:nth-child(3) { transition-delay: .32s; }
.services-panel.is-active .services-panel__list li:nth-child(4) { transition-delay: .38s; }
.services-panel.is-active .services-panel__list li:nth-child(5) { transition-delay: .44s; }
.services-panel.is-active .services-panel__play { transition-delay: .5s; }
.services-panel.is-active .services-panel__img { transition-delay: .18s; }

/* ---------- Tablet / mobile: no pin, natural height, tabs on top ---------- */
@media (max-width: 900px) {
  .services { padding-bottom: 3rem; }
  .services__card { height: auto; width: calc(100% - 2 * var(--gutter)); border-radius: 1.5rem; }
  .services__inner { display: block; width: auto; height: auto; padding: 2rem 1.25rem 1.5rem; }
  .services__eyebrow { margin-top: 0; font-size: .75rem; }
  .services__title { margin-top: 1rem; max-width: none; font-size: clamp(2rem, 9.5vw, 3rem); }
  .services__tabs { margin-top: 1.5rem; width: auto; flex-direction: row; overflow-x: auto; gap: 1.25rem; scrollbar-width: none; }
  .services__tabs::-webkit-scrollbar { display: none; }
  .services-tab { flex: none; height: auto; padding: .75rem 0; gap: .5rem; border-bottom: 2px solid transparent; }
  .services-tab.is-active { border-color: #fff; }
  .services-tab__num { width: auto; font-size: .7rem; }
  .services-tab__name { font-size: 1.15rem; }
  .services__stage { margin-top: 1.25rem; width: auto; aspect-ratio: auto; container-type: normal; display: grid; }
  .services-panel { position: relative; grid-area: 1 / 1; inset: auto; display: flex; flex-direction: column; gap: 1rem; }
  .services-panel__box { position: relative; width: auto; height: auto; padding: 1.25rem; border-radius: 1.25rem; gap: 1rem; box-shadow: none; }
  .services-panel__text { width: auto; font-size: .95rem; }
  .services-panel__list { margin-top: 0; font-size: .9rem; gap: .5rem; }
  .services-panel__list li { gap: .6rem; }
  .services-panel__list li::before { width: 5px; height: 5px; }
  .services-panel__play { margin-top: .5rem; width: 44px; height: 44px; border-radius: 12px; }
  .services-panel__img { position: relative; left: auto; top: auto; width: min(70%, 320px); border-radius: 1rem; order: -1; box-shadow: none; }
  .services-panel__text, .services-panel__list li, .services-panel__play, .services-panel__img { transform: translateY(14px); }
}
