/* ==========================================================================
   BATCHES  (#batches) — "Learn German on your schedule"
   A sun rides an arc (Morning · Afternoon · Evening) while the sky and the
   scenery follow it: dawn -> noon -> dusk -> stars. Prefix: .batches / .batches-
   All the per-frame work is opacity + transform (set from JS), never layout.
   ========================================================================== */

.batches {
  --stage-h: clamp(480px, 46vw, 620px);
  --scene-h: clamp(150px, 24vw, 290px);
  --sun-d: clamp(64px, 6.6vw, 92px);
  --overlap: calc(var(--scene-h) * 0.15);
  --pgap: clamp(2rem, 4.5vw, 4.5rem);
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--sky-100) 20%, var(--sky-200) 100%);
  padding-bottom: calc(var(--section-y) * 0.85);
  overflow: clip;
}
.batches__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48% 38% at 86% 12%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 72%),
    radial-gradient(40% 34% at 6% 40%, color-mix(in srgb, var(--blue-400) 16%, transparent), transparent 70%);
}

/* ---------- Header + seal ---------- */
.batches__head {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  margin-bottom: clamp(2rem, 4.5vw, 3.5rem);
}
@media (min-width: 900px) {
  .batches__head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(2rem, 6vw, 6rem);
  }
}
.batches__head-copy {
  max-width: 50rem;
}
.batches__em {
  font-style: normal;
  color: var(--blue-600);
  background: linear-gradient(transparent 64%, color-mix(in srgb, var(--gold) 70%, transparent) 64% 92%, transparent 92%);
  padding-inline: 0.06em;
  white-space: nowrap;
}
.batches__seal {
  display: none; /* decorative: only on wide layouts where it sits beside the heading */
  width: clamp(132px, 13vw, 186px);
  aspect-ratio: 1;
  filter: drop-shadow(0 14px 26px rgba(10, 42, 92, 0.18));
}
@media (min-width: 900px) {
  .batches__seal {
    display: block;
  }
}
.batches__seal svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.batches-seal__disc {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}
.batches-seal__rim {
  fill: var(--navy-800);
}
.batches-seal__ring {
  transform-origin: 100px 100px;
  animation: batches-spin 38s linear infinite;
}
.batches-seal__ring text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  fill: var(--navy-800);
}
.batches-seal__sun {
  fill: var(--gold);
}
.batches-seal__gate {
  fill: #fff;
}
@keyframes batches-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   The stage
   ========================================================================== */
.batches-stage {
  position: relative;
  min-height: var(--stage-h);
  border-radius: var(--r-xl);
  /* trim the part hidden under the panel so its dark corners don't poke out beside it */
  clip-path: inset(0 0 var(--overlap) 0 round var(--r-xl) var(--r-xl) 0 0);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size; /* cloud drift distance = 100cqw */
  background: var(--navy-800);
  box-shadow: var(--shadow-lg);
}
.batches-stage > * {
  position: absolute;
}
.batches-sky,
.batches-stars,
.batches-clouds,
.batches-birds,
.batches-arc,
.batches-stops {
  inset: 0;
}
.batches-clouds,
.batches-birds,
.batches-stars,
.batches-scenery,
.batches-moon,
.batches-arc {
  pointer-events: none;
}

/* ---- sky: five stacked gradients, cross-faded by opacity from JS ---- */
.batches-sky__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.batches-sky__layer--dawn {
  opacity: 1; /* static / no-JS default */
  background:
    radial-gradient(70% 62% at 14% 86%, color-mix(in srgb, var(--gold) 60%, transparent), transparent 70%),
    linear-gradient(180deg, var(--blue-300) 0%, var(--sky-200) 52%, color-mix(in srgb, var(--gold-soft) 82%, var(--rot) 18%) 100%);
}
.batches-sky__layer--noon {
  background:
    radial-gradient(60% 46% at 50% 6%, rgba(255, 255, 255, 0.4), transparent 70%),
    linear-gradient(180deg, var(--blue-500) 0%, var(--blue-400) 38%, var(--blue-300) 72%, var(--sky-100) 100%);
}
.batches-sky__layer--dusk {
  background:
    radial-gradient(72% 62% at 86% 86%, color-mix(in srgb, var(--gold) 62%, transparent), transparent 70%),
    linear-gradient(
      180deg,
      var(--navy-800) 0%,
      var(--navy-600) 32%,
      color-mix(in srgb, var(--rot) 52%, var(--navy-600)) 66%,
      color-mix(in srgb, var(--gold) 66%, var(--rot)) 100%
    );
}
.batches-sky__layer--night {
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 52%, var(--navy-700) 100%);
}

