/* =========================================================
   HOME 07: HOW WE WORK
   File: /assets/css/process-home.css
   Uses shared /assets/js/home-animations.js
   ========================================================= */

:root {
  --process-blue: #083E7F;
  --process-blue-dark: #052F61;
  --process-green: #00A86B;
  --process-green-dark: #008959;

  --process-ink: #172238;
  --process-text: #606B79;

  --process-line: #E5EBF2;
  --process-white: #FFFFFF;

  --process-max: 1220px;
}


/* =========================================================
   SECTION
   ========================================================= */

.emark-process {
  position: relative;
  overflow: hidden;

  padding: 102px 0 104px;

  background:
    linear-gradient(
      180deg,
      #FFFFFF 0%,
      #F8FAFD 100%
    );

  border-bottom: 1px solid var(--process-line);
}


/* =========================================================
   TOP-LEFT DECORATIVE CIRCLES
   ========================================================= */

.emark-process::before {
  content: "";

  position: absolute;

  width: 380px;
  height: 380px;

  left: -180px;
  top: -210px;

  border: 1px solid rgba(8, 62, 127, 0.085);
  border-radius: 50%;

  pointer-events: none;

  z-index: 0;
}


.emark-process::after {
  content: "";

  position: absolute;

  width: 210px;
  height: 210px;

  left: -95px;
  top: -125px;

  border: 1px solid rgba(0, 168, 107, 0.09);
  border-radius: 50%;

  pointer-events: none;

  z-index: 0;
}


/* =========================================================
   CONTAINER
   ========================================================= */

.emark-process__container {
  width: min(
    calc(100% - 40px),
    var(--process-max)
  );

  position: relative;
  z-index: 2;

  margin-inline: auto;
}


/* =========================================================
   HEADING
   ========================================================= */

.emark-process__heading {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    minmax(360px, 0.82fr);

  gap: 40px;

  align-items: center;

  margin-bottom: 50px;
}


.emark-process__eyebrow {
  margin: 0 0 12px;

  color: var(--process-green-dark);

  font-size: 0.75rem;
  font-weight: 800;

  letter-spacing: 0.12em;
  line-height: 1.4;

  text-transform: uppercase;
}


.emark-process h2 {
  max-width: 15ch;

  margin: 0;

  color: var(--process-ink);

  font-size: clamp(
    2.3rem,
    4vw,
    3.6rem
  );

  font-weight: 760;

  letter-spacing: -0.04em;
  line-height: 1.03;

  text-wrap: balance;
}


/*
   Client-requested alignment:
   paragraph remains left aligned,
   but sits slightly higher on desktop.
*/

.emark-process__intro-wrap {
  align-self: center;
}


.emark-process__intro {
  max-width: 520px;

  margin: 0;

  color: var(--process-text);

  font-size: 1rem;
  line-height: 1.75;

  transform: translateY(-14px);
}


/* =========================================================
   PROCESS TRACK
   ========================================================= */

.emark-process__track {
  position: relative;

  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 0;

  padding: 10px 0 4px;
}


/* Horizontal timeline */

.emark-process__track::before {
  content: "";

  position: absolute;

  top: 55px;

  left: 3%;
  right: 3%;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      rgba(8, 62, 127, 0.12),
      rgba(0, 168, 107, 0.28),
      rgba(8, 62, 127, 0.12)
    );

  z-index: 0;

  transform-origin: left center;
}


/* =========================================================
   INDIVIDUAL STEP
   ========================================================= */

.emark-process-step {
  min-height: 275px;

  position: relative;

  padding: 0 25px 12px;

  border-right: 1px solid var(--process-line);
}


.emark-process-step:first-child {
  padding-left: 0;
}


.emark-process-step:last-child {
  padding-right: 0;

  border-right: 0;
}


/* =========================================================
   STEP TOP
   ========================================================= */

.emark-process-step__top {
  min-height: 92px;

  position: relative;

  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  gap: 14px;
}


/* =========================================================
   STEP NUMBER
   ========================================================= */

