/* =========================
   SERVICES LAYOUT
========================= */

.services-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 0;
  position: relative;
  /* Clip reveal-left/reveal-right translateX without breaking position:sticky.
     overflow:clip does NOT create a scroll container, unlike overflow:hidden */
  overflow: clip;
}

@media (max-width: 1024px) {
  .services-layout {
    grid-template-columns: 1fr;
  }

  .services-media {
    display: none;
  }
}


/* =========================
   LEFT MEDIA (STICKY IMAGE)
========================= */

.services-media {
  background: var(--surface-primary);
  position: relative;
}

.services-media__sticky {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-5);
}

.services-media__frame {
  width: 100%;
  max-width: var(--services-media-max-width);
  aspect-ratio: var(--services-media-aspect-w) / var(--services-media-aspect-h);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-medium);
  background: var(--surface-dark);
  /* Clip overflow during scale transitions */
  will-change: transform;
}

/* ── Image transition: exit right, enter from left ── */

@keyframes svc-img-enter {
  from {
    opacity: 0;
    transform: translateX(-32px) scale(1.02);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.services-media__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  transform: translateX(0) scale(1);
  will-change: opacity, transform;

  /* EXIT — must match JS exitTimer (180ms) */
  transition:
    opacity 180ms var(--ease-standard),
    transform 180ms var(--ease-standard);
}

/* EXIT state: drift right + fade out */
.services-media__image.fading {
  opacity: 0;
  transform: translateX(18px) scale(0.98);
}

/* ENTER state: keyframe owns opacity+transform.
   transition:none prevents the base CSS transition
   from fighting the keyframe on the same properties. */
.services-media__image.entering {
  transition: none;
  animation: svc-img-enter 420ms var(--ease-smooth) both;
}




/* =========================
   RIGHT PANEL (SCROLL)
========================= */

.services-content {
  position: relative;
  background: var(--surface-primary);
  display: flex;
  flex-direction: column;
}

.services-scroll {
  padding: var(--space-6) var(--space-5) 0 var(--space-4);
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .services-scroll {
    padding:
      var(--section-padding-tablet) var(--space-4) calc(var(--section-padding-tablet) * 1.5) var(--space-4);
  }
}

@media (max-width: 768px) {
  .services-scroll {
    padding:
      var(--section-padding-mobile) var(--space-3) calc(var(--section-padding-mobile) * 1.5) var(--space-3);
  }
}


/* =========================
   REVEAL SECTIONS
========================= */

.reveal-item {
  margin-bottom: var(--space-8);
  min-height: 60vh;
  text-align: right;

  /* Invisible + slightly below; revealed at 40% visible threshold */
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 600ms var(--ease-smooth),
    transform 600ms var(--ease-smooth);
}

.reveal-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* First section */
.reveal-item:first-child {
  min-height: auto;
  margin-top: 0;
  padding-top: 0;
}

/* Last section */
.reveal-item:last-child {
  margin-bottom: 0;
  padding-bottom: var(--space-6);
}

/* Headings */
.reveal-item h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.reveal-item .tagline {

  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.reveal-item .highlight {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
}


/* =========================
   ACCORDION
========================= */

.accordion-item {
  border-top: 1px solid var(--border-light);
  margin-bottom: 0;
  /* Right accent bar (aligns with right-side content) */
  box-shadow: inset -4px 0 0 transparent;
  border-radius: 16px;

  transition:
    box-shadow var(--duration-base) var(--ease-standard),
    background var(--duration-base) var(--ease-standard);
}

.accordion-item:last-child {
  border-bottom: 1px solid var(--border-light);
}

.accordion-item.active {
  box-shadow: inset -4px 0 0 var(--action-primary);
  background: rgba(var(--primary-rgb), 0.02);
}

/* ── Button: icon LEFT, text RIGHT ── */

.accordion-button {
  width: 100%;
  padding: var(--space-2) var(--space-2) var(--space-2) 0;
  display: flex;
  flex-direction: row;
  /* icon first (left), then text */
  align-items: center;
  gap: var(--space-2);

  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
  /* text pushes to right */

  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  color: var(--text-primary);

  transition: color var(--duration-fast) var(--ease-standard);
}

.accordion-button:hover {
  color: var(--action-primary);
}

/* Text span grows to fill remaining space, aligned right */
.accordion-button>span:last-child {
  flex: 1;
  text-align: right;
}

/* ── Icon (left side) ── */

.accordion-icon {
  font-size: 35px;
  flex-shrink: 0;
  color: var(--action-primary);
  transition:
    transform var(--duration-base) var(--ease-smooth);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

/* ── Panel (height-driven, no max-height hack) ── */

.accordion-panel {
  /* Height is set by JS (0 → scrollHeight) */
  height: 0;
  overflow: hidden;
  transition: height 350ms var(--ease-smooth);
}

.accordion-inner {
  /* left indent aligns with text; right padding clears the accent bar */
  padding: var(--space-1) var(--space-3) var(--space-3) calc(22px + var(--space-2));
  text-align: right;
}

.accordion-inner p {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* ── More Info — ghost / text-link style ── */

.more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  font-family: inherit;
  letter-spacing: var(--tracking-wide);


  background: none;
  color: var(--action-primary);
  text-decoration: none;

  /* Animated underline */
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: right bottom;

  transition:
    color var(--duration-fast) var(--ease-standard),
    background-size var(--duration-base) var(--ease-smooth),
    background-position 0s;
}

.more-btn::after {
  content: '→';
  display: inline-block;
  transition: transform var(--duration-base) var(--ease-smooth);
}

.more-btn:hover {
  color: var(--accent-dark);
  background-size: 100% 1.5px;
  background-position: left bottom;
}

.more-btn:hover::after {
  transform: translateX(4px);
}

.more-btn:active {
  color: var(--primary);
}


/* =========================
   RESPONSIVE ADJUSTMENTS
========================= */

@media (max-width: 1024px) {
  .reveal-item {
    min-height: auto;
    margin-bottom: var(--space-6);
    text-align: left;
    /* mobile: left-align */
  }

  .accordion-button {
    flex-direction: row-reverse; /* Icon on the right */
    justify-content: space-between;
    text-align: left;
  }

  .accordion-button>span:last-child {
    text-align: left;
  }

  .accordion-inner {
    padding: var(--space-1) 0 var(--space-3) 0; /* Align text properly under the header */
    text-align: left;
  }
}

@media (max-width: 768px) {
  .reveal-item h2 {
    font-size: var(--heading-3-size);
  }

  .reveal-item .highlight {
    font-size: var(--text-base);
  }

  .accordion-button {
    font-size: var(--text-base);
    padding: var(--space-2) 0;
  }
}


/* =========================
   ACCESSIBILITY
========================= */

.accordion-button:focus-visible {
  outline: 2px solid var(--action-primary);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.more-btn:focus-visible {
  outline: 2px solid var(--text-inverse);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    transition: opacity var(--duration-fast) linear;
    transform: none;
  }

  .accordion-panel {
    transition: height var(--duration-fast) linear;
  }

  .services-media__image {
    transition: opacity var(--duration-fast) linear;
  }
}