/* ---- stars + moon (evening / pre-dawn) ---- */
.batches-stars {
  opacity: 0;
}
.batches-star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  animation: batches-twinkle var(--d) ease-in-out var(--dl) infinite alternate;
}
.batches-star--big {
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.8);
}
@keyframes batches-twinkle {
  from {
    opacity: 0.25;
  }
  to {
    opacity: 1;
  }
}
.batches-moon {
  left: 8%;
  top: 22%;
  width: clamp(52px, 6vw, 84px);
  fill: var(--sky-100);
  filter: drop-shadow(0 0 14px rgba(207, 230, 255, 0.65));
  opacity: 0;
}

/* ---- clouds + birds ---- */
.batches-clouds {
  overflow: hidden;
}
.batches-cloud {
  position: absolute;
  left: 0;
  top: var(--y);
  height: auto;
  fill: var(--white);
  opacity: 0.94;
  animation: batches-drift var(--dur) linear var(--delay) infinite;
}
.batches-cloud--1 { --y: 17%; --x: 62%; --dur: 95s; --delay: -22s; width: clamp(112px, 18.5cqw, 230px); }
.batches-cloud--2 { --y: 31%; --x: 12%; --dur: 130s; --delay: -80s; width: clamp(80px, 12cqw, 150px); opacity: 0.7; }
.batches-cloud--3 { --y: 11%; --x: 30%; --dur: 110s; --delay: -50s; width: clamp(100px, 15cqw, 190px); opacity: 0.8; }
.batches-cloud--4 { --y: 40%; --x: 80%; --dur: 150s; --delay: -10s; width: clamp(70px, 9.5cqw, 120px); opacity: 0.55; }
@keyframes batches-drift {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(calc(100cqw + 100%));
  }
}
.batches-birds {
  opacity: 0;
  overflow: hidden;
}
.batches-bird {
  position: absolute;
  left: 0;
  height: auto;
  fill: none;
  stroke: var(--navy-800);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: batches-fly var(--dur) linear var(--delay) infinite;
}
.batches-bird path {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: batches-flap 0.7s ease-in-out infinite alternate;
}
.batches-bird--1 { top: 24%; --dur: 34s; --delay: -6s; }
.batches-bird--2 { top: 29%; --dur: 40s; --delay: -14s; }
.batches-bird--3 { top: 21%; --dur: 46s; --delay: -26s; }
@keyframes batches-fly {
  0% { transform: translate3d(-60px, 6px, 0); }
  50% { transform: translate3d(50cqw, -14px, 0); }
  100% { transform: translate3d(calc(100cqw + 60px), 4px, 0); }
}
@keyframes batches-flap {
  to {
    transform: scaleY(0.45);
  }
}

/* ---- arc + stop markers ---- */
.batches-arc {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.batches-arc path {
  fill: none;
  stroke-linecap: round;
}
.batches-arc__shadow {
  stroke: color-mix(in srgb, var(--navy-900) 22%, transparent);
  stroke-width: 4;
  stroke-dasharray: 0.1 11;
  transform: translateY(1.5px);
}
.batches-arc__track {
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 3;
  stroke-dasharray: 0.1 11;
}
.batches-arc__trail {
  stroke: var(--gold);
  stroke-width: 4;
  stroke-dasharray: 0 2;
}
.batches-stops {
  pointer-events: none;
}
.batches-stop {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
}
.batches-stop::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--navy-800), 0 4px 10px rgba(6, 27, 63, 0.3);
  transition: transform var(--dur-base) var(--ease-spring);
}
.batches-stop:hover::before {
  transform: scale(1.35);
}
.batches-stop i {
  position: absolute;
  top: calc(100% - 4px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  font-style: normal;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: #fff;
  padding: 0.18rem 0.65rem;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--navy-900) 62%, transparent); /* keeps the label readable on any sky */
  white-space: nowrap;
  letter-spacing: 0.02em;
}
@media (min-width: 900px) {
  .batches-stop i {
    display: block;
  }
}

.batches-stop.is-active::before,
.batches-stop.is-active i {
  opacity: 0; /* the sun is sitting on this stop */
}
.batches-stop::before,
.batches-stop i {
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}

/* until the script has positioned them, the sun and stop markers would sit at the stage's top-left corner */
html.js .batches:not(.is-enhanced) .batches-sun,
html.js .batches:not(.is-enhanced) .batches-stop {
  opacity: 0;
}

