/* =============================================================================
   CALIBER — How It Works                                  assets/caliber-hiw.css

   Four numbered steps, each with an illustrative example built from interface
   components (not screenshots). Desktop: steps on the left, the selected step's
   explanation + example on the right, one fixed-size stage so nothing shifts.
   Mobile: an accordion, first step open, example directly under its text.
   Without JavaScript: every step and example stacked, finished state.

   Motion: each example plays once, the first time its step is open and on
   screen, then holds its finished state. No auto-advance, no loops. A replay
   control re-runs it. Reduced motion: finished examples, no movement.
   ========================================================================== */

.hiw {
  --hc-ink: #0B0D10; --hc-ivory: #F5F1E8; --hc-gold: #E6C681; --hc-gold-hi: #F3DCA6; --hc-gold-lo: #B98C49;
  --hc-violet: #8857C3; --hc-plum: #4D2970; --hc-lav: #BDA0E3;
  --hc-muted: #C6C2CE; --hc-panel: #15171D; --hc-panel-2: #101217; --hc-line: rgba(230, 198, 129, .18);
  --hc-stage-h: 456px;
  position: relative;
  margin-top: 8px;
}
.hiw-intro {
  max-width: 60ch; margin: -12px auto 34px; text-align: center;
  font-size: 17px; line-height: 1.6; color: var(--hc-muted);
}

/* ---- step headings (buttons once enhanced) --------------------------------- */
.hiw-head { margin: 0; font: inherit; }
/* The step heading is an <h3>; the script moves its contents into a <button>.
   Without the script the heading itself takes the same row layout. */
