/* Featured-image enhancements for StatsAlly. Mobile-first by design. */
.hero-visual {
  position: relative;
  width: min(100%, 560px);
  margin-inline: auto;
}

.hero-media,
.page-hero-media {
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  background: #e5f4ef;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(16, 42, 67, .10);
}

.hero-media {
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 24px;
}

.page-hero-media {
  border: 1px solid rgba(8, 115, 106, .12);
}

.hero-media-image,
.page-hero-media-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-visual-card {
  position: relative;
  z-index: 2;
  margin: -1.25rem .75rem 0;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, .97);
  border: 1px solid #d9e2ec;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(16, 42, 67, .14);
}

.hero-visual-card strong {
  display: block;
  margin-top: .55rem;
  line-height: 1.4;
}

.page-hero-grid {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.page-hero-copy {
  max-width: 760px;
}

/* Team portraits use a consistent mobile-first 4:5 crop. */
.team-avatar {
  min-height: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.team-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

@media (min-width: 981px) {
  .hero-visual-card {
    position: absolute;
    right: -.8rem;
    bottom: 1.25rem;
    width: min(78%, 360px);
    margin: 0;
  }

  .page-hero-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    gap: clamp(2rem, 5vw, 4.5rem);
  }

  .page-hero-media {
    width: 100%;
    justify-self: end;
  }
}

/* Process, sequence, and decision-path enhancements. */
.hero-decision-map {
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.98), rgba(245,249,248,.96));
}

.hero-decision-map::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -80px;
  bottom: -100px;
  background: radial-gradient(circle, rgba(239,169,40,.2), transparent 68%);
  pointer-events: none;
}

.map-node,
.map-result,
.map-options {
  position: relative;
  z-index: 1;
}

.map-node {
  background: linear-gradient(135deg, var(--surface-3), #f4fbf9);
  border-color: #c5e5df;
}

.map-result {
  background: linear-gradient(135deg, var(--ink), #184e62);
  box-shadow: 0 12px 28px rgba(16,42,67,.16);
}

.map-branches {
  position: relative;
  height: 32px;
}

.map-branches::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 14px;
  background: var(--brand);
  transform: translateX(-50%);
}

.map-branches::after {
  content: "";
  position: absolute;
  top: 13px;
  left: 16.66%;
  right: 16.66%;
  height: 2px;
  background: var(--brand);
}

.map-branches i,
.map-branches i:last-child {
  position: relative;
  border: 0;
}

.map-branches i::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 13px;
  left: 50%;
  width: 2px;
  height: 19px;
  background: var(--brand);
  transform: translateX(-50%);
}

.map-options span {
  color: #5b4616;
  border-color: #efd493;
  box-shadow: 0 6px 16px rgba(91,70,22,.06);
}

/* Homepage four-step process: connected on desktop, vertical on smaller screens. */
.grid.grid-4:has(> .process-card) {
  position: relative;
  isolation: isolate;
}

.grid.grid-4:has(> .process-card)::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 2.62rem;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, rgba(8,115,106,.2), var(--brand) 18%, var(--brand) 82%, rgba(8,115,106,.2));
  pointer-events: none;
}

