/*
 * HospiChef hero visual. Every class is prefixed `hv-`.
 * Colors only come from the tokens on .hv-root (two presets: light, dark).
 * Layout: >= 640 px container = full desktop composition (designed for 640 x 560);
 * 520-639 px = same composition, narrower phone, fewer columns/cards;
 * < 520 px = the 520 px composition, scaled down as a whole (.hv-fit).
 */

/* ------------------------------------------------------------------ tokens */

.hv-root {
  /* required tokens */
  --hv-surface: #ffffff;
  --hv-text: #131b30; /* darkBlue 900, text.primary */
  --hv-muted: #46505b; /* porcelain 900, text.secondary */
  --hv-line: rgba(54, 64, 86, 0.15); /* divider: blueGrey 800 @ 15 % */
  --hv-accent: #009688; /* teal 500, primary.main */
  --hv-accent-soft: #e0f2f1; /* teal 50, primary.superlight */
  --hv-shadow: 0 1px 2px rgba(19, 27, 48, 0.06), 0 14px 34px -10px rgba(19, 27, 48, 0.22);
  --hv-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 3px 10px rgba(16, 24, 40, 0.06); /* dish cards in the app */

  /* supporting tokens */
  --hv-surface-alt: #f7f9fb; /* background.default */
  --hv-accent-strong: #00695c; /* teal 800, primary.dark */
  --hv-accent-text: #00796b; /* teal 700: accent as small text */
  --hv-on-accent: #ffffff;
  --hv-ink: #131b30; /* BKT/BT line */
  --hv-chart-fill: rgba(176, 189, 224, 0.52); /* BKT/BT area, as in BKT_BT.jsx */
  --hv-info: #55818b; /* cyan 800 */
  --hv-success: #1f8e46; /* mint 900 */
  --hv-success-soft: #eafdf0; /* mint 50 */
  --hv-danger: #da5863; /* red 400, error.main */
  --hv-star: #ffb300; /* amber 600 */
  --hv-star-off: #e0e0e0;
  --hv-logo-bg: #b2dfdb; /* teal 100 */
  --hv-logo-fg: #353b53; /* darkBlue 800 */
  --hv-deco: rgba(0, 150, 136, 0.07);
  /* elements drawn directly on the page background (flow labels, rail) */
  --hv-stage-text: #131b30;
  --hv-stage-muted: #46505b;
  --hv-stage-line: rgba(19, 27, 48, 0.14);

  /* phone */
  --hv-device: #ffffff; /* frame: subtle, in the card surface */
  --hv-device-edge: rgba(19, 27, 48, 0.09);
  --hv-app-bg: #f3f5f8; /* app background, a touch darker than the frame */
  --hv-chip-strong: #131b30; /* DateChip: secondary.main */
  --hv-on-chip-strong: #ffffff;
  --hv-radius: 10px;
  --hv-height: 560px;
  --hv-font: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.hv-root[data-theme='dark'] {
  --hv-surface: #182235;
  --hv-text: #f1f4f9;
  --hv-muted: #afb8ca;
  --hv-line: rgba(241, 244, 249, 0.12);
  --hv-accent: #009688;
  --hv-accent-soft: rgba(77, 182, 172, 0.17);
  --hv-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 44px -14px rgba(0, 0, 0, 0.7);
  --hv-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.18);

  --hv-surface-alt: #202c42;
  --hv-accent-strong: #26a69a;
  --hv-accent-text: #4db6ac;
  --hv-on-accent: #ffffff;
  --hv-ink: #d3d9f6;
  --hv-chart-fill: rgba(144, 150, 177, 0.26);
  --hv-info: #7acee2;
  --hv-success: #6bed93;
  --hv-success-soft: rgba(81, 231, 128, 0.14);
  --hv-danger: #e8838b;
  --hv-star: #ffca28;
  --hv-star-off: #3e4a66;
  --hv-logo-bg: #b2dfdb;
  --hv-logo-fg: #353b53;
  --hv-deco: rgba(77, 182, 172, 0.09);
  --hv-stage-text: #f1f4f9;
  --hv-stage-muted: #9eafc3;
  --hv-device: #1d2840;
  --hv-device-edge: rgba(241, 244, 249, 0.08);
  --hv-app-bg: #141d2f;
  --hv-chip-strong: #e3e9ff;
  --hv-on-chip-strong: #131b30;
  --hv-stage-line: rgba(241, 244, 249, 0.16);
}