.hiw-btn, .hiw:not(.is-enhanced) .hiw-head {
  display: grid; grid-template-columns: 44px 1fr 18px; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 12px 16px; text-align: left;
  font: 700 19px/1.15 var(--font-head, Rajdhani, sans-serif); letter-spacing: .02em; text-transform: uppercase;
  color: var(--hc-ivory); background: transparent; border: 1px solid transparent; border-radius: 14px;
}
.hiw:not(.is-enhanced) .hiw-num { color: #14110B; border-color: var(--hc-gold-lo); background: var(--hc-gold); }
.hiw.is-enhanced .hiw-btn { cursor: pointer; transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.hiw-num {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  font: 700 20px/1 var(--font-head, Rajdhani, sans-serif); color: var(--hc-muted);
  border: 1.5px solid rgba(198, 194, 206, .35); background: rgba(21, 23, 29, .9);
}
.hiw-title { min-width: 0; }
.hiw-chev { width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); opacity: .6; justify-self: end; margin-top: -4px; transition: transform .2s ease; }
.hiw:not(.is-enhanced) .hiw-chev { display: none; }
.hiw-btn[aria-expanded="true"] .hiw-chev { transform: rotate(-135deg); margin-top: 4px; }

/* the active step: gold number, clear heading, restrained violet edge glow */
.hiw-btn[aria-expanded="true"] {
  background: linear-gradient(180deg, rgba(23, 25, 32, .96), rgba(16, 18, 23, .98));
  border-color: rgba(189, 160, 227, .30);
  box-shadow: inset 3px 0 0 var(--hc-gold), 0 0 0 1px rgba(136, 87, 195, .12), 0 0 26px -10px rgba(136, 87, 195, .55);
}
.hiw-btn[aria-expanded="true"] .hiw-num {
  color: #14110B; border-color: var(--hc-gold-lo);
  background: linear-gradient(180deg, var(--hc-gold-hi), var(--hc-gold) 55%, var(--hc-gold-lo));
  box-shadow: 0 0 18px -4px rgba(230, 198, 129, .55);
}
.hiw.is-enhanced .hiw-btn:hover:not([aria-expanded="true"]) { background: rgba(230, 198, 129, .05); border-color: var(--hc-line); }
.hiw-btn:focus-visible { outline: 2px solid #A47BDB; outline-offset: 3px; }
/* A legacy home rule sets every button's border-color with !important ((0,2,1));
   [type] lifts these to (0,3,0) so the steps keep their own edges. */
.hiw .hiw-btn[type] { border-color: rgba(230, 198, 129, .13) !important; background-color: rgba(21, 23, 29, .55); }
.hiw.is-enhanced .hiw-btn[type]:hover:not([aria-expanded="true"]) { border-color: rgba(230, 198, 129, .3) !important; }
.hiw .hiw-btn[type][aria-expanded="true"] { border-color: rgba(189, 160, 227, .34) !important; }
.hiw .hiw-replay[type] { border-color: transparent !important; }
.hiw .hiw-replay[type]:hover { border-color: rgba(230, 198, 129, .3) !important; }

/* ---- panel: explanation (real text) + example --------------------------------- */
.hiw-pane { padding: 4px 0 18px; }
.hiw-desc { margin: 0 0 14px; font-size: 16.5px; line-height: 1.6; color: var(--hc-ivory); }
.hiw-note { margin: 12px 0 0; font-size: 14px; line-height: 1.55; color: var(--hc-muted); }
.hiw-note strong { color: var(--hc-gold); font-weight: 600; }

.hiw-demo {
  position: relative; margin: 0; padding: 40px 18px 18px; border-radius: 18px;
  border: 1px solid var(--hc-line);
  background:
    radial-gradient(70% 60% at 80% 0%, rgba(136, 87, 195, .16), transparent 70%),
    linear-gradient(180deg, rgba(18, 20, 26, .96), rgba(11, 13, 16, .98));
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(77, 41, 112, .25);
  overflow: hidden;
}
.hiw-tag {
  position: absolute; top: 12px; left: 16px;
  font: 600 10.5px/1 var(--font-body, Inter, sans-serif); letter-spacing: .16em; text-transform: uppercase; color: var(--hc-lav);
  padding: 5px 9px; border: 1px solid rgba(189, 160, 227, .3); border-radius: 999px; background: rgba(77, 41, 112, .25);
}
.hiw-replay {
  position: absolute; top: 8px; right: 10px; min-height: 32px; padding: 6px 12px;
  font: 600 12.5px/1 var(--font-body, Inter, sans-serif); color: var(--hc-gold);
  background: transparent; border: 1px solid transparent; border-radius: 999px; cursor: pointer; display: none;
}
.hiw.is-enhanced .hiw-replay { display: inline-flex; align-items: center; gap: 6px; }
.hiw-replay:hover { border-color: var(--hc-line); background: rgba(230, 198, 129, .06); }
.hiw-replay:focus-visible { outline: 2px solid #A47BDB; outline-offset: 2px; }
.hiw-replay::before { content: ""; width: 10px; height: 10px; border: 1.6px solid currentColor; border-left-color: transparent; border-radius: 50%; }

/* ---- shared mock components ------------------------------------------------------ */
.hc-box { border: 1px solid rgba(255, 255, 255, .07); border-radius: 14px; background: rgba(21, 23, 29, .92); padding: 14px; }
.hc-row { display: flex; align-items: center; gap: 12px; }
.hc-label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--hc-gold); }
.hc-value { font-size: 14.5px; color: var(--hc-ivory); }
.hc-sub { font-size: 13px; color: var(--hc-muted); }
.hc-ok {
  flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(230, 198, 129, .14); border: 1px solid rgba(230, 198, 129, .5);
}
.hc-ok::after { content: ""; width: 8px; height: 4px; border-left: 2px solid var(--hc-gold); border-bottom: 2px solid var(--hc-gold); transform: rotate(-45deg) translate(1px, -1px); }
.hc-chip { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; color: var(--hc-ivory);
  border: 1px solid rgba(189, 160, 227, .3); background: rgba(136, 87, 195, .12); }
.hc-stack { display: grid; gap: 10px; }

/* 1 · profile */
.hc-avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  font: 700 16px/1 var(--font-head, Rajdhani, sans-serif); color: #14110B; background: linear-gradient(180deg, var(--hc-gold-hi), var(--hc-gold-lo)); }
.hc-name { font-weight: 600; font-size: 15.5px; color: var(--hc-ivory); }
.hc-field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  background: rgba(11, 13, 16, .7); border: 1px solid rgba(255, 255, 255, .06); }
.hc-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hc-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(230, 198, 129, .35); background: rgba(230, 198, 129, .04); }
.hc-file .hc-ok, .hc-meter-row .hc-ok { margin-left: auto; }
.hc-pdf { flex: none; width: 32px; height: 38px; border-radius: 4px; background: linear-gradient(180deg, #2A2C34, #1B1D23); border: 1px solid rgba(255,255,255,.12);
  display: grid; place-items: end center; padding-bottom: 4px; font: 700 10.5px/1 var(--font-body, Inter, sans-serif); color: var(--hc-lav); }
.hc-meter-row { justify-content: space-between; margin-bottom: 8px; }
.hc-meter { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.hc-meter i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hc-gold-lo), var(--hc-gold-hi)); }

