/* =============================================================================
   SECTION 2 · THE CUTIE PIE DEPARTMENT  (bento dashboard of stats)
   Visuals animate when a card gets .is-in (added on scroll).
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .stat-card.is-wide,
  .stat--classified { grid-column: span 2; }
}
@media (min-width: 980px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .stat--classified { grid-column: auto; }
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 250px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.js .stat-card.reveal { transition: opacity .9s var(--ease-out) var(--d, 0s), transform 1s var(--ease-out) var(--d, 0s), box-shadow .4s; }
@media (hover: hover) {
  .stat-card.is-in:hover {
    transform: translateY(-4px) rotate(-.35deg);
    box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
    transition: transform .45s var(--ease-spring), box-shadow .45s;
  }
}

.stat-card.is-dark { background: var(--plum); color: var(--cream); box-shadow: var(--shadow-lg); }
.stat-card.is-blush { background: var(--blush); }
.stat-card.is-kraft { background: var(--kraft); }

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label {
  font-family: var(--font-body);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.is-dark .stat-label { color: rgba(255, 248, 240, .7); }
.is-dark .badge { background: var(--cherry); color: #fff; }
.is-blush .badge { background: var(--paper); }
.is-kraft .badge { background: var(--plum); color: var(--cream); }

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7.5vw, 2.7rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.035em;
  font-variation-settings: "SOFT" 100;
  text-wrap: balance;
}
.stat--overflow .stat-value { font-size: clamp(3rem, 13vw, 4.6rem); color: var(--cherry); font-variant-numeric: tabular-nums; }
.stat--notification .stat-value { font-size: clamp(3rem, 12vw, 4rem); }

.stat-visual { margin-top: auto; }
.stat-foot { font-size: .88rem; line-height: 1.45; color: var(--ink-2); }
.is-dark .stat-foot { color: rgba(255, 248, 240, .7); }

/* ---------- overflow: a progress bar that breaks out of its track ---------- */
.meter { position: relative; padding: 4px 0 0; }
.meter-track {
  position: relative;
  width: 74%;
  height: 16px;
  border-radius: 999px;
  background: var(--blush);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--cherry));
  transition: width 1.5s var(--ease-out) .25s;
}
.meter-spill {
  position: absolute;
  top: 4px;
  left: calc(74% - 8px);
  height: 16px;
  width: 0;
  border-radius: 0 999px 999px 0;
  background: repeating-linear-gradient(-45deg, var(--cherry) 0 7px, #DE5A70 7px 14px);
  background-size: 40px 100%;
  animation: stripes .9s linear infinite;
  transition: width 1.1s var(--ease-spring) 1.6s;
}
.meter-boom {
  position: absolute;
  top: -6px;
  left: calc(74% - 14px);
  width: 28px;
  height: 28px;
  color: var(--butter);
  opacity: 0;
  transform: scale(0);
  transition: opacity .3s 1.6s, transform .6s var(--ease-spring) 1.6s;
}
.meter-boom .icon { width: 100%; height: 100%; animation: twinkle 1.4s ease-in-out infinite; }
.meter-scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  width: 74%;
  margin-top: 8px;
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.meter-err {
  position: absolute;
  left: calc(100% + 18px);
  color: var(--cherry);
  letter-spacing: .1em;
  opacity: 0;
  transition: opacity .3s 2.2s;
  animation: blink 1s steps(2) infinite;
}
.is-in .meter-fill { width: 100%; }
.is-in .meter-spill { width: 23%; }
.is-in .meter-boom { opacity: 1; transform: scale(1); }
.is-in .meter-err { opacity: 1; }
@keyframes stripes { to { background-position: 40px 0; } }

/* ---------- gauge: needle swings straight into "danger" -------------------- */
.gauge { width: 100%; max-width: 300px; margin: 0 auto; overflow: visible; }
.gauge-arc {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1.6s var(--ease-out) .2s;
}
.gauge-needle {
  transform-origin: 100px 104px;
  transform: rotate(-88deg);
  transition: transform 1.7s var(--ease-spring) .3s;
}
.gauge text {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  fill: rgba(255, 248, 240, .6);
}
.gauge .gauge-danger { fill: var(--rose); }
.is-in .gauge-arc { stroke-dashoffset: 3; }
.is-in .gauge-needle { transform: rotate(80deg); animation: needle-jitter .16s ease-in-out 2.1s infinite alternate; }
@keyframes needle-jitter {
  from { transform: rotate(77deg); }
  to { transform: rotate(84deg); }
}

/* ---------- notification: one of these is not like the others ------------- */
.mini-notifs { display: grid; gap: 8px; }
.mini-n {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 253, 249, .85);
  box-shadow: var(--shadow-sm);
  font-size: .82rem;
  line-height: 1.3;
}
.mini-n b { display: block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.mini-n span { color: var(--ink-2); }
.mini-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--cream-deep);
  color: var(--ink-3);
}
.mini-ic .icon { width: 16px; height: 16px; }
.mini-tag {
  margin-left: auto;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3) !important;
}
.mini-n.is-muted { opacity: .5; transform: scale(.97); }
.mini-n.is-muted .mini-txt { text-decoration: line-through; text-decoration-color: rgba(73, 52, 61, .35); }
.mini-n.is-star {
  position: relative;
  background: var(--paper);
  box-shadow: 0 10px 22px -10px rgba(201, 62, 84, .55), inset 0 0 0 1.5px var(--rose);
  opacity: 0;
  transform: translateY(-24px) scale(.9);
  transition: opacity .4s .5s, transform .7s var(--ease-spring) .5s;
}
.mini-n.is-star .mini-ic { background: linear-gradient(145deg, var(--rose), var(--cherry)); color: #fff; }
.mini-n.is-star b { color: var(--cherry); }
.mini-n.is-star::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  border: 2px solid var(--rose);
  opacity: 0;
}
.is-in .mini-n.is-star { opacity: 1; transform: none; }
.is-in .mini-n.is-star::after { animation: ring 2.2s ease-out 1.4s infinite; }
@keyframes ring {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08); }
}