/* -------------------------------------------------------------------- base */

.hv-root {
  container: hv / inline-size;
  --hv-phone-w: 250px;
  position: relative;
  width: 100%;
  min-width: 0;
  font-family: var(--hv-font);
  font-size: 12px;
  line-height: 1.35;
  color: var(--hv-text);
  -webkit-font-smoothing: antialiased;
  /* fixed-width digits: a count ticking 312 → 313 must not change any width */
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
}

.hv-root *,
.hv-root *::before,
.hv-root *::after {
  box-sizing: border-box;
}

.hv-root svg {
  display: block;
  flex-shrink: 0;
}

.hv-stage {
  position: relative;
  width: 100%;
  min-height: var(--hv-height);
}

.hv-card {
  position: relative;
  background: var(--hv-surface);
  color: var(--hv-text);
  border: 1px solid var(--hv-line);
  border-radius: var(--hv-radius);
  box-shadow: var(--hv-shadow);
  overflow: hidden;
}

.hv-card-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 8px;
}

.hv-head-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px 8px;
}

.hv-head-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hv-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
}

.hv-h {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
}

.hv-muted {
  color: var(--hv-muted);
}

.hv-small {
  font-size: 11.5px;
}

.hv-overline {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
}

.hv-accent-text {
  color: var(--hv-accent-text);
}

.hv-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border: 1px solid var(--hv-line);
  border-radius: var(--hv-radius);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.hv-chip-praise {
  border-color: transparent;
  background: var(--hv-success-soft);
  color: var(--hv-success);
}

.hv-chip-mixed {
  color: var(--hv-muted);
}

.hv-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--hv-radius);
  background: var(--hv-accent);
  color: var(--hv-on-accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    transform 0.18s ease,
    background-color 0.25s ease;
}

.hv-btn-pressed {
  transform: scale(0.94);
  background: var(--hv-accent-strong);
}

.hv-btn-quiet {
  background: var(--hv-accent-soft);
  color: var(--hv-accent-text);
}

/* one visible state, sized by the largest (see Swap in hero-visual.tsx) */
.hv-swap {
  display: inline-grid;
  justify-items: end;
  align-items: center;
}

.hv-app-footer .hv-swap {
  justify-items: center;
}

.hv-swap-item {
  grid-area: 1 / 1;
  display: inline-flex;
}

.hv-swap-item.hv-off {
  visibility: hidden;
}

.hv-swap-item:not(.hv-off) .hv-app-confirm {
  animation: hv-arrive 0.4s ease both;
}

/* ---------------------------------------------------------------- brand hex */

.hv-hex {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hv-hex > svg {
  width: 100%;
  height: 100%;
}

.hv-hex-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hv-logo {
  width: 22px;
  height: 21px;
}

.hv-logo > svg:first-child path {
  fill: var(--hv-logo-bg);
}

.hv-logo-h {
  width: 100%;
  height: 100%;
}

.hv-logo-h rect {
  fill: var(--hv-logo-fg);
}

.hv-deco-hex {
  position: absolute;
  left: 40px;
  top: 50%;
  width: 360px;
  height: 339px;
  transform: translateY(-50%) rotate(-8deg);
}

.hv-deco-hex path {
  fill: var(--hv-deco);
}

/* ------------------------------------------------------------------- phone */
/*
 * Subtle device: a thin frame in the surface color, soft shadow, no notch.
 * The app inside follows the real proportions (a 390 px app scaled to the
 * phone width, ≈ 0.62): small text is intended here.
 */

.hv-phone {
  width: 100%;
  padding: 5px;
  border-radius: 34px;
  background: var(--hv-device);
  box-shadow:
    inset 0 0 0 1px var(--hv-device-edge),
    var(--hv-shadow);
}

.hv-phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 9 / 17.4;
  border-radius: 29px;
  overflow: hidden;
  background: var(--hv-app-bg);
  color: var(--hv-text);
}

.hv-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 4px 20px 0 24px;
  font-size: 10.5px;
  font-weight: 600;
}

.hv-status-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hv-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  height: 8px;
}