/* 2 · matches */
.hc-jobs { display: grid; gap: 12px; }
.hc-job-title { font-weight: 600; font-size: 15.5px; color: var(--hc-ivory); }
.hc-reasons { display: grid; gap: 6px; margin-top: 10px; }
.hc-reason { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--hc-muted); }
.hc-reason .hc-ok { width: 18px; height: 18px; }

/* 3 · apply */
.hc-apply-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.hc-badge { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #9DE6BF;
  padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(101, 219, 160, .35); background: rgba(101, 219, 160, .08); }
.hc-input { position: relative; padding: 9px 12px; border-radius: 10px; background: rgba(11, 13, 16, .75); border: 1px solid rgba(255, 255, 255, .08); }
.hc-input .hc-label { display: block; margin-bottom: 3px; color: #A39DAD; letter-spacing: .08em; }
.hc-input .hc-value { display: block; white-space: nowrap; overflow: hidden; }
.hc-progress { margin-top: 12px; }
.hc-progress .hc-meter i { width: 72%; }
.hc-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13.5px; color: var(--hc-gold-hi);
  padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(230, 198, 129, .35); background: rgba(230, 198, 129, .07); }
.hc-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hc-gold); box-shadow: 0 0 10px var(--hc-gold); }

/* 4 · receipt */
.hc-receipt { position: relative; padding: 18px; width: 100%; max-width: 460px; margin-inline: auto; }
.hc-receipt-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.hc-seal { position: relative; flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, #FBEFD0, var(--hc-gold) 52%, var(--hc-gold-lo)); box-shadow: 0 0 0 4px rgba(136, 87, 195, .18), 0 0 26px rgba(136, 87, 195, .45); }
.hc-seal::after { content: ""; width: 16px; height: 8px; border-left: 3px solid #14110B; border-bottom: 3px solid #14110B; transform: rotate(-45deg) translate(1px, -2px); }
.hc-seal-ring { position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--hc-lav); opacity: 0; pointer-events: none; }
.hc-receipt-title { font: 700 20px/1.1 var(--font-head, Rajdhani, sans-serif); text-transform: uppercase; letter-spacing: .02em; color: var(--hc-ivory); }
.hc-kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.hc-kv dt { color: #A39DAD; } .hc-kv dd { margin: 0; color: var(--hc-ivory); }
.hc-ref { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; color: var(--hc-gold-hi); }

/* ---- motion: plays only while .is-playing; the base styles are the finished state ---- */
@keyframes hc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes hc-resolve { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes hc-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes hc-fill { from { width: 0; } }
@keyframes hc-pop { 0% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.08); } 100% { transform: none; } }
@keyframes hc-ring { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.9); } }

.hiw-demo.is-playing .hc-seq { animation: hc-rise .42s cubic-bezier(.2, .8, .3, 1) both; }
.hiw-demo.is-playing .hc-seq.s1 { animation-delay: .05s; } .hiw-demo.is-playing .hc-seq.s2 { animation-delay: .3s; }
.hiw-demo.is-playing .hc-seq.s3 { animation-delay: .55s; } .hiw-demo.is-playing .hc-seq.s4 { animation-delay: .8s; }
.hiw-demo.is-playing .hc-seq.s5 { animation-delay: 1.05s; } .hiw-demo.is-playing .hc-seq.s6 { animation-delay: 1.3s; }
.hiw-demo.is-playing .hc-meter i { animation: hc-fill .9s cubic-bezier(.3, .7, .3, 1) 1.2s both; }

.hiw-demo.is-playing .hc-resolve { animation: hc-resolve .6s cubic-bezier(.2, .8, .3, 1) both; }
.hiw-demo.is-playing .hc-resolve.s2 { animation-delay: .32s; }
.hiw-demo.is-playing .hc-resolve .hc-reason { animation: hc-rise .35s ease both; animation-delay: .7s; }
.hiw-demo.is-playing .hc-resolve.s2 .hc-reason { animation-delay: 1s; }