/* ---- the sun ---- */
.batches-sun {
  left: 0;
  top: 0;
  width: var(--sun-d);
  height: var(--sun-d);
  margin: calc(var(--sun-d) / -2) 0 0 calc(var(--sun-d) / -2);
  touch-action: none;
  cursor: grab;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}
.batches-sun::after {
  /* generous hit area for fingers */
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
}
.batches-sun.is-dragging {
  cursor: grabbing;
}
.batches-sun > span {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.batches-sun__disc {
  inset: 0;
}
.batches-sun__disc--cool {
  background: radial-gradient(circle at 36% 30%, #fff 0%, var(--gold-soft) 38%, var(--gold) 78%, var(--gold-deep) 100%);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.32);
}
.batches-sun__disc--warm {
  background: radial-gradient(circle at 36% 30%, var(--gold-soft) 0%, var(--gold) 38%, var(--gold-deep) 70%, var(--rot) 140%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 38%, transparent);
  opacity: 0;
}
.batches-sun__glow {
  inset: -105%;
}
.batches-sun__glow--cool {
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.85) 0%, rgba(255, 244, 196, 0.45) 36%, transparent 72%);
}
.batches-sun__glow--warm {
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 80%, transparent) 0%, color-mix(in srgb, var(--rot) 30%, transparent) 44%, transparent 74%);
  opacity: 0;
}
.batches-sun__rays {
  inset: -240%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.5) 0 3deg, transparent 3deg 14deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 14%, transparent 70%);
  mask-image: radial-gradient(closest-side, #000 14%, transparent 70%);
  opacity: 0.5;
  animation: batches-spin 70s linear infinite;
}
.batches-sun__hint {
  position: absolute;
  left: calc(100% + 16px);
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.45rem 0.9rem;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 800;
  white-space: nowrap;
  color: var(--navy-900);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity var(--dur-base) var(--ease-out), visibility var(--dur-base);
  animation: batches-hint 2s var(--ease-in-out) infinite;
}
.batches-sun__hint .icon {
  width: 1.1rem;
  height: 1.1rem;
}
.batches-stage.is-hint-off .batches-sun__hint {
  opacity: 0;
  visibility: hidden;
}
@keyframes batches-hint {
  50% {
    transform: translate(8px, -50%);
  }
}

/* ---- scenery: hills, the Brandenburg Gate, little houses ---- */
.batches-scenery {
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: var(--scene-h);
}
.batches-hill--far { fill: var(--navy-600); }
.batches-hill--mid { fill: var(--navy-700); }
.batches-hill--near { fill: var(--navy-900); }
.batches-houses { fill: var(--navy-800); }
.batches-gate { fill: var(--navy-800); }
.batches-shade {
  fill: var(--navy-950);
  opacity: 0;
}
.batches-windows {
  fill: var(--gold);
  opacity: 0.45;
}

