/* length (REISDUUR.leo): nights counter, growing luggage, wilting plant. Every selector is prefixed .scr-length. */

/* Room below the window, so the last controls can scroll clear of Henk AND a three-line speech bubble
   (he sits just above the nav, and his bubble takes taps: a control under it is dead while he talks). */
.scr-length .len-win { margin-bottom: 84px; }

.scr-length .len-win .win__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scr-length .len-win .win__body > * + * { margin-top: 0; }

/* ---------- the luggage scene ---------- */
.scr-length .len-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scr-length .len-scene {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: calc(5 * var(--px));
  width: 100%;
  height: calc(40 * var(--px) + 9px);
  padding-bottom: 6px;
  /* dotted floor, like the style guide's divider */
  background: repeating-linear-gradient(90deg, var(--lav-d) 0 3px, transparent 3px 9px) left bottom / 100% 3px no-repeat;
}

.scr-length .len-lug__sprite,
.scr-length .len-plant__sprite {
  width: calc(var(--art-w) * var(--px));
  height: calc(var(--art-h) * var(--px));
}

.scr-length .len-lug,
.scr-length .len-plant {
  display: flex;
  align-items: flex-end;
  transform-origin: 50% 100%;
}

.scr-length .len-lug.is-any { opacity: 0.55; }

/* Henk blinking in the burst box: two stacked sprites, the second shown for a moment */
.scr-length .len-lug__blink { display: none; }
.scr-length .len-lug.is-blink .len-lug__sprite { display: none; }
.scr-length .len-lug.is-blink .len-lug__blink { display: block; }

/* the empty state: Henk waits next to the empty selection box */
.scr-length .len-lug { gap: calc(4 * var(--px)); }
.scr-length .len-lug__henk {
  /* one art pixel smaller than the luggage (2 px on phones, 3 px on desktop): whole pixels stay crisp */
  width: calc(var(--art-w) * (var(--px) - 1px));
  height: calc(var(--art-h) * (var(--px) - 1px));
}

.scr-length .len-lug__empty {
  display: grid;
  place-items: center;
  width: calc(20 * var(--px));
  height: calc(20 * var(--px));
  margin-bottom: 3px;
}

.scr-length .len-lug__q {
  font-family: var(--font-ui);
  font-size: var(--fs-xl);
  line-height: 1;
  color: var(--lav-d);
}

.scr-length .len-caption {
  margin: 0;
  font-size: var(--fs-s);
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}

/* Text that changes with every tap (caption, unit): the box is as tall as its tallest variant, because the
   invisible copies share its grid cell. So ◀ ▶ and the presets never jump under her finger. */
.scr-length .len-steady {
  display: grid;
  align-items: center;
}

.scr-length .len-steady > * { grid-area: 1 / 1; }
.scr-length .len-steady__ghost { visibility: hidden; }

.scr-length .len-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scr-length .len-sparkle { position: absolute; opacity: 0; }
.scr-length .len-sparkle--0 { left: calc(50% - 90px); top: 4px; }
.scr-length .len-sparkle--1 { left: calc(50% + 70px); top: 0; }
.scr-length .len-sparkle--2 { left: calc(50% - 64px); top: 54px; }
.scr-length .len-sparkle--3 { left: calc(50% + 92px); top: 46px; }

.scr-length .len-sparkles--go .len-sparkle { animation: len-sparkle calc(900ms / var(--speed)) steps(6) both; }
.scr-length .len-sparkles--go .len-sparkle--1 { animation-delay: calc(80ms / var(--speed)); }
.scr-length .len-sparkles--go .len-sparkle--2 { animation-delay: calc(160ms / var(--speed)); }
.scr-length .len-sparkles--go .len-sparkle--3 { animation-delay: calc(120ms / var(--speed)); }

/* choppy motion: luggage squashes when it changes, the box jumps when it bursts */
.scr-length .len-lug.len-squash { animation: squash calc(330ms / var(--speed)) steps(4) 1; }
.scr-length .len-lug.len-burst { animation: len-burst calc(480ms / var(--speed)) steps(6) 1; }
.scr-length .len-num.len-tick { animation: len-tick calc(170ms / var(--speed)) steps(2) 1; }