.emark-process-step__number {
  width: 42px;
  height: 42px;

  position: relative;

  z-index: 2;

  display: grid;
  place-items: center;

  color: var(--process-blue);

  background: var(--process-white);

  border: 1px solid rgba(8, 62, 127, 0.11);
  border-radius: 12px;

  box-shadow:
    0 8px 22px
    rgba(18, 43, 73, 0.05);

  font-size: 0.7rem;
  font-weight: 850;

  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}


@media (hover: hover) and (pointer: fine) {

  .emark-process-step:hover
  .emark-process-step__number {
    transform: translateY(-4px);

    border-color:
      rgba(0, 168, 107, 0.30);

    box-shadow:
      0 13px 30px
      rgba(18, 43, 73, 0.10);
  }

}


/* =========================================================
   TIMELINE DOT
   ========================================================= */

.emark-process-step__dot {
  width: 10px;
  height: 10px;

  position: absolute;

  top: 38px;
  left: 50%;

  z-index: 2;

  background: var(--process-green);

  border: 3px solid var(--process-white);
  border-radius: 50%;

  box-shadow:
    0 0 0 4px
    rgba(0, 168, 107, 0.09);

  transform: translateX(-50%);
}


/* =========================================================
   STEP TEXT
   ========================================================= */

.emark-process-step h3 {
  max-width: 15ch;

  margin: 0 0 12px;

  color: var(--process-ink);

  font-size: 1.2rem;
  font-weight: 760;

  letter-spacing: -0.025em;
  line-height: 1.16;

  transition: color 220ms ease;
}


@media (hover: hover) and (pointer: fine) {

  .emark-process-step:hover h3 {
    color: var(--process-blue);
  }

}


.emark-process-step p {
  max-width: 250px;

  margin: 0;

  color: var(--process-text);

  font-size: 0.9rem;
  line-height: 1.68;
}


/* =========================================================
   GREEN FINISHING LINE
   ========================================================= */

.emark-process-step__line {
  width: 28px;
  height: 2px;

  display: block;

  margin-top: 25px;

  background: var(--process-green);

  border-radius: 999px;

  opacity: 0.72;
}


/* =========================================================
   BOTTOM-RIGHT DECORATION
   ========================================================= */

.emark-process__decor {
  position: absolute;

  right: -30px;
  bottom: -45px;

  width: 240px;
  height: 240px;

  pointer-events: none;

  z-index: 0;

  animation:
    emarkProcessDecorFloat
    10s ease-in-out
    infinite alternate;
}


.emark-process__decor span {
  position: absolute;

  border:
    1px solid
    rgba(8, 62, 127, 0.105);

  border-radius: 50%;
}


.emark-process__decor span:nth-child(1) {
  inset: 0;
}


.emark-process__decor span:nth-child(2) {
  inset: 43px;

  border-color:
    rgba(0, 168, 107, 0.12);
}


.emark-process__decor span:nth-child(3) {
  inset: 88px;

  background:
    rgba(8, 62, 127, 0.045);
}


@keyframes emarkProcessDecorFloat {

  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-11px, -9px, 0);
  }

}


/* =========================================================
   SHARED ANIMATION INTEGRATION
   Uses:
   /assets/js/home-animations.js
   ========================================================= */


/*
   Timeline remains visible normally.
   It is hidden only once JavaScript successfully
   adds reveal-ready to <html>.
*/

html.reveal-ready
.emark-process[data-reveal-section]
.emark-process__track::before {
  transform: scaleX(0);
}


/* Timeline draws when section enters viewport */

html.reveal-ready
.emark-process.is-reveal-active
.emark-process__track::before {
  transform: scaleX(1);

  transition:
    transform
    1000ms
    cubic-bezier(.2, .7, .2, 1)
    180ms;
}


/* =========================================================
   GREEN LINE ANIMATION
   ========================================================= */

/*
   Normal fallback:
   all four green lines are visible if JS is unavailable.
*/

.emark-process-step__line {
  width: 28px;
}


/*
   Prepare line animation only if JS works.
*/

html.reveal-ready
.emark-process[data-reveal-section]
.emark-process-step__line {
  width: 0;
}


