/* ==========================================================================
   FORGYEN — The Challenge (homepage section 2)
   Builds on main.css tokens, .btn, .signal-marker. Every rule here is scoped
   to .challenge / .cycle / .insight so the Navbar and Hero are unaffected.
   Structure: 1 Section · 2 Intro · 3 Cycle · 4 Return loop · 5 Insight
              6 Close · 7 Reveal motion · 8 Responsive
   ========================================================================== */

/* 1. Section ------------------------------------------------------------- */
.challenge {
  --ch-surface: #F7EFE7;                       /* champagne, derived from ivory */
  --ch-copper-line: rgba(184, 115, 51, 0.5);
  --ch-gap: 40px;                              /* space between stages (holds the arrow) */
  --ch-icon: 74px;
  --ch-step-h: 92px;
  --ch-step-pad: 10px;

  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: clamp(72px, 9vw, 112px) 0 clamp(96px, 10vw, 136px);
  background:
    radial-gradient(48% 34% at 50% 64%, rgba(233, 176, 128, 0.2), transparent 72%),
    radial-gradient(36% 46% at 100% 18%, rgba(40, 74, 99, 0.06), transparent 70%),
    radial-gradient(36% 46% at 0% 78%, rgba(40, 74, 99, 0.05), transparent 72%),
    linear-gradient(180deg, var(--fg-ivory-soft) 0%, var(--ch-surface) 46%, #F5EBE1 100%);
}

.challenge__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.challenge__arcs {
  width: 100%;
  height: 100%;
  max-width: none;
  fill: none;
  stroke: rgba(11, 19, 32, 0.05);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.challenge__arcs .is-copper { stroke: rgba(184, 115, 51, 0.14); }

.challenge__particle {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #FFE6CC, #E6A066 32%, #A65E26 76%, #6E3A14);
  box-shadow: 0 6px 10px -4px rgba(110, 58, 20, 0.35);
}
.challenge__particle.is-navy {
  width: 7px;
  height: 7px;
  background: radial-gradient(circle at 36% 30%, #A9BCCD, #4C6680 35%, #0B1320);
  box-shadow: none;
}
.challenge__particle--a { left: 9%; top: 66%; }
.challenge__particle--b { right: 11%; top: 76%; width: 13px; height: 13px; }
.challenge__particle--c { left: 15%; top: 69%; }
.challenge__particle--d { right: 12%; top: 3%; width: 9px; height: 9px; }

.challenge__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* 2. Intro --------------------------------------------------------------- */
.challenge__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  padding: 7px 18px 7px 12px;
  border: 1px solid var(--fg-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--fg-navy-800);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.4;
}

.challenge__title {
  margin: 0;
  color: var(--fg-navy-950);
  font-size: clamp(2.125rem, 1.15rem + 2.45vw, 3.5rem);   /* 34 → 56 */
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.032em;
}
.challenge__line { display: block; }
.challenge__accent { color: var(--fg-copper); }

/* 3. Cycle (desktop: one horizontal row) --------------------------------- */
.cycle {
  position: relative;
  /* a touch wider than the text column, as in the approved reference */
  width: min(1360px, calc(100vw - 48px));
  margin-top: clamp(56px, 6vw, 84px);
}

/* faint dotted arc above the row: the cycle's "orbit" */
.cycle__arc {
  position: absolute;
  inset: -44px 6% auto;
  height: 120px;
  border-top: 1.5px dotted rgba(184, 115, 51, 0.32);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  pointer-events: none;
}

.cycle__steps {
  position: relative;
  z-index: 1;
  display: flex;
  gap: var(--ch-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cycle__step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--ch-step-h);
  padding: var(--ch-step-pad) 14px var(--ch-step-pad) var(--ch-step-pad);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 245, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(184, 115, 51, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 34px -24px rgba(90, 58, 32, 0.32);
  text-align: start;
}

/* arrow to the next stage, centred in the gap */
.cycle__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: var(--ch-gap);
  height: 12px;
  translate: 0 -50%;
  background: center / 26px 12px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 12'%3E%3Cpath d='M1 6h22M18 1.5 23.5 6 18 10.5' fill='none' stroke='%23B87333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.cycle__icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--ch-icon);
  height: var(--ch-icon);
  border-radius: 50%;
  background: radial-gradient(circle at 42% 30%, #FFFFFF, #FBF4EE 58%, #F1E3D5);
  box-shadow:
    inset 0 1px 0 #FFFFFF,
    0 0 0 5px rgba(255, 255, 255, 0.45),
    0 10px 22px -12px rgba(90, 58, 32, 0.4);
  color: var(--fg-navy-800);
}
.cycle__icon::after {                      /* fine outer ring */
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(184, 115, 51, 0.12);
}
.cycle__icon svg {
  width: 48%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cycle__step:last-child .cycle__icon { color: var(--fg-copper); }

.cycle__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cycle__num {
  color: var(--fg-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.cycle__label {
  margin-top: 3px;
  color: var(--fg-navy-950);
  font-size: 0.9375rem;                    /* 15px: every label on one line from 1280 */
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
}
.cycle__label::after {                     /* small copper tick */
  content: "";
  display: block;
  width: 18px;
  height: 1.5px;
  margin-top: 8px;
  border-radius: 2px;
  background: rgba(184, 115, 51, 0.6);
}

/* 4. Return loop: Start Again → New Agency ------------------------------- */
.cycle__return {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 26px;
}

.cycle__loop {
  --icon-c: calc(var(--ch-step-pad) + var(--ch-icon) / 2);     /* icon centre from step's left */
  --step-w: calc((100% - 4 * var(--ch-gap)) / 5);
  position: absolute;
  top: -16px;                                                   /* emerges from under the stages */
  left: var(--icon-c);
  width: calc(4 * (var(--step-w) + var(--ch-gap)));
  height: calc(16px + 26px + 19px);                             /* to the label's centre line */
  border: 1.5px dashed var(--ch-copper-line);
  border-top: 0;
  border-radius: 0 0 26px 26px;
  pointer-events: none;
}
/* arrowhead entering New Agency */
.cycle__loop::before {
  content: "";
  position: absolute;
  top: 19px;                                                    /* just below the stage capsule */
  left: -6.5px;
  border: 5.5px solid transparent;
  border-bottom: 8px solid var(--fg-copper);
  border-top: 0;
}
/* origin bead under Start Again */
.cycle__loop::after {
  content: "";
  position: absolute;
  top: 18px;
  right: -4.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-copper);
}

.cycle__loop-label {
  position: relative;
  margin: 0;
  padding: 8px 20px;
  border: 1px solid rgba(184, 115, 51, 0.2);
  border-radius: 999px;
  background: rgba(252, 248, 243, 0.96);
  color: var(--fg-text-muted);
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* 5. Insight: the realisation that breaks the cycle --------------------- */
.insight {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.insight__stem {
  position: relative;
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, rgba(184, 115, 51, 0.15), rgba(184, 115, 51, 0.6));
}
.insight__stem::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  translate: -50% 0;
  background: radial-gradient(circle at 36% 30%, #FFE6CC, #D58E50 45%, #8E5424);
}

.insight__row {
  display: grid;
  grid-template-columns: minmax(24px, 280px) auto minmax(24px, 280px);
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 18px;
}
.insight__rail {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 115, 51, 0.55));
}
.insight__rail--end { background: linear-gradient(90deg, rgba(184, 115, 51, 0.55), transparent); }
.insight__rail::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 22%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  translate: 0 -50%;
  background: radial-gradient(circle at 36% 30%, #FFE6CC, #D58E50 45%, #8E5424);
}
.insight__rail--end::after { right: auto; left: 22%; }

.insight__card {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 26px;
  margin: 0 18px;
  padding: 14px 48px 14px 14px;
  border-radius: 999px;
  border: 1px solid rgba(184, 115, 51, 0.38);
  background: linear-gradient(180deg, #FFFDFB 0%, #FAF2EA 100%);
  box-shadow:
    inset 0 1px 0 #FFFFFF,
    0 0 0 9px rgba(255, 255, 255, 0.4),
    0 0 0 10px rgba(184, 115, 51, 0.12),
    0 26px 52px -30px rgba(140, 84, 36, 0.55);
  text-align: start;
}
/* soft copper light behind the card */
.insight__card::before {
  content: "";
  position: absolute;
  inset: -36px -60px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(233, 166, 108, 0.28), transparent);
}

.insight__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 30%, #FFFFFF, #FBF2EA 60%, #F0DDCB);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 12px 24px -14px rgba(140, 84, 36, 0.5);
  color: var(--fg-copper);
}
.insight__icon svg {
  width: 50%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.insight__text { display: flex; flex-direction: column; }
.insight__kicker {
  color: var(--fg-navy-950);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.3;
}
.insight__word {
  margin-top: 2px;
  color: var(--fg-copper);
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.034em;
  line-height: 1.05;
}

/* 6. Close --------------------------------------------------------------- */
.challenge__close {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(48px, 5vw, 64px);
}
.challenge__statement {
  margin: 0;
  color: var(--fg-navy-950);
  font-size: clamp(1.875rem, 1.1rem + 1.75vw, 2.75rem);   /* 30 → 44 */
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.challenge__support {
  max-width: 36em;
  margin: 18px 0 0;
  color: var(--fg-text-muted);
  font-size: clamp(1rem, 0.92rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  text-wrap: balance;
}
.challenge__close .btn { margin-top: 30px; }

/* 7. Reveal motion (only when JS + motion are available) ---------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal-ready .challenge .cycle__step,
  .reveal-ready .challenge .cycle__arc,
  .reveal-ready .challenge .cycle__return,
  .reveal-ready .challenge .insight,
  .reveal-ready .challenge .challenge__close {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 600ms var(--fg-ease), transform 600ms var(--fg-ease);
  }
  .reveal-ready .challenge .cycle__step::after { opacity: 0; transition: opacity 400ms var(--fg-ease); }
  .reveal-ready .challenge .insight { transform: translateY(14px) scale(0.97); }

  .reveal-ready .challenge.is-visible .cycle__step {
    opacity: 1; transform: none;
    transition-delay: calc(120ms + var(--i) * 110ms);
  }
  .reveal-ready .challenge.is-visible .cycle__step::after {
    opacity: 1;
    transition-delay: calc(320ms + var(--i) * 110ms);
  }
  .reveal-ready .challenge.is-visible .cycle__arc,
  .reveal-ready .challenge.is-visible .cycle__return { opacity: 1; transform: none; transition-delay: 820ms; }
  .reveal-ready .challenge.is-visible .insight {
    opacity: 1; transform: none;
    transition-duration: 760ms;
    transition-delay: 1080ms;
  }
  .reveal-ready .challenge.is-visible .challenge__close { opacity: 1; transform: none; transition-delay: 1280ms; }
}

/* 8. Responsive ---------------------------------------------------------- */

/* Desktop: the headline keeps its two deliberate lines */
@media (min-width: 1100px) {
  .challenge__line { white-space: nowrap; }
}
@media (min-width: 1280px) {
  .cycle__label { white-space: nowrap; }
}

/* Laptop: tighten the row (keeps every label on one line at 1280) */
@media (max-width: 1399px) {
  .challenge { --ch-gap: 34px; --ch-icon: 58px; --ch-step-h: 80px; --ch-step-pad: 8px; }
  .cycle__step { gap: 12px; padding-inline-end: 12px; }
  .cycle__label { font-size: 0.9375rem; }
}

/* Below 1200px: a vertical journey with a wrap-around return loop */
@media (max-width: 1199px) {
  .challenge { --ch-icon: 56px; --ch-step-h: 72px; --ch-step-pad: 8px; --ch-vgap: 30px; }

  .cycle {
    width: 100%;
    max-width: 420px;
    padding-inline: 34px;            /* room for the loop on both sides */
  }
  .cycle__arc { display: none; }

  .cycle__steps { flex-direction: column; gap: var(--ch-vgap); }
  .cycle__step { flex: none; padding-inline-end: 22px; gap: 16px; }
  .cycle__label { font-size: 1.0625rem; }

  /* chevron in a small disc between stages */
  .cycle__step:not(:last-child)::after {
    top: calc(100% + (var(--ch-vgap) - 24px) / 2);
    left: 50%;
    width: 24px;
    height: 24px;
    translate: -50% 0;
    border-radius: 50%;
    background: #FFFCF9 center / 10px 6px no-repeat
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23B87333' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 0 0 1px rgba(184, 115, 51, 0.22), 0 4px 10px -6px rgba(90, 58, 32, 0.4);
  }

  /* the loop wraps the whole column: from Start Again, round, back into New Agency */
  .cycle__return { display: contents; }
  .cycle__loop {
    top: calc(var(--ch-step-h) / 2);
    bottom: 19px;
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    z-index: 0;
    border: 1.5px dashed var(--ch-copper-line);
    border-radius: 22px;
  }
  .cycle__loop::before {               /* arrow entering New Agency from the left */
    top: -6.5px;
    left: 22px;
    border: 5.5px solid transparent;
    border-left: 8px solid var(--fg-copper);
    border-right: 0;
  }
  .cycle__loop::after { top: -4.5px; right: 26px; }

  .cycle__loop-label {
    z-index: 1;
    align-self: center;
    margin-top: 26px;
  }
  .cycle { display: flex; flex-direction: column; }

  .insight__row { grid-template-columns: minmax(16px, 1fr) auto minmax(16px, 1fr); max-width: 560px; }
}

/* Phones */
@media (max-width: 599px) {
  .challenge { --ch-icon: 52px; --ch-step-h: 66px; --ch-step-pad: 7px; --ch-vgap: 26px; }
  .challenge { padding-top: 64px; }

  .challenge__eyebrow { margin-bottom: 22px; font-size: 0.6875rem; letter-spacing: 0.2em; }
  .challenge__title {
    font-size: min(2.125rem, 8.2vw);                       /* 29.5px @360 · 32px @390 */
    line-height: 1.1;
    text-wrap: balance;
  }
  /* let the headline wrap naturally on phones (3 lines, not 5) */
  .challenge__title .challenge__line { display: inline; }
  .challenge__title .challenge__line:first-child::after { content: " "; }
  .cycle { margin-top: 44px; padding-inline: 26px; }
  .cycle__step { gap: 14px; }
  .cycle__label { font-size: 1rem; }
  .cycle__num { font-size: 0.75rem; }
  .cycle__label::after { margin-top: 6px; }
  .cycle__loop::before { left: 14px; }
  .cycle__loop::after { right: 18px; }
  .cycle__loop-label { font-size: 0.875rem; padding: 7px 16px; }

  .insight__stem { height: 26px; }
  .insight__row { margin-top: 14px; }
  .insight__card { gap: 16px; margin: 0 10px; padding: 10px 28px 10px 10px; }
  .insight__icon { width: 62px; height: 62px; }
  .insight__kicker { font-size: 0.875rem; letter-spacing: 0.14em; }
  .insight__word { font-size: 2.125rem; }

  .challenge__close { margin-top: 44px; }
  .challenge__statement { font-size: min(1.875rem, 7.4vw); }
  .challenge__statement .challenge__line { text-wrap: balance; }
  .challenge__support { font-size: 1rem; }
  .challenge__close .btn { width: 100%; max-width: 330px; min-height: 56px; margin-top: 26px; padding-inline: 20px; white-space: nowrap; }

  /* keep particles clear of the loop and copy on phones */
  .challenge__particle--a,
  .challenge__particle--c { display: none; }
  .challenge__particle--b { right: 9%; top: auto; bottom: 2%; width: 11px; height: 11px; }
}