.hv-signal i {
  width: 2.5px;
  border-radius: 1px;
  background: var(--hv-text);
}

.hv-signal i:nth-child(1) {
  height: 3px;
}
.hv-signal i:nth-child(2) {
  height: 4.5px;
}
.hv-signal i:nth-child(3) {
  height: 6px;
}
.hv-signal i:nth-child(4) {
  height: 8px;
}

.hv-battery {
  position: relative;
  width: 16px;
  height: 8px;
  border: 1px solid var(--hv-text);
  border-radius: 2.5px;
  opacity: 0.9;
}

.hv-battery::after {
  content: '';
  position: absolute;
  inset: 1px 4px 1px 1px;
  border-radius: 1px;
  background: var(--hv-text);
}

.hv-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 12px 8px;
}

.hv-app-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hv-app-h {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
  line-height: 1.1;
}

.hv-date-chip {
  padding: 2px 7px;
  border-radius: var(--hv-radius);
  background: var(--hv-chip-strong);
  color: var(--hv-on-chip-strong);
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}

.hv-app-content {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0 10px;
}

.hv-app-section {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 1px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.hv-app-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hv-dish {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 9px;
  padding: 5px;
  border-radius: 14px;
  background: var(--hv-surface);
  box-shadow: var(--hv-shadow-sm);
  outline: 1.5px solid transparent;
  outline-offset: -1.5px;
  transition: outline-color 0.3s ease;
}

.hv-dish-selected {
  outline-color: var(--hv-accent);
}

.hv-dish-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--hv-radius);
  overflow: hidden;
  background: var(--hv-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hv-muted);
}

.hv-dish-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hv-dish-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 2px 4px 2px 0;
}

.hv-dish-title-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.hv-dish-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}

.hv-dish-icon {
  fill: var(--hv-accent-text);
}

.hv-dish-title-row .hv-dish-icon {
  margin-top: -1px;
}

.hv-dish-line-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hv-dish-line-row .hv-dish-icon {
  flex-shrink: 0;
}

.hv-dish-desc {
  padding-right: 30px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--hv-muted);
}

.hv-add {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hv-accent);
  color: var(--hv-on-accent);
  transition:
    transform 0.18s ease,
    background-color 0.25s ease;
}

.hv-add-pressed {
  transform: scale(0.82);
}

.hv-add-done {
  background: var(--hv-accent-strong);
  animation: hv-pop 0.35s ease;
}

/* the dish card at phone scale (the flow fragment keeps the sizes above) */
.hv-phone .hv-app-list {
  gap: 7px;
}

.hv-phone .hv-dish {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  padding: 4px;
  border-radius: 11px;
}

.hv-phone .hv-dish-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
}

.hv-phone .hv-dish-body {
  padding: 3px 3px 2px 0;
}

.hv-phone .hv-overline {
  font-size: 7.5px;
  letter-spacing: 0.07em;
}

.hv-phone .hv-dish-title {
  font-size: 10.5px;
  line-height: 1.3;
}

.hv-phone .hv-dish-title-row .hv-dish-icon {
  width: 12px;
  height: 12px;
  margin-top: 1px;
}

.hv-phone .hv-dish-desc {
  padding-right: 24px;
  font-size: 8.5px;
  line-height: 1.4;
}

.hv-phone .hv-add {
  right: 5px;
  bottom: 5px;
  width: 21px;
  height: 21px;
}

.hv-phone .hv-add svg {
  width: 13px;
  height: 13px;
}

.hv-phone .hv-app-section {
  font-size: 11.5px;
}

.hv-phone .hv-app-section svg {
  width: 13px;
  height: 13px;
}

.hv-app-footer {
  display: grid;
  justify-items: center;
  margin-top: auto;
  padding: 8px 10px 0;
}

.hv-app-optout,
.hv-app-confirm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--hv-radius);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.hv-phone .hv-app-optout,
.hv-phone .hv-app-confirm {
  gap: 4px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 9.5px;
}

.hv-phone .hv-app-optout svg,
.hv-phone .hv-app-confirm svg {
  width: 11px;
  height: 11px;
}

.hv-app-optout {
  background: var(--hv-accent);
  color: var(--hv-on-accent);
}

.hv-app-confirm {
  background: var(--hv-accent-soft);
  color: var(--hv-accent-text);
}