/*
   Draw lines after section becomes active.
*/

html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step__line {
  width: 28px;

  transition:
    width
    420ms
    ease;
}


/* Individual line delays */

html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(1)
.emark-process-step__line {
  transition-delay: 500ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(2)
.emark-process-step__line {
  transition-delay: 610ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(3)
.emark-process-step__line {
  transition-delay: 720ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(4)
.emark-process-step__line {
  transition-delay: 830ms;
}


/* =========================================================
   DOT PULSE
   ========================================================= */

html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step__dot {
  animation:
    emarkProcessDotPulse
    700ms ease
    both;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(1)
.emark-process-step__dot {
  animation-delay: 280ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(2)
.emark-process-step__dot {
  animation-delay: 390ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(3)
.emark-process-step__dot {
  animation-delay: 500ms;
}


html.reveal-ready
.emark-process.is-reveal-active
.emark-process-step:nth-child(4)
.emark-process-step__dot {
  animation-delay: 610ms;
}


@keyframes emarkProcessDotPulse {

  0% {
    box-shadow:
      0 0 0 0
      rgba(0, 168, 107, 0.30);
  }

  60% {
    box-shadow:
      0 0 0 10px
      rgba(0, 168, 107, 0);
  }

  100% {
    box-shadow:
      0 0 0 4px
      rgba(0, 168, 107, 0.09);
  }

}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 980px) {

  .emark-process__heading {
    grid-template-columns: 1fr;

    gap: 22px;
  }


  .emark-process__intro-wrap {
    align-self: auto;
  }


  .emark-process__intro {
    max-width: 650px;

    margin: 0;

    transform: none;
  }


  .emark-process__track {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 18px;
  }


  /*
     Desktop timeline is removed on tablet/mobile.
  */

  .emark-process__track::before {
    display: none;
  }


  .emark-process-step {
    min-height: 255px;

    padding: 24px;

    background: var(--process-white);

    border:
      1px solid
      var(--process-line);

    border-radius: 17px;
  }


  .emark-process-step:first-child,
  .emark-process-step:last-child {
    padding: 24px;
  }


  .emark-process-step__top {
    min-height: 68px;
  }


  .emark-process-step__dot {
    top: 16px;

    left: auto;
    right: 0;

    transform: none;
  }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  .emark-process {
    padding: 76px 0 80px;
  }


  .emark-process__container {
    width:
      min(
        calc(100% - 28px),
        var(--process-max)
      );
  }


  .emark-process h2 {
    max-width: 100%;

    font-size:
      clamp(
        2.05rem,
        10.5vw,
        2.9rem
      );
  }


  .emark-process__intro {
    font-size: 0.96rem;

    line-height: 1.7;
  }


  .emark-process__heading {
    margin-bottom: 32px;
  }


  .emark-process__track {
    grid-template-columns: 1fr;

    gap: 12px;
  }


  .emark-process-step {
    min-height: 0;

    padding: 21px;
  }


  .emark-process-step:first-child,
  .emark-process-step:last-child {
    padding: 21px;
  }


  .emark-process-step__top {
    min-height: 61px;
  }


  .emark-process-step p {
    max-width: none;
  }


  /*
     Large decorative circles are unnecessary
     on small screens.
  */

  .emark-process__decor {
    display: none;
  }

}


/* =========================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  /*
     Stop HOME 07's continuous/special animations.
     Normal data-reveal animations are handled by
     animations.css.
  */

  .emark-process__decor,
  .emark-process-step__dot {
    animation: none !important;
  }


  .emark-process-step__number,
  .emark-process-step h3,
  .emark-process__track::before,
  .emark-process-step__line {
    transition: none !important;
  }


  /*
     Do not hide timeline when reduced motion is enabled.
  */

  html.reveal-ready
  .emark-process[data-reveal-section]
  .emark-process__track::before {
    transform: scaleX(1) !important;
  }


  /*
     All four finishing lines stay visible.
  */

  html.reveal-ready
  .emark-process[data-reveal-section]
  .emark-process-step__line {
    width: 28px !important;
  }

}