/* ---- the accessible control: WAI-ARIA tabs ---- */
.batches-control {
  top: clamp(14px, 2vw, 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 5px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.84);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: var(--shadow-md);
  max-width: calc(100% - 16px);
}
.batches-control__thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 3);
  border-radius: var(--r-pill);
  background: var(--navy-800);
  box-shadow: 0 6px 16px rgba(10, 42, 92, 0.35);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.55s var(--ease-spring);
}
.batches-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 1.15rem;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
  color: var(--navy-800);
  transition: color var(--dur-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.batches-tab .icon {
  width: 1.15rem;
  height: 1.15rem;
}
.batches-tab[aria-selected="true"] {
  color: #fff;
}
.batches-tab:focus-visible {
  outline-offset: 2px;
  border-radius: var(--r-pill);
}
@media (max-width: 430px) {
  .batches-tab {
    padding: 0 0.55rem;
  }
  .batches-tab .icon {
    display: none;
  }
}

/* ==========================================================================
   Info card (overlaps the stage)
   ========================================================================== */
.batches-panel {
  position: relative;
  z-index: 3;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  margin: calc(var(--overlap) * -1) clamp(0px, 3vw, 2.75rem) 0;
  padding: clamp(1.5rem, 3.2vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.batches-panel::before {
  /* tricolour tab on the top edge */
  content: "";
  position: absolute;
  top: -1px;
  left: clamp(1.5rem, 3.2vw, 2.75rem);
  width: 72px;
  height: 6px;
  border-radius: 0 0 4px 4px;
  background: var(--grad-flag);
}
@media (min-width: 900px) {
  .batches-panel {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    column-gap: var(--pgap);
  }
  .batches-panel__side {
    position: relative;
  }
  .batches-panel__side::before {
    /* divider centred in the column gap */
    content: "";
    position: absolute;
    left: calc(var(--pgap) / -2);
    top: 0.25rem;
    bottom: 0.25rem;
    width: 1px;
    background: var(--line);
  }
}
.batches-panel__main {
  display: grid;
  gap: 1.4rem;
  align-content: start;
}

/* ---- slides: stacked in one grid cell so the height never jumps ---- */
.batches-slides {
  display: grid;
}
.batches-slide {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
html.js .batches-slide {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
html.js .batches-slide.is-active,
html.js .batches-slide.is-leaving {
  visibility: visible;
  pointer-events: auto;
}
html.js .batches-slide.is-active {
  opacity: 1;
}
.batches-slide__greet {
  font-size: var(--fs-script);
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.batches-slide__title span {
  display: inline-block; /* two-sentence titles wrap between the sentences */
}
.batches-slide__title {
  font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.035em;
  color: var(--navy-800);
  max-width: 16em;
}
.batches-slide__text {
  font-size: var(--fs-base);
  color: var(--ink-soft);
  max-width: 34em;
  margin-bottom: 0.4rem;
}
.batches-slide__fit {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: auto; /* all three slides end on the same baseline */
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  background: var(--sky-50);
  border: 1px solid var(--line);
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy-800);
}
.batches-slide__fit .icon {
  color: var(--blue-600);
  margin-top: 0.1rem;
}
.batches-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-soft);
}
.batches-ticks li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.batches-ticks .icon {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--blue-600);
}

/* ---- side: level chips + WhatsApp ---- */
.batches-panel__side {
  display: grid;
  gap: 1.15rem;
  align-content: start;
}
@media (min-width: 900px) {
  .batches-panel__side {
    align-content: center;
  }
}
.batches-levels {
  display: grid;
  gap: 0.7rem;
}
.batches-levels__label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--navy-800);
}
.batches-levels__label span {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-mute);
}
.batches-levels__row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
@media (max-width: 719px) {
  .batches-levels__row {
    padding-bottom: 5rem; /* clears the floating action button */
  }
}
.batches-chip {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.15rem;
  min-height: 62px;
  padding: 0.55rem 0.25rem;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 2px solid var(--line-strong);
  color: var(--navy-800);
  transition: transform var(--dur-base) var(--ease-spring), background-color var(--dur-base), border-color var(--dur-base),
    color var(--dur-base), box-shadow var(--dur-base);
  -webkit-tap-highlight-color: transparent;
}
.batches-chip b {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1;
}
.batches-chip small {
  font-size: max(var(--fs-xs), 0.8125rem);
  font-weight: 600;
  color: var(--ink-mute);
  line-height: 1.1;
}
.batches-chip:hover {
  transform: translateY(-2px);
  border-color: var(--blue-500);
}
.batches-chip[aria-pressed="true"] {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-blue);
}
.batches-chip[aria-pressed="true"] small {
  color: rgba(255, 255, 255, 0.88);
}
.batches-cta {
  width: 100%;
  border-radius: var(--r-lg); /* a pill looks blobby once the label wraps to 3–4 lines on phones */
  white-space: normal; /* the batch name makes the label long — let it wrap on phones */
  text-align: left;
  line-height: 1.22;
  justify-content: flex-start;
  gap: 0.9rem;
}
.batches-cta .btn__icon {
  width: 1.7rem;
  height: 1.7rem;
}
.batches-panel__note {
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink-mute);
}

/* ==========================================================================
   Fallbacks
   ========================================================================== */
/* offscreen: freeze every ambient loop */
.batches.is-paused *,
.batches.is-paused *::before,
.batches.is-paused *::after {
  animation-play-state: paused !important;
}

/* No JS: nothing is interactive, so show all three batches as a plain list */
html.no-js .batches-control,
html.no-js .batches-levels,
html.no-js .batches-sun__hint,
html.no-js .batches-stops {
  display: none;
}
html.no-js .batches-slides {
  gap: 1.75rem;
}
html.no-js .batches-slide {
  grid-area: auto;
}
html.no-js .batches-sun {
  left: 16%;
  top: 62%;
}

/* Reduced motion: still scenery, no drifting/spinning/twinkling */
@media (prefers-reduced-motion: reduce) {
  .batches-cloud {
    animation: none;
    left: var(--x);
  }
  .batches-bird,
  .batches-bird path,
  .batches-star,
  .batches-seal__ring,
  .batches-sun__rays,
  .batches-sun__hint {
    animation: none;
  }
  .batches-birds {
    display: none;
  }
  .batches-control__thumb,
  .batches-chip {
    transition-duration: 0.001ms;
  }
}