.hv-home-indicator {
  display: block;
  flex-shrink: 0;
  width: 84px;
  height: 3.5px;
  margin: 12px auto 7px;
  border-radius: 2px;
  background: var(--hv-text);
  opacity: 0.55;
}

/* ----------------------------------------------------------------- cockpit */

.hv-window {
  display: flex;
}

.hv-cockpit {
  container: hvcock / inline-size;
}

.hv-window-main {
  flex: 1;
  min-width: 0;
  padding: 10px 12px 12px;
}

.hv-window-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hv-head-meta {
  margin-left: auto;
  font-size: 11.5px;
  white-space: nowrap;
}

.hv-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 42px;
  padding: 44px 0 10px;
  background: var(--hv-surface-alt);
  border-right: 1px solid var(--hv-line);
}

.hv-rail-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--hv-radius);
  color: var(--hv-muted);
}

.hv-rail-active {
  background: var(--hv-accent-soft);
  color: var(--hv-accent-text);
}

.hv-day {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hv-line);
  margin-bottom: 6px;
}

.hv-day-label {
  font-size: 12.5px;
  font-weight: 500;
}

.hv-info {
  font-size: 11px;
  color: var(--hv-info);
}

.hv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, 88px);
  row-gap: 3px;
  align-items: center;
}

.hv-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 26px;
  padding: 0 3px;
}

.hv-center {
  justify-content: center;
}

.hv-meal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 4px 3px;
  border-radius: var(--hv-radius);
  background: var(--hv-accent-soft);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.hv-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid var(--hv-muted);
  color: var(--hv-on-accent);
  flex-shrink: 0;
}

.hv-checked {
  background: var(--hv-accent);
  border-color: var(--hv-accent);
}

.hv-section {
  grid-column: 1 / -1;
  margin-top: 5px;
  padding: 0 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hv-muted);
}

.hv-bar-span {
  grid-column: span 2;
  padding: 0 8px;
}

.hv-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 14px;
  border-radius: 6px;
  background: var(--hv-accent-soft);
  overflow: hidden;
}

.hv-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hv-accent);
  opacity: 0.35;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s ease;
}

.hv-bar-done::after {
  transform: scaleX(1);
}

.hv-window-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 10px;
  min-height: 28px;
}

@container hvcock (max-width: 380px) {
  .hv-col-2 {
    display: none;
  }

  .hv-grid {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .hv-bar-span {
    grid-column: span 1;
  }
}

/* step indicator (WorkflowItemStatus) */
.hv-step-ind {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(var(--hv-surface-alt), var(--hv-surface-alt)), var(--hv-surface);
}

.hv-step-loading,
.hv-step-completed {
  /* soft accent over the surface, so lines behind it stay hidden */
  background: linear-gradient(var(--hv-accent-soft), var(--hv-accent-soft)), var(--hv-surface);
  color: var(--hv-accent-text);
}

.hv-step-completed {
  animation: hv-pop 0.35s ease;
}

.hv-dots {
  display: inline-flex;
  gap: 2px;
}

.hv-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--hv-muted);
  opacity: 0.7;
}

.hv-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--hv-accent);
  border-right-color: var(--hv-accent);
  animation: hv-spin 0.8s linear infinite;
}

.hv-spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

/* stepper (flow) */
.hv-stepper-card {
  container: hvstep / inline-size;
  padding: 10px 12px 12px;
}

.hv-stepper {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 2px 0;
}

.hv-stepper-track {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 15px;
  height: 2px;
  background: var(--hv-line);
}

.hv-stepper-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hv-accent);
  transform: scaleX(var(--hv-progress, 0));
  transform-origin: left;
  transition: transform 0.6s ease;
}

.hv-stepper-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 2px;
  text-align: center;
}

.hv-stepper-step .hv-step-ind,
.hv-stepper-step .hv-spinner {
  width: 26px;
  height: 26px;
}

.hv-stepper-step .hv-step-ind {
  box-shadow: 0 0 0 3px var(--hv-surface);
}

.hv-stepper-label {
  line-height: 1.25;
}

@container hvstep (max-width: 330px) {
  .hv-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  .hv-stepper-track,
  .hv-head-meta {
    display: none;
  }

  .hv-stepper-step {
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 0;
  }

  .hv-stepper-step .hv-step-ind,
  .hv-stepper-step .hv-spinner {
    width: 22px;
    height: 22px;
  }
}

