/* ==========================================================================
   Casa Alba — Services (#services)
   Light section. Two-column split (stacks on mobile):
     Left  : SERVICES eyebrow + a four-item single-open accordion.
     Right : inset, bottom-weighted parallax image, taller than the accordion.
   Accordion timing lives in scripts/sections/services.js (CSS vars below are
   the tunable hooks it sets).
   ========================================================================== */

.services {
  position: relative;
  z-index: 1;                 /* scrolls over the pinned hero */
  width: 100%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(5rem, 12vh, 9rem) var(--nav-pad-x);

  /* Tunable hooks (defaults; services.js overrides from its CONFIG). */
  --acc-dur: 500ms;           /* expand / collapse duration */
  --acc-icon-dur: 350ms;      /* + <-> - icon swap          */
  --services-parallax: 150px; /* image parallax travel       */
}

/* --- Columns -------------------------------------------------------------- */
.services__col {
  width: 50%;
}

.services__eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-sm);
  color: var(--color-text-body);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}

/* "Inside the workshop" link to the dedicated Factory page. */
.services__more {
  margin-top: clamp(1.5rem, 4vh, 2.5rem);
}
.services__more-link {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--color-text-primary);
  padding-bottom: 0.35em;
  transition: opacity 0.3s ease;
}
.services__more-link::after { content: " \2192"; }
.services__more-link:hover { opacity: 0.6; }

/* --- Right: inset parallax media ------------------------------------------ */
.services__media {
  position: relative;
  width: 100%;
  min-height: clamp(26rem, 64vh, 40rem);  /* a bit taller than the accordion */
  overflow: hidden;                       /* clip the over-tall image */
}

.services__media-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% + var(--services-parallax));
  object-fit: cover;
  object-position: center 80%;  /* wide framing, weighted to the bottom */
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* --- Accordion ------------------------------------------------------------ */
.acc {
  width: 100%;
}

.acc__item {
  border-top: 1px solid var(--color-hairline);
}
.acc__item:last-child {
  border-bottom: 1px solid var(--color-hairline);
}

/* Header row — easy to tap. */
.acc__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.75rem);
  padding: clamp(1.1rem, 2.4vh, 1.6rem) 0;
  text-align: left;
  cursor: pointer;
}

.acc__num {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-body);
  flex: 0 0 auto;
}

.acc__title {
  flex: 1 1 auto;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

/* Plus/minus icon built from two bars; the vertical bar collapses when open. */
.acc__icon {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-left: auto;
}
.acc__icon::before,
.acc__icon::after {
  content: "";
  position: absolute;
  background: var(--color-text-primary);
}
.acc__icon::before {           /* horizontal bar (always shown) */
  left: 0;
  right: 0;
  top: 50%;
  height: 1.5px;
  transform: translateY(-50%);
}
.acc__icon::after {            /* vertical bar (hidden when open) */
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  transform: translateX(-50%) scaleY(1);
  transition:
    transform var(--acc-icon-dur) ease,
    opacity var(--acc-icon-dur) ease;
}
.acc__item.is-open .acc__icon::after {
  transform: translateX(-50%) scaleY(0);
  opacity: 0;
}

/* Body: animate via grid-template-rows 0fr -> 1fr for a gentle expand. */
.acc__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--acc-dur) ease;
}
.acc__item.is-open .acc__body {
  grid-template-rows: 1fr;
}
.acc__body-inner {
  overflow: hidden;
}
.acc__body-text {
  margin: 0;
  padding-bottom: clamp(1.1rem, 2.4vh, 1.6rem);
  max-width: 34rem;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.25vw, 1.25rem);
  line-height: var(--leading-normal);
  color: var(--color-text-body);
  opacity: 0;
  transition: opacity var(--acc-dur) ease;
}
.acc__item.is-open .acc__body-text {
  opacity: 1;
}

/* --- Mobile: stack -------------------------------------------------------- */
@media (max-width: 768px) {
  .services {
    flex-direction: column;
    align-items: stretch;
    gap: clamp(2.5rem, 8vw, 4rem);
  }
  .services__col {
    width: 100%;
  }
  .services__media {
    min-height: 55vh;
    order: 1;                 /* image below the accordion on mobile */
  }
}

@media (prefers-reduced-motion: reduce) {
  .acc__body,
  .acc__body-text,
  .acc__icon::after {
    transition: none;
  }
}
