/* ==========================================================================
   How it works — Figma 55:11520 (frame 7:2). Partial: partials/04-how-it-works.html
   Animation: js/how-it-works.js
   ========================================================================== */

/* ---- Heading (Figma 8:3457: STIX Two Text 40/36, -1px, capitalised, cap-trimmed) ---- */
.hiw-heading {
  font-size: 32px;
  line-height: 30px;
  letter-spacing: -1px;
  text-transform: capitalize;
  text-box: trim-both cap alphabetic;
}
@media (min-width: 640px) {
  .hiw-heading { font-size: 40px; line-height: 36px; }
}

/* ---- Step grid: 3 × 371px columns, 16px gutter, 50px below the heading ----
   At ≥1280 Figma bottom-aligns the three cards (items-end). Card 1's text block is 4px shorter
   (16px title→body gap vs 20px on cards 2–3), so its tile sits 4px lower, exactly as in Figma. */
.hiw-steps {
  margin-top: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 56px;
}
@media (min-width: 1024px) {
  .hiw-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  /* Figma layout; only here, where the body copy has the Figma line breaks (narrower columns would stagger) */
  .hiw-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
}
.hiw-step { display: flex; min-width: 0; flex-direction: column; gap: 40px; }

/* ---- Tile: the glass square (371×440 in Figma) holding a fixed 371×440 stage ----
   .hiw-glass fills the tile. .hiw-stage (the Figma coordinate space the keyframe layers live in) is
   centred in the tile and scaled to the tile's size by the JS (--hiw-scale).
   .hiw-fit then centres the tile's design inside the stage and shrinks it so it sits in the glass
   with even margins (values per tile below). Single-column layouts cap the tile at 440px so the
   design doesn't float in a huge empty square on tablets. */
.hiw-tile { position: relative; width: 100%; aspect-ratio: 371 / 440; }
@media (max-width: 1023.98px) {
  .hiw-tile { max-width: 440px; overflow: hidden; border-radius: 8px; }
}
.hiw-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 371px;
  height: 440px;
  transform: translate(-50%, -50%) scale(var(--hiw-scale, 1));
}
.hiw-visual {
  position: absolute;
  inset: 0;
  font-variation-settings: "opsz" 14; /* Figma uses Inter (text optical size) inside the tiles */
}
/* Centring wrapper. scale() is applied after translate() about the stage centre (185.5, 220), so
   --fit-x/--fit-y move the design's own centre onto the stage centre and the scale keeps it there.
   Offsets are measured from the final frame (= the markup) in stage px. */
.hiw-fit {
  position: absolute;
  inset: 0;
  transform-origin: 185.5px 220px;
  transform: scale(var(--fit-s, 1)) translate(var(--fit-x, 0px), var(--fit-y, 0px));
}
/* Tile 1: stack 15.5–355.5 × 85.5–380.5 (centre y 233). The picker alone at frame 0 (stack +44)
   has the same centre, so it stays centred through the loop. 340 → 306 wide = 32.5px side margins. */
[data-hiw-tile="destination"] .hiw-fit { --fit-s: 0.9; --fit-y: -13px; }
/* Tile 2: details card 5.5–365.5 × 105–335 is already centred; 360 → 306 wide = 32.5px margins.
   The scan phase (passport 63.57–348.42 + tag to 394.4, centre y 229) is centred on its own. */
[data-hiw-tile="passport"] .hiw-fit { --fit-s: 0.85; }
.hiw-scan { position: absolute; inset: 0; transform: translateY(-9px); }
/* Tile 3: stack 15.5–355.5 × 66–377.5 (centre y 221.75). 340 → 306 wide = 32.5px margins. */
[data-hiw-tile="booking"] .hiw-fit { --fit-s: 0.9; --fit-y: -1.75px; }

/* ---- Glass square (Figma Rectangle 3 / 6: #D9D9D9 @35%, r8, 3px centred stroke rgba(180,180,180,.1),
   GLASS effect: frost 4, refraction 1, depth 100, light −45°, dispersion 0.5).
   Measured from the Figma render: fill = #F2F2F2 on white, a soft shade that is darkest in the
   top-left corner and fades along the top and left edges (light from −45°), and a 3px rim that
   is lighter outside / darker inside. Nothing sits behind the glass, so no backdrop blur is needed. */