/* ------------------------------------------------------------------- chart */

.hv-chart {
  container: hvchart / inline-size;
  padding: 10px 12px;
}

.hv-kpi {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.hv-kpi-unit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--hv-muted);
}

.hv-chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.hv-gridline {
  stroke: var(--hv-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.hv-area {
  fill: var(--hv-chart-fill);
}

.hv-line {
  fill: none;
  stroke: var(--hv-ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.hv-line-accent {
  stroke: var(--hv-accent);
}

/* line and area grow into the new month (scaleX from the chart's left edge) */
.hv-chart-reveal {
  transform-origin: 0 0;
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) 0.15s;
  animation: hv-reveal 1.1s cubic-bezier(0.3, 0.7, 0.2, 1) 0.35s backwards;
}

@keyframes hv-reveal {
  from {
    transform: scaleX(0);
  }
}

/* the arriving month's column */
.hv-chart-band {
  fill: var(--hv-accent-soft);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hv-chart-band.hv-on {
  opacity: 1;
}

.hv-point {
  fill: var(--hv-surface);
  stroke: var(--hv-ink);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.hv-point-new {
  fill: var(--hv-accent);
  stroke: var(--hv-surface);
  stroke-width: 1.6;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.2);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.hv-point-new.hv-on {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 0.25s ease 0.95s,
    transform 0.45s cubic-bezier(0.3, 1.7, 0.5, 1) 0.95s;
}

.hv-point-pulse {
  fill: var(--hv-accent);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.hv-point-pulse.hv-on {
  animation: hv-pulse 1.4s ease-out 1.05s both;
}

@keyframes hv-pulse {
  from {
    opacity: 0.45;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(4);
  }
}

.hv-axis-new {
  color: var(--hv-accent-text);
  font-weight: 600;
  transition: color 0.3s ease 0.9s;
}

.hv-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--hv-muted);
  white-space: nowrap;
}

@container hvchart (max-width: 250px) {
  .hv-axis-mid {
    display: none;
  }
}

/* ---------------------------------------------------------------- feedback */

.hv-feedback {
  padding: 10px 12px 12px;
}

.hv-stars {
  display: inline-flex;
  gap: 1px;
}

.hv-star-on {
  fill: var(--hv-star);
}

.hv-star-off {
  fill: var(--hv-star-off);
}

.hv-comments {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.hv-comments > * {
  grid-area: 1 / 1;
}

.hv-comment-hidden {
  visibility: hidden;
}

.hv-comment {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px;
  border-radius: var(--hv-radius);
  background: var(--hv-surface-alt);
  border: 1px solid transparent;
}

.hv-comment-new {
  animation:
    hv-arrive 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both,
    hv-glow 2.4s ease 0.2s both;
}

.hv-comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.hv-comment-dish {
  font-size: 11.5px;
  font-weight: 600;
}

.hv-comment-text {
  font-size: 12px;
  color: var(--hv-muted);
}

/* ------------------------------------------------- cluster (≥ 520 px wide) */

.hv-frag {
  position: relative;
  min-width: 0;
  animation: hv-enter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--hv-i, 0) * 90ms + 60ms);
}

.hv-cluster .hv-float {
  animation: hv-float 7s ease-in-out infinite alternate;
  animation-delay: calc(var(--hv-i, 0) * -1.6s);
}

/* the phone is the focal point and stays still; only the cards around it float */
.hv-cluster .hv-c-phone .hv-float {
  animation: none;
}

.hv-cluster {
  display: grid;
  grid-template-columns: var(--hv-phone-w) minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
}

/* hierarchy: phone in front, cockpit second, analytics supporting */
.hv-c-phone {
  z-index: 3;
}

.hv-c-right {
  container: hvcol / inline-size;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* the cockpit's icon rail slides under the phone; its title stays free */
.hv-c-cockpit {
  margin-left: -34px;
}

.hv-c-eval {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  /* overlaps only the cockpit's empty footer corner, never its button */
  margin-top: -18px;
}

.hv-c-chart {
  flex: 1.05;
}

.hv-c-feedback {
  flex: 1;
  margin-top: 36px;
}

@container hvcol (max-width: 330px) {
  .hv-c-feedback {
    display: none;
  }

  /* a full-width chart would reach the cockpit's button: no overlap */
  .hv-c-eval {
    margin-top: 12px;
  }
}

/* ---------------------------------------------------- flow (≥ 520 px wide) */

/* Rows Bestellen → Produzieren → Auswerten; stage labels in a left column. */
.hv-flow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.hv-flow-row {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}

.hv-flow-label {
  position: relative;
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-top: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
  line-height: 26px;
  color: var(--hv-stage-text);
  animation: hv-enter 0.6s ease both;
  animation-delay: calc(var(--hv-i, 0) * 90ms);
}

/* connector from this stage's hexagon down to the next one */
.hv-flow-row:not(:last-child) .hv-flow-label::before,
.hv-flow-row:not(:last-child) .hv-flow-label::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 38px;
  bottom: -10px;
  width: 2px;
  border-radius: 2px;
  background: var(--hv-stage-line);
}

.hv-flow-row:not(:last-child) .hv-flow-label::after {
  background: var(--hv-accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.6s ease;
}

.hv-flow-row.hv-flow-done:not(:last-child) .hv-flow-label::after {
  transform: scaleY(1);
}

.hv-flow-hex {
  width: 28px;
  height: 26px;
  font-size: 12px;
  font-weight: 700;
  color: var(--hv-accent-text);
}

.hv-flow-hex path {
  fill: var(--hv-surface);
  stroke: var(--hv-line);
  stroke-width: 4;
  transition: fill 0.3s ease;
}

.hv-flow-active .hv-flow-hex {
  color: var(--hv-on-accent);
}

.hv-flow-active .hv-flow-hex path {
  fill: var(--hv-accent);
  stroke: var(--hv-accent);
}

.hv-flow-content {
  container: hvcol / inline-size;
  min-width: 0;
}

/* app fragment: title + date chip, one dish card */
.hv-appstrip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--hv-app-bg);
}

.hv-appstrip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  min-height: 24px;
}

.hv-appstrip .hv-app-section {
  font-size: 13px;
}

.hv-app-confirm-sm {
  padding: 3px 8px;
  font-size: 11px;
}

.hv-f-eval {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.hv-f-eval > .hv-frag {
  flex: 1;
  display: flex;
}

.hv-f-eval .hv-float,
.hv-f-eval .hv-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@container hvcol (max-width: 340px) {
  .hv-f-eval {
    flex-direction: column;
  }
}

/* ------------------------------------------- mid widths (520–639 px) */

@container hv (max-width: 639px) {
  .hv-root,
  .hv-stage {
    --hv-phone-w: 236px;
  }

  .hv-flow-row {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .hv-deco-hex {
    left: 30px;
    width: 320px;
    height: 301px;
  }
}

/* ------------------------------------- compact (phones, < 520 px): scale */

/* Below 520 px the 520 px composition is kept and scaled down as a whole instead of stacking cards.
   tan(atan2(a, b)) turns the length ratio a / b into a plain number. */
.hv-fit {
  container: hvfit / inline-size;
  width: 100%;
  min-width: 0;
}

@container hvfit (max-width: 519px) {
  .hv-fit > .hv-root {
    width: 520px;
    zoom: tan(atan2(100cqw, 520px));
  }
}

/* ------------------------------------------------------------------ motion */

@keyframes hv-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes hv-float {
  from {
    transform: translateY(-3px);
  }
  to {
    transform: translateY(3px);
  }
}

@keyframes hv-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes hv-pop {
  0% {
    transform: scale(0.7);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes hv-arrive {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes hv-glow {
  0%,
  60% {
    border-color: var(--hv-accent);
  }
  100% {
    border-color: transparent;
  }
}

/* every value of a counter in one grid cell: it keeps the width of the widest (see Tick) */
.hv-tick-slot {
  display: inline-grid;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.hv-tick-slot > * {
  grid-area: 1 / 1;
}

.hv-tick-reserve {
  visibility: hidden;
}

.hv-tick {
  display: inline-block;
  animation: hv-tick 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes hv-tick {
  from {
    opacity: 0;
    transform: translateY(70%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hv-root,
  .hv-root *,
  .hv-root *::before,
  .hv-root *::after {
    animation: none !important;
    transition: none !important;
  }
}
