/* Services */

/* Structure mirrors the home page: a brand-colored header + hero, then
   sections with alternating backgrounds — dark (offerings), light band
   (selected works, CTA) and brand-colored (process, same as the header).
   The light CTA band continues into the light footer. Band colors and the
   header/footer come from the shared "banded" pattern in layout.css
   (the page opts in via body_class). */

.main:has(.services-page) {
  min-height: 0;
}

.services-page {
  --services-space-section: clamp(2rem, 3vw, 2.5rem);
  --media-section-space-y: var(--services-space-section);
  min-width: 0;
  overflow-x: clip;
}

.services-page .page-hero {
  background-color: var(--color-brand);
  border-bottom: 0;
}

.offerings-section,
.process-timeline-section {
  padding: var(--services-space-section) 0;
}

/* Light band with light-theme colors, regardless of the site theme */

.services-page .media-section--theme-band {
  border-top: 0;
  background-color: var(--home-band-bg);

  /* Re-theme cards for the light band (dark theme is forced site-wide) */
  --color-surface: #f8fafc;
  --color-surface-muted: #e8f0fe;
  --color-border: #e2e8f0;
  --color-border-strong: #1a1a1a;
  --color-text: #1a1a1a;
  --color-text-muted: #4b5563;
}

.services-page .media-section--theme-band .media-section__title {
  color: var(--home-band-title-color);
}

.services-page .media-card {
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.08),
    0 1px 4px rgba(15, 23, 42, 0.05);
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-fast);
}

.services-page .media-card:has(.media-card__link:hover),
.services-page .media-card:has(.media-card__link:focus-visible) {
  border-color: var(--home-band-title-color);
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.12),
    0 2px 8px rgba(15, 23, 42, 0.07);
}

/* Process timeline on the brand-colored band (same as the header):
   markers and the belt traveler stay visible on it */

.services-page .process-timeline-section {
  background-color: var(--color-brand);
}

.services-page .process-timeline__marker,
.services-page .process-timeline__traveler {
  background-color: var(--color-bg);
}

/* Final CTA on the light band continuing into the footer */

.services-cta {
  padding: var(--services-space-section) 0;
}

.services-cta .cta-block--final {
  margin-top: 0;
}

/* Brand-colored, roomier CTA button on the light band */

.services-cta .cta-block .button {
  min-height: 3.25rem;
  padding: 0.875rem 2.75rem;
  font-size: var(--text-base);
}

.services-cta .cta-block .button--filled,
.services-cta .cta-block .button--filled:hover {
  color: #ffffff;
  background-color: var(--color-brand);
  border-color: var(--color-brand);
}

.services-cta .cta-block .button--filled:hover {
  background-color: var(--color-brand-deep);
  border-color: var(--color-brand-deep);
}

.offerings-section__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.services-card {
  display: flex;
  flex-direction: column;
  cursor: default;
}

.services-card__icon {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.875rem;
  color: var(--color-text);
  flex-shrink: 0;
}

.services-card:hover,
.services-card:focus-within {
  border-color: var(--color-text-muted);
}

.services-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-top: auto;
  padding-top: 1rem;
}

.services-card__cta {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-body);
  text-decoration: none;
  color: var(--color-link);
  background: none;
  border: 0;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.services-card__cta:hover {
  color: var(--color-link-hover);
  text-decoration: none;
}

.services-card__cta:focus-visible {
  outline: 2px solid var(--color-border-strong);
  outline-offset: 2px;
  text-decoration: none;
}

.process-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* Timeline geometry vars live on the wrap so the belt travelers (siblings
   of the <ol>) inherit them too. The cycle is 8s: a traveler rides the
   belt during the first 75% of it, so the next one (offset by half a
   cycle) appears right when the previous one passes step 3 */

.process-timeline-wrap {
  --timeline-marker-size: 2.25rem;
  --process-cycle: 8s;
  position: relative;
}

.process-timeline__step {
  display: grid;
  grid-template-columns: var(--timeline-marker-size) minmax(0, 1fr);
  gap: 0 1.25rem;
  min-width: 0;
}

.process-timeline__track {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--timeline-marker-size);
  padding-top: 0.375rem;
}

.process-timeline__marker {
  position: relative;
  z-index: 1;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: var(--timeline-marker-size);
  height: var(--timeline-marker-size);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: var(--card-border-width) solid var(--color-border-strong);
  border-radius: 50%;
}