@keyframes len-burst {
  0% { transform: none; }
  20% { transform: scale(1.18, 0.8); }
  45% { transform: translateY(-9px) scale(0.9, 1.14); }
  70% { transform: scale(1.06, 0.95); }
  100% { transform: none; }
}

@keyframes len-tick {
  0% { transform: translateY(-6px); }
  100% { transform: none; }
}

@keyframes len-sparkle {
  0% { opacity: 0; transform: scale(0.4); }
  30% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: translateY(-12px) scale(0.8); }
}

/* ---------- the counter: ◀ big number ▶ ---------- */
.scr-length .len-counter {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
}

.scr-length .len-step {
  flex: none;
  width: 60px;
  min-height: 68px;
  padding: 0;
}

.scr-length .len-step[aria-disabled="true"] {
  background: var(--shade);
  border-color: var(--lav-d);
  box-shadow: 2px 2px 0 0 var(--lav-d);
}

.scr-length .len-step[aria-disabled="true"] svg { opacity: 0.35; }

.scr-length .len-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 1 150px; /* shrinks on narrow phones, never below 104 px */
  min-width: 104px;
  padding: 6px 8px;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  box-shadow: inset 3px 3px 0 0 var(--shade);
}

.scr-length .len-num {
  font-family: var(--font-ui);
  font-size: 44px;
  line-height: 1;
}

.scr-length .len-unit {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  line-height: 1.1;
  text-transform: uppercase;
  text-align: center;
}

.scr-length .len-display.is-empty .len-num { color: var(--lav-d); }

/* ---------- fits in her free days? ---------- */
.scr-length .len-fit {
  display: grid; /* the three versions share one cell: the box keeps the height of the tallest */
  margin: 0;
  padding: 6px 10px;
  font-size: var(--fs-s);
  line-height: 1.25;
  background: var(--lav-l);
  border: var(--bw) solid var(--ink);
}

.scr-length .len-fit__v {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: 8px;
  visibility: hidden;
}

.scr-length .len-fit__v.is-shown { visibility: visible; }
.scr-length .len-fit svg { flex: none; }
.scr-length .len-fit__range { white-space: nowrap; }
.scr-length .len-fit.is-ok { background: var(--mint); }
.scr-length .len-fit.is-over { background: var(--pink-l); }

/* ---------- presets + "maakt niet uit" ---------- */
.scr-length .len-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 8px;
  container-type: inline-size;
  font-size: var(--fs-xs); /* the em in the breakpoint below follows LEESBRIL */
}

.scr-length .len-preset,
.scr-length .len-any {
  min-width: 0;
  min-height: var(--tap);
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  text-transform: uppercase;
}

.scr-length .len-preset {
  justify-content: space-between;
  padding: 4px 6px 4px 10px;
  text-align: left;
}

.scr-length .len-preset__n {
  flex: none;
  min-width: 28px;
  padding: 3px 4px;
  text-align: center;
  background: var(--lav-l);
  border: 2px solid var(--ink);
}

.scr-length .len-preset[aria-pressed="true"] .len-preset__n { background: var(--paper); }

/* Too narrow for "WEEKENDJE [2]" on one line (320 px phones, or LEESBRIL): the number goes under the label.
   Two chips need about 2 x (6.6em label + 56 px border, padding, gap and badge) + 8 px gap. */
@container (max-width: calc(13.2em + 124px)) {
  .scr-length .len-preset {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px;
    text-align: center;
  }

  .scr-length .len-preset__n { padding: 1px 4px; }
}

.scr-length .len-any { justify-content: center; }
.scr-length .len-any svg { flex: none; }

/* ---------- precies / ongeveer ---------- */
.scr-length .len-flex__label { margin: 0; }

.scr-length .len-flex .seg__opt {
  min-width: 0;
  min-height: var(--tap);
}