.hiw-demo.is-playing .hc-input .hc-value { animation: hc-type .5s steps(18, end) both; }
.hiw-demo.is-playing .hc-input.f1 .hc-value { animation-delay: .1s; } .hiw-demo.is-playing .hc-input.f2 .hc-value { animation-delay: .55s; }
.hiw-demo.is-playing .hc-input.f3 .hc-value { animation-delay: 1s; } .hiw-demo.is-playing .hc-input.f4 .hc-value { animation-delay: 1.45s; }
.hiw-demo.is-playing .hc-progress .hc-meter i { animation: hc-fill 1.8s cubic-bezier(.3, .7, .3, 1) .1s both; }
.hiw-demo.is-playing .hc-status { animation: hc-rise .4s ease 1.9s both; }

.hiw-demo.is-playing .hc-receipt { animation: hc-resolve .55s cubic-bezier(.2, .8, .3, 1) both; }
.hiw-demo.is-playing .hc-seal { animation: hc-pop .5s cubic-bezier(.2, .8, .3, 1) .45s both; }
.hiw-demo.is-playing .hc-seal-ring { animation: hc-ring .8s ease-out .7s both; }
.hiw-demo.is-playing .hc-kv { animation: hc-rise .4s ease .7s both; }

/* ---- desktop: steps left, one fixed stage right ---------------------------------- */
@media (min-width: 900px) {
  .hiw.is-enhanced {
    display: grid; grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr);
    /* rows 1 and 6 absorb the slack so the step list sits centred beside the stage */
    grid-template-rows: 1fr repeat(4, auto) 1fr; column-gap: clamp(28px, 4vw, 56px); row-gap: 12px; align-items: start;
  }
  .hiw.is-enhanced .hiw-step { display: contents; }
  .hiw.is-enhanced .hiw-step:nth-child(1) .hiw-head { grid-row: 2; }
  .hiw.is-enhanced .hiw-step:nth-child(2) .hiw-head { grid-row: 3; }
  .hiw.is-enhanced .hiw-step:nth-child(3) .hiw-head { grid-row: 4; }
  .hiw.is-enhanced .hiw-step:nth-child(4) .hiw-head { grid-row: 5; }
  .hiw.is-enhanced .hiw-head { grid-column: 1; }
  .hiw.is-enhanced .hiw-btn { min-height: 76px; padding: 14px 20px; font-size: 21px; }
  .hiw.is-enhanced .hiw-pane { grid-column: 2; grid-row: 1 / -1; padding: 0; min-height: calc(var(--hc-stage-h) + 150px); }
  .hiw.is-enhanced .hiw-note { min-height: 3.1em; }
  .hiw.is-enhanced .hiw-demo { height: var(--hc-stage-h); display: flex; flex-direction: column; justify-content: center; }
  .hiw.is-enhanced .hiw-desc { font-size: 17px; min-height: 2.9em; }
}
/* no-JS desktop: readable stacked steps, examples beside their text */
@media (min-width: 900px) {
  .hiw:not(.is-enhanced) .hiw-step { display: grid; grid-template-columns: minmax(260px, .8fr) 1.2fr; gap: 12px 48px; margin-bottom: 28px; }
  .hiw:not(.is-enhanced) .hiw-pane { padding: 0; }
}

/* ---- mobile: accordion, simplified examples ------------------------------------- */
@media (max-width: 899px) {
  .hiw-step + .hiw-step { margin-top: 8px; }
  .hiw-btn, .hiw:not(.is-enhanced) .hiw-head { min-height: 60px; padding: 10px 8px; font-size: 18px; }
  .hiw-btn[aria-expanded="true"] { margin: 8px 0 4px; padding: 10px 12px; }
  .hiw-pane { padding: 2px 4px 20px; }
  .hiw-demo { padding: 38px 14px 14px; }
  .hc-hide-sm { display: none !important; }
  .hc-value { font-size: 15px; } .hc-reason { font-size: 14px; } .hc-kv { font-size: 14.5px; }
}
@media (max-width: 360px) {
  .hiw-btn { grid-template-columns: 38px 1fr 16px; gap: 10px; }
  .hiw-num { width: 38px; height: 38px; font-size: 18px; }
  .hiw-tag { letter-spacing: .1em; left: 12px; }
  .hc-kv { grid-template-columns: 1fr; gap: 2px; } .hc-kv dd { margin-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-demo.is-playing *, .hiw-demo.is-playing *::before, .hiw-demo.is-playing *::after { animation: none !important; }
  .hiw-btn, .hiw-chev { transition: none !important; }
  .hiw-replay { display: none !important; }
}