/* Conveyor belt: dashed segments connect the numbered markers, and a
   traveler rides the belt — it starts as a lightbulb (idea), turns into
   a document after passing step 2 and into code after step 3, then loops */

.process-timeline__step:not(:last-child) .process-timeline__track::after {
  content: "";
  flex: 1;
  width: 0;
  margin-top: 0.375rem;
  border-left: var(--card-border-width) dashed var(--color-border-strong);
}

.process-timeline__traveler {
  position: absolute;
  top: calc(0.375rem + var(--timeline-marker-size) / 2);
  left: calc(var(--timeline-marker-size) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: var(--card-border-width) solid var(--color-border-strong);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: process-belt-travel-y var(--process-cycle) linear infinite;
  pointer-events: none;
}

/* Second traveler, half a cycle behind: it appears at the start of the
   belt when the first one passes step 3. Travelers ride above the belt
   but under the numbered markers (markers have z-index: 1) */

.process-timeline__traveler--next,
.process-timeline__traveler--next .process-timeline__traveler-icon {
  animation-delay: calc(var(--process-cycle) / -2);
}

.process-timeline__traveler-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  opacity: 0;
  animation: var(--process-cycle) linear infinite;
}

.process-timeline__traveler-icon--idea {
  animation-name: process-belt-icon-idea;
}

.process-timeline__traveler-icon--doc {
  animation-name: process-belt-icon-doc;
}

.process-timeline__traveler-icon--code {
  animation-name: process-belt-icon-code;
}

/* Mobile: the belt is vertical, the traveler rides top to bottom. The
   journey takes the first 75% of the cycle; the traveler stays hidden
   for the rest, until the loop restarts it. Markers sit at thirds of
   the track (cards are near-equal height), so the icon swaps at 25% and
   50% of the cycle stay in sync with steps 2 and 3 */

@keyframes process-belt-travel-y {
  0% {
    top: calc(0.375rem + var(--timeline-marker-size) / 2);
    opacity: 0;
  }

  3.75% {
    opacity: 1;
  }

  71.25% {
    opacity: 1;
  }

  75%,
  100% {
    top: 82%;
    opacity: 0;
  }
}

/* Icon swaps are synced to the traveler passing markers 2 and 3
   (1/3 and 2/3 of the journey = 25% and 50% of the cycle) */

@keyframes process-belt-icon-idea {
  0%,
  22.5% {
    opacity: 1;
  }

  27.5%,
  100% {
    opacity: 0;
  }
}

@keyframes process-belt-icon-doc {
  0%,
  22.5% {
    opacity: 0;
  }

  27.5%,
  47.5% {
    opacity: 1;
  }

  52.5%,
  100% {
    opacity: 0;
  }
}

@keyframes process-belt-icon-code {
  0%,
  47.5% {
    opacity: 0;
  }

  52.5%,
  100% {
    opacity: 1;
  }
}

@keyframes process-belt-travel-x {
  0% {
    left: 12.5%;
    opacity: 0;
  }

  3.75% {
    opacity: 1;
  }

  71.25% {
    opacity: 1;
  }

  75%,
  100% {
    left: 87.5%;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .process-timeline__traveler {
    display: none;
  }
}

.process-timeline__content {
  margin-bottom: 1.25rem;
}

.process-timeline__step:last-child .process-timeline__content {
  margin-bottom: 0;
}

.process-timeline__content p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--line-height-snug);
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .offerings-section__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .process-timeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.625rem, 1.2vw, 1rem);
  }

  .process-timeline__step {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .process-timeline__track {
    flex-direction: row;
    justify-content: center;
    width: auto;
    padding-top: 0;
  }

  /* Desktop: the belt runs horizontally through the marker centers
     (columns are equal, so markers sit at 12.5/37.5/62.5/87.5%) */

  .process-timeline__step:not(:last-child) .process-timeline__track::after {
    content: none;
  }

  .process-timeline__belt {
    position: absolute;
    top: calc(var(--timeline-marker-size) / 2);
    left: 12.5%;
    right: 12.5%;
    border-top: var(--card-border-width) dashed var(--color-border-strong);
    pointer-events: none;
  }

  .process-timeline__traveler {
    top: calc(var(--timeline-marker-size) / 2);
    animation-name: process-belt-travel-x;
  }

  .process-timeline__content {
    margin-bottom: 0;
    height: 100%;
  }
}

@media (min-width: 1200px) {
  .offerings-section__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