/* ---------- distance: a paper plane commuting forever ---------------------- */
.distance { display: block; width: 100%; max-width: 440px; height: auto; margin: 0 auto; overflow: visible; color: var(--plum); }
.distance-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 8;
  opacity: .55;
}
.distance text {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 700;
  fill: var(--plum);
  text-anchor: middle;
}
.distance-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.distance-meta span:last-child { color: var(--cherry); }

/* ---------- battery: resistance draining to zero --------------------------- */
.battery { display: flex; align-items: center; gap: 4px; }
.battery-body {
  flex: 1;
  height: 46px;
  padding: 5px;
  border-radius: 13px;
  box-shadow: inset 0 0 0 2.5px var(--plum);
}
.battery-fill {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  background-color: var(--plum);
  transition: width 2.4s var(--ease-in-out) .35s, background-color 2.4s ease .35s;
}
.battery-cap { width: 6px; height: 18px; border-radius: 0 4px 4px 0; background: var(--plum); }
.battery-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.battery-pct {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cherry);
  font-variant-numeric: tabular-nums;
}
.is-in .battery-fill {
  width: 5%;
  background-color: var(--cherry);
  animation: blink 1s ease-in-out 2.8s infinite;
}

/* ---------- idcard: official employee badge -------------------------------- */
.idcard {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px 14px;
  padding: 14px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  overflow: hidden;
  transform: rotate(-1.5deg);
  transition: transform .6s var(--ease-spring);
}
.stat-card:hover .idcard { transform: rotate(0) scale(1.02); }
.idcard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--cherry), var(--rose));
}
.idcard-photo {
  display: grid;
  place-items: center;
  height: 74px;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--blush);
  color: var(--cherry);
}
.idcard-photo .icon { width: 30px; height: 30px; animation: heartbeat 2.4s ease-in-out infinite; }
.idcard-rows { display: grid; gap: 3px; margin-top: 4px; font-size: .8rem; line-height: 1.25; min-width: 0; }
.idcard-k {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.idcard-v { font-weight: 600; overflow-wrap: anywhere; }
.idcard-v + .idcard-k { margin-top: 4px; }
.idcard-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
  font-family: var(--font-mono);
  font-size: .7rem;
}
.barcode {
  width: 92px;
  height: 22px;
  background: repeating-linear-gradient(90deg,
    var(--plum) 0 2px, transparent 2px 4px, var(--plum) 4px 5px, transparent 5px 8px,
    var(--plum) 8px 11px, transparent 11px 12px, var(--plum) 12px 13px, transparent 13px 16px);
}
.holo {
  position: absolute;
  right: 12px;
  top: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(#F7DDE2, #F4D48A, #CFE6EA, #E6D2F2, #F7DDE2);
  opacity: .85;
  animation: spin 7s linear infinite;
}

/* ---------- classified: the surprise button -------------------------------- */
.stat--classified {
  background:
    repeating-linear-gradient(-45deg, rgba(73, 52, 61, .035) 0 10px, transparent 10px 20px),
    var(--kraft);
}
.classified-stamp {
  position: absolute;
  right: 18px;
  top: 58px;
  padding: 4px 10px;
  border: 2.5px solid var(--cherry);
  border-radius: 6px;
  color: var(--cherry);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  transform: rotate(10deg);
  opacity: .75;
}
.classified-text { max-width: 26ch; font-size: .95rem; color: var(--ink-2); }
.classified-out:empty { display: none; }
.compliment-slip {
  position: relative;
  padding: 14px 16px;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-hand);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
  transform: rotate(-1deg);
  animation: slip-in .55s var(--ease-spring);
}
@keyframes slip-in {
  from { opacity: 0; transform: translateY(14px) rotate(-5deg) scale(.95); }
  to { opacity: 1; transform: rotate(-1deg); }
}
.classified-btn { align-self: flex-start; margin-top: auto; }
.classified-btn .badge-dot { background: #fff; }

/* ---------- disclaimer ------------------------------------------------------ */
.disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 38px;
  text-align: left;
}
.disclaimer p {
  max-width: 32ch;
  font-family: var(--font-hand);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink-2);
}
.disclaimer p::before { content: "* "; color: var(--cherry); }
.disclaimer.is-in .round-stamp { animation: stamp-in .6s var(--ease-out) .4s both; }