.process-card {
  position: relative;
  z-index: 1;
  overflow: visible;
  padding-top: 5.3rem;
  background: linear-gradient(180deg, var(--surface-2) 0 4.7rem, #fff 4.7rem);
}

.process-card h3 {
  margin-top: .15rem;
}

.step-number {
  z-index: 3;
  width: 46px;
  height: 46px;
  color: white;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  border: 4px solid white;
  box-shadow: 0 0 0 1px rgba(8,115,106,.18), 0 7px 16px rgba(8,115,106,.2);
  font-variant-numeric: tabular-nums;
}

.grid.grid-4:has(> .process-card) .step-number {
  left: 50%;
  transform: translateX(-50%);
}

/* Reusable three-column decision tables now read as grouped decision chains. */
.decision-matrix {
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(16,42,67,.05);
}

.decision-matrix > div {
  background: white;
  border: 0;
}

.decision-matrix > div:nth-child(3n+1):not(.matrix-head) {
  color: var(--brand-dark);
  background: linear-gradient(135deg, var(--surface-3), #f5fbf9);
  font-weight: 850;
}

.decision-matrix .matrix-head {
  background: linear-gradient(135deg, var(--ink), #184e62);
  font-size: .78rem;
  letter-spacing: .07em;
}

/* Short reasoning chains use a continuous rail instead of loose arrow pills. */
.judgment-path {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: .7rem;
  align-items: center;
  padding: 1rem 0;
}

.judgment-path::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 7%;
  right: 7%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, rgba(239,169,40,.25), var(--accent), rgba(239,169,40,.25));
  transform: translateY(-50%);
}

.judgment-path span {
  position: relative;
  z-index: 1;
  padding: .7rem .65rem;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  text-align: center;
}

.judgment-path b {
  display: none;
}

.decision-graphic {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  align-items: stretch;
  padding: 1.25rem;
  background: linear-gradient(160deg, #fff, var(--surface-2));
  counter-reset: decision-step;
}

.decision-graphic::before {
  content: none;
}

.decision-graphic span {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  gap: .55rem;
  align-items: center;
  justify-content: flex-start;
  padding: .8rem;
  background: white;
  border: 1px solid #c7e3de;
  border-radius: 10px;
  box-shadow: 0 7px 18px rgba(8,115,106,.07);
  text-align: left;
}

.decision-graphic span::before {
  counter-increment: decision-step;
  content: counter(decision-step);
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 900;
}

.decision-graphic i {
  display: none;
}

/* Small ordered examples get a real vertical connector. */
.mini-flow li {
  padding: .78rem .8rem .78rem 3rem;
  margin-bottom: .6rem;
  background: linear-gradient(135deg, var(--surface-2), #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mini-flow li::before {
  z-index: 2;
  left: .7rem;
  top: .72rem;
  width: 1.55rem;
  height: 1.55rem;
  border: 3px solid white;
  box-shadow: 0 0 0 1px rgba(8,115,106,.15);
}

.mini-flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 1.46rem;
  top: 2.25rem;
  bottom: -.7rem;
  width: 2px;
  background: #b8dcd6;
}

/* How-it-works main stages become a clear vertical workflow. */
.engagement-steps {
  gap: 1.35rem;
  max-width: 980px;
  margin-inline: auto;
}

.engagement-steps .card {
  position: relative;
  overflow: visible;
  grid-template-columns: 58px 1fr;
  gap: 1.15rem;
  padding: 1.45rem 1.5rem 1.45rem 1.2rem;
  background: linear-gradient(135deg, #fff, var(--surface-2));
  border-color: #cfdde5;
}

.engagement-steps .card:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 2.64rem;
  top: 4.3rem;
  bottom: -1.4rem;
  width: 2px;
  background: linear-gradient(var(--brand), #b8dcd6);
}

.engagement-steps .step-number {
  position: relative;
  z-index: 2;
  left: auto;
  top: auto;
  align-self: start;
}

.engagement-steps h2 {
  margin-bottom: .75rem;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
}

.engagement-steps h3 {
  margin: .9rem 0 .2rem;
  color: var(--brand-dark);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* The 8-stop example flow is a true timeline; arrow text is decorative. */
.study-timeline {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(8,minmax(0,1fr));
  gap: .35rem;
  padding: 1.2rem .25rem .25rem;
}

.study-timeline::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 1.75rem;
  left: 6.25%;
  right: 6.25%;
  height: 2px;
  background: linear-gradient(90deg, #b8dcd6, var(--brand), #b8dcd6);
}

.study-timeline > a,
.study-timeline > span:nth-child(7) {
  position: relative;
  z-index: 1;
  display: block;
  padding: 2.35rem .45rem .75rem;
  color: var(--ink);
  background: transparent;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}

.study-timeline > a::before,
.study-timeline > span:nth-child(7)::before {
  content: "";
  position: absolute;
  top: .22rem;
  left: 50%;
  width: 18px;
  height: 18px;
  background: white;
  border: 5px solid var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--surface);
  transform: translateX(-50%);
}

.study-timeline > a:hover {
  color: var(--brand-dark);
}

.study-timeline > a:hover::before {
  background: var(--accent);
  border-color: var(--brand-dark);
}

.study-timeline > span:not(:nth-child(7)) {
  display: none;
}

@media (max-width: 980px) {
  .grid.grid-4:has(> .process-card) {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .grid.grid-4:has(> .process-card)::before {
    top: 1.3rem;
    bottom: 1.3rem;
    left: 2.65rem;
    right: auto;
    width: 2px;
    height: auto;
    background: linear-gradient(var(--brand), rgba(8,115,106,.15));
  }

  .process-card {
    min-height: 0;
    padding: 1.45rem 1.5rem 1.45rem 5rem;
    background: linear-gradient(90deg, var(--surface-2) 0 4.25rem, #fff 4.25rem);
  }

  .grid.grid-4:has(> .process-card) .step-number {
    left: 1.2rem;
    top: 1.35rem;
    transform: none;
  }

  .study-timeline {
    grid-template-columns: 1fr;
    gap: .2rem;
    padding: 0;
  }

  .study-timeline::before {
    top: 1rem;
    bottom: 1rem;
    left: 1.2rem;
    right: auto;
    width: 2px;
    height: auto;
  }

  .study-timeline > a,
  .study-timeline > span:nth-child(7) {
    min-height: 3.2rem;
    padding: .75rem .8rem .75rem 3rem;
    text-align: left;
  }

  .study-timeline > a::before,
  .study-timeline > span:nth-child(7)::before {
    top: 1.02rem;
    left: 1.2rem;
    width: 16px;
    height: 16px;
    border-width: 4px;
    box-shadow: 0 0 0 3px var(--surface);
  }

  .judgment-path {
    grid-template-columns: 1fr;
    gap: .55rem;
    padding-left: 2.4rem;
  }

  .judgment-path::before {
    top: .7rem;
    bottom: .7rem;
    left: 1rem;
    right: auto;
    width: 2px;
    height: auto;
    transform: none;
  }

  .judgment-path span {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .decision-matrix {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .decision-matrix > div {
    border: 1px solid var(--line);
    border-bottom: 0;
  }

  .decision-matrix > div:nth-child(3n+1):not(.matrix-head) {
    margin-top: .9rem;
    border-radius: 10px 10px 0 0;
  }

  .decision-matrix > div:nth-child(3n) {
    margin-bottom: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
  }

  .decision-matrix > div:nth-child(3n+1)::before {
    content: none;
  }

  .decision-graphic {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .decision-graphic::before {
    content: none;
  }

  .decision-graphic span {
    min-height: 3rem;
    padding: .8rem;
    text-align: left;
  }

  .map-branches {
    display: none;
  }

  .engagement-steps .card {
    grid-template-columns: 52px minmax(0,1fr);
    gap: .9rem;
    padding-right: 1.1rem;
  }

  .engagement-steps .card:not(:last-child)::after {
    left: 2.5rem;
  }
}