.hiw-glass {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(217, 217, 217, 0.35);
  /* rim, as Figma renders the 3px centred stroke + glass edge: 1px rgba(180,180,180,.1) outside,
     then 1px of plain fill, then a 1px darker line, then the glass interior */
  box-shadow:
    0 0 0 1px rgba(180, 180, 180, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    inset 0 0 0 2px rgba(0, 0, 0, 0.03);
}
/* light −45°: inner shade along the top and left edges, strongest at the top-left corner */
.hiw-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 10px 10px 80px 10px rgba(0, 0, 0, 0.045); /* fitted to the Figma render (mean error < 0.5 grey levels) */
  -webkit-mask-image: linear-gradient(135deg, #000 0%, rgba(0, 0, 0, 0.72) 20%, rgba(0, 0, 0, 0.56) 30%, rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.12) 46%, transparent 54%);
  mask-image: linear-gradient(135deg, #000 0%, rgba(0, 0, 0, 0.72) 20%, rgba(0, 0, 0, 0.56) 30%, rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.12) 46%, transparent 54%);
  pointer-events: none;
}
/* ---- Step text (Figma 8:3447 / 8:3454 / 8:3448) ---- */
.hiw-text { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
/* Number badge (Figma 19:6024): 30px circle, 2.4px centred ring, digit cap-trimmed and centred with Figma's padding */
.hiw-num {
  display: flex;
  width: 30px;
  height: 30px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5.116px 7.484px 5.905px; /* Figma 6.316 / 8.684 / 7.105 measured from the outer edge */
  border-radius: 9999px;
  /* Figma's 2.4px stroke is centred on the 30px circle: 1.2px over the fill, 1.2px over the page */
  border: 1.2px solid rgba(150, 150, 150, 0.4);
  box-shadow: 0 0 0 1.2px rgba(150, 150, 150, 0.4);
  background: #2a2a2a;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 18.947px;
  letter-spacing: -0.7895px;
}
.hiw-num > span { display: block; line-height: 28.421px; white-space: nowrap; text-box: trim-both cap alphabetic; }
.hiw-copy { display: flex; flex-direction: column; gap: 16px; color: #000; }
.hiw-copy--wide { gap: 20px; } /* cards 2 and 3: title, body are direct children of the 20px stack in Figma */
.hiw-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: -1px;
  text-transform: capitalize;
  text-box: trim-both cap alphabetic;
}
@media (max-width: 639.98px) {
  .hiw-title { font-size: 24px; }
}
.hiw-body { font-size: 16px; line-height: 17px; text-box: trim-both cap alphabetic; }
@media (min-width: 1280px) {
  .hiw-body--3 { width: 382px; max-width: none; } /* Figma 8:3450 is 382 wide (overhangs the 371 column) */
}

/* ---- Shared tile UI ---- */
/* White UI card: 1px #EEE4EC, r12, soft shadow */
.hiw-ui {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 6px 0 rgba(31, 26, 20, 0.04);
}
/* Round flag (Figma "Flag 28 / …"): square flag art masked by a circle with a hairline */
.hiw-flag {
  --s: 28px;
  --hair: 0.5px;
  position: relative;
  display: block;
  flex-shrink: 0;
  width: var(--s);
  height: var(--s);
  overflow: hidden;
  border-radius: 9999px;
}
.hiw-flag img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.hiw-flag::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 var(--hair) rgba(0, 0, 0, 0.1);
}
.hiw-flag--34 { --s: 34px; --hair: 0px; }

/* ---- Tile 1 · destination ---- */
.hiw-row {
  display: flex;
  height: 52px;
  width: 330px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 8px;
  padding: 0 12px;
}
.hiw-country { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.hiw-cursor {
  position: absolute;
  left: 321px;
  top: 408px;
  width: 20.4px;
  height: 28.8px;
  filter: drop-shadow(0 1.2px 0.6px rgba(0, 0, 0, 0.3));
}
.hiw-cursor img { width: 20.4px; height: 28.8px; }

/* ---- Tile 2 · passport ---- */
.hiw-field { position: relative; display: flex; height: 34px; align-items: center; padding: 0 16px; }
.hiw-field__label { position: relative; white-space: nowrap; font-size: 13px; letter-spacing: -0.13px; color: var(--color-muted); }
.hiw-field__mask { position: absolute; top: 9px; height: 16px; overflow: hidden; }
.hiw-field__mask p {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: -0.13px;
  color: var(--color-ink);
}
.hiw-field__caret { position: absolute; left: 343px; top: 9.5px; width: 1.5px; height: 15px; background: var(--color-ink); }
.hiw-field__skeleton { position: absolute; top: 12px; height: 10px; border-radius: 5px; background: var(--color-border); }

.hiw-passport {
  position: absolute;
  left: 85.37px;
  top: 63.57px;
  width: 200.27px;
  height: 284.85px;
  overflow: hidden;
  border: 1.944px solid rgba(90, 141, 255, 0.37);
  border-radius: 1.35px;
  background: var(--color-passport);
  box-shadow: 0 18px 30px -6px rgba(31, 23, 15, 0.18);
}
.hiw-passport__leather {
  position: absolute;
  inset: 0;
  opacity: 0.74;
  background: url(../assets/veeza/how-it-works/passport-leather.jpg) repeat;
  background-size: 100.2px 45.1px;
}
.hiw-passport__content {
  position: absolute;
  left: 56.39px;
  top: 39.86px;
  display: flex;
  width: 84.58px;
  flex-direction: column;
  align-items: center;
  gap: 58.331px;
}
.hiw-passport__top { display: flex; width: 100%; flex-direction: column; align-items: center; gap: 38.887px; }
.hiw-passport__country,
.hiw-passport__label {
  width: 100%;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 18.42px;
  color: #fb0;
  text-box: trim-both cap alphabetic;
}
.hiw-passport__country { text-transform: uppercase; line-height: 16.527px; letter-spacing: -0.9722px; }
.hiw-passport__label { line-height: 27.631px; letter-spacing: -0.7675px; }
.hiw-passport__emblem { display: block; width: 61.724px; height: 63.673px; filter: url(#hiw-emblem-inner); }
.hiw-defs { position: absolute; width: 0; height: 0; }

.hiw-scanned {
  position: absolute;
  left: 85.37px;
  top: 64px;
  width: 200px;
  background-image: linear-gradient(to bottom, rgba(30, 38, 140, 0.06), rgba(30, 38, 140, 0.3));
}
/* "Passport read" tag: centred horizontally under the passport (its transform is driven by the JS) */
.hiw-tag { left: 0; right: 0; width: fit-content; margin-inline: auto; }
.hiw-beam {
  position: absolute;
  left: 65.37px;
  top: 219px;
  width: 240px;
  height: 3px;
  border-radius: 2px;
  background-image: linear-gradient(90deg, rgba(178, 183, 252, 0) 0%, #fff 12%, #fff 88%, rgba(178, 183, 252, 0) 100%);
  box-shadow: 0 -10px 20px 0 rgba(30, 38, 140, 0.45), 0 0 12px 2px rgba(30, 38, 140, 0.9);
}

/* ---- Tile 3 · booking ---- */
.hiw-line { display: flex; width: 0; height: 14px; align-items: center; justify-content: center; }
.hiw-line img { display: block; width: 1px; height: 14px; flex-shrink: 0; }
.hiw-slot { width: 300px; }
.hiw-slot--open {
  height: 48px;
  overflow: hidden;
  border: 1.5px solid var(--color-tag);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 6px 0 rgba(31, 26, 20, 0.04);
}
.hiw-slot__row { display: flex; height: 46px; align-items: center; justify-content: space-between; padding: 0 14px; white-space: nowrap; }
.hiw-slot__left { display: flex; align-items: center; gap: 10px; }
.hiw-slot__date { font-size: 14px; font-weight: 500; letter-spacing: -0.14px; color: var(--color-ink); }
.hiw-slot__time { font-size: 12.5px; font-weight: 500; letter-spacing: -0.125px; }
.hiw-wa { position: relative; display: block; width: 19px; height: 19px; overflow: hidden; }
.hiw-wa img { position: absolute; left: 1.227px; top: 1.188px; display: block; width: 16.545px; height: 16.625px; }

/* ---- Tile 2: the step-1 mini menu behind the glass (the client's "happy accident"), kept fully inside
   the square: the tile clips it, the glass above blurs it. ---- */
.hiw-tile--behind { overflow: hidden; border-radius: 8px; }
.hiw-tile--behind .hiw-glass { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.hiw-behind { position: absolute; inset: 0; pointer-events: none; }
.hiw-sm {
  position: absolute; left: 4%; top: 23%; width: 131px;
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 11px 13px; border-radius: 16px;
  background: rgba(249, 249, 250, 0.9); border: 0.4px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1.6px 4.8px rgba(0, 0, 0, 0.05), 0 14.4px 32px rgba(0, 0, 0, 0.12);
  font-variation-settings: "opsz" 14; white-space: nowrap; overflow: hidden;
}
.hiw-sm__title { padding: 0 0 3px 3px; font-size: 13.6px; font-weight: 600; letter-spacing: -0.2px; color: #1d1d1f; }
.hiw-sm__row { display: flex; align-items: center; gap: 9px; height: 49.6px; padding: 0 11px; border-radius: 11px; background: #fff; border: 0.4px solid rgba(0, 0, 0, 0.08); box-shadow: 0 0.8px 1.6px rgba(0, 0, 0, 0.05); }
.hiw-sm__row img { width: 22px; height: 22px; flex: none; }
.hiw-sm__name { flex: 1; min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; color: #1d1d1f; }
.hiw-sm__price { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; font-weight: 600; color: #1d1d1f; }
.hiw-sm__price small { font-size: 8.8px; font-weight: 400; color: #86868b; }
.hiw-sm__row i { width: 17.6px; height: 17.6px; flex: none; border-radius: 50%; border: 0.8px solid rgba(0, 0, 0, 0.22); background: #fff; }
@media (max-width: 1023px) { .hiw-behind { display: none; } }

/* Soft painted background behind How it works (Figma 55:12470: full-bleed, 870 tall, starts 143px
   above the heading, 61% opacity + image filters — exported flattened from Figma). */
.hiw { position: relative; }
.hiw::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0;
  top: -58px; height: 870px;
  background: url(../assets/veeza/how-it-works/section-bg.jpg) center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 120px, #000 calc(100% - 120px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 120px, #000 calc(100% - 120px), transparent);
  pointer-events: none;
}
@media (max-width: 767px) { .hiw::before { top: -72px; height: 100%; } }
