/* ============================================================
   REVERT — How it works (split: media stage + stepped list)
   Step 1 → looping video. Step 2 → clip-path reveal collage.
   ============================================================ */

@font-face {
  font-family: "Skribblugh";
  src: url("../assets/fonts/Skribblugh-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.hiw {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 96px 24px 72px;
}

/* ---------- heading ---------- */
.hiw-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.hiw-eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 12px;
}
.hiw-head h2 {
  font-family: "Zimula", "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -1.2px;
  color: var(--ink);
}
.hiw-head p {
  margin-top: 14px;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- grid ---------- */
.hiw-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 48px;
  align-items: center;
}

/* ---------- left: media stage ---------- */
.hiw-stage {
  position: relative;
  overflow: visible;
  aspect-ratio: 4 / 3.35;
  background: transparent;
}

.hiw-visual {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease;
  z-index: 1;
}
.hiw-visual.is-active { opacity: 1; visibility: visible; z-index: 2; }

/* ----- step 1: video shown as a phone (full portrait, top to bottom) ----- */
.hiw-visual[data-visual="1"] {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
/* realistic iPhone mockup (PNG with a transparent screen) over the video */
.hiw-phone {
  position: relative;
  height: 94%;
  max-height: 94%;
  aspect-ratio: 887 / 1774;   /* matches the mockup PNG */
  filter: drop-shadow(0 22px 40px rgba(14,24,40,.28));
}
.hiw-phone .phone-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
/* the clip, sitting inside the transparent screen cutout (measured from PNG) */
.hiw-phone video {
  position: absolute;
  left: 9.6%;
  top: 6.7%;
  width: 80.4%;
  height: 86.6%;
  object-fit: cover;
  display: block;
  border-radius: 8% / 4%;
  z-index: 1;
  background: #000;
}

/* ----- shared paper look (steps 2 & 3) ----- */
.hiw-assemble,
.hiw-scatter {
  position: absolute;
  inset: 0;
  background: transparent;
}
.paper {
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(10,20,30,.22), 0 0 0 1px rgba(0,0,0,.05);
  object-fit: cover;
  background: #fff;
  will-change: transform, opacity;
}

/* ----- step 1: hand-written notes with sketchy arrows ----- */
.hiw-notes {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  font-family: "Skribblugh", "Comic Sans MS", cursive;
  color: #27303f;
}
.note { position: absolute; max-width: 30%; }
.note-text {
  display: inline;
  font-size: clamp(14px, 1.75vw, 23px);
  line-height: 1.25;
  letter-spacing: .3px;
}
.note-text::after {   /* blinking pen caret while typing */
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  vertical-align: -0.12em;
  opacity: 0;
}
.note.typing .note-text::after { opacity: 1; animation: notePen .7s steps(1) infinite; }
@keyframes notePen { 50% { opacity: 0; } }

.note-arrow {
  position: absolute;
  width: clamp(58px, 8vw, 108px);
  height: auto;
  overflow: visible;
}
.note-arrow path {
  stroke: #27303f;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* text blocks */
.note-1 { left: 1%; top: 8%; }
.note-2 { left: 0%; top: 62%; }
/* arrows are fixed in place (they never move while the text is typed) */
.arrow-1 { left: 20%; top: 31%; }
.arrow-2 { left: 23%; top: 58%; }

@media (max-width: 880px) { .hiw-notes { display: none; } }

/* ----- step 2: offer pages that assemble into a PDF ----- */
.hiw-assemble .paper { width: 29%; }
.hiw-assemble .p1 { left: 5%;  top: 8%; }
.hiw-assemble .p2 { left: 36%; top: 4%; }
.hiw-assemble .p3 { left: 64%; top: 10%; }
.hiw-assemble .p4 { left: 12%; top: 46%; }
.hiw-assemble .p5 { left: 60%; top: 48%; }

/* ----- step 3: planning sketches, just spread out (no PDF) ----- */
.hiw-scatter .paper { width: 32%; }
.hiw-scatter .s1 { left: 4%;  top: 9%;  transform: rotate(-6deg); z-index: 1; }
.hiw-scatter .s2 { left: 33%; top: 4%;  transform: rotate(3deg);  z-index: 3; }
.hiw-scatter .s3 { left: 62%; top: 11%; transform: rotate(5deg);  z-index: 2; }
.hiw-scatter .s4 { left: 16%; top: 47%; transform: rotate(4deg);  z-index: 4; }
.hiw-scatter .s5 { left: 54%; top: 50%; transform: rotate(-4deg); z-index: 5; }

/* the resulting PDF offer tile (ready-made image, shadow baked in) */
.hiw-pdf {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 440px;
  height: auto;
  aspect-ratio: 1524 / 392;
  display: block;
  z-index: 10;
  opacity: 0;            /* revealed by GSAP */
  pointer-events: none;
}

/* ----- step 4: dashboard clip shown as a floating screen ----- */
.hiw-visual[data-visual="4"] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hiw-screen {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0e0f12;
  box-shadow: 0 22px 50px rgba(14,24,40,.18), 0 0 0 1px rgba(0,0,0,.05);
}
.hiw-screen video {
  width: 100%;
  height: auto;
  display: block;
}

/* placeholder for steps not wired with media yet */
.hiw-placeholder {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1a1c22, #0e0f12);
  color: rgba(255,255,255,.72);
  font-size: 14px;
  letter-spacing: .3px;
}
.hiw-placeholder span {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
}

/* ---------- right: steps ---------- */
.hiw-steps {
  list-style: none;
  position: relative;
  padding-left: 26px;
}
/* the vertical connector line */
.hiw-steps::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
/* the self-filling progress line (driven by scroll) */
.hiw-steps::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  width: 2px;
  height: var(--fill, 0px);
  background: linear-gradient(180deg, var(--green), #15a046);
  border-radius: 2px;
  z-index: 1;
  transition: height var(--fill-dur, .25s) linear;
}

.hiw-step {
  position: relative;
  padding: 18px 16px 18px 22px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .3s ease;
}
.hiw-step + .hiw-step { margin-top: 6px; }
.hiw-step:hover { background: rgba(14,15,18,.03); }

/* node dot — same green as the line, centred on it (intersects the line) */
.hiw-step::before {
  content: "";
  position: absolute;
  left: -23px;            /* centre of the 10px dot sits on the 2px line (x = 8px) */
  top: 26px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  z-index: 2;
}

.hiw-step-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hiw-step-top b {
  font-family: "Zimula", "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 500;
  font-size: 1.12rem;
  letter-spacing: -.3px;
  color: var(--ink-soft);
  transition: color .3s ease;
}
.hiw-step.is-active .hiw-step-top b { color: var(--ink); }

.hiw-when {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(14,15,18,.05);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.hiw-step.is-active .hiw-when { background: rgba(40,206,104,.14); color: #0d7a38; }

.hiw-step p {
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 42ch;
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .hiw { padding: 72px 20px 56px; }
  .hiw-grid { grid-template-columns: 1fr; gap: 32px; }
  .hiw-stage { aspect-ratio: 16 / 11; max-width: 560px; margin: 0 auto; width: 100%; }
  .hiw-steps { padding-left: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-visual.is-active .hiw-collage img { animation: none; clip-path: inset(0 0 0 0); }
}
