/*
 * KAPOCS front page – CASES (P4): S6 Összetett helyzetek.
 * Prefix: .ksf-cases*.
 *
 * S6 morph rule: every case element has a resting state with no transition and an
 * "on" state under .ksf-cases__panel[data-case="…"] that carries the transition.
 * Leaving a case therefore resets instantly; entering it plays once.
 */

/* ================================================================== */
/* S6 · Összetett helyzetek                                            */
/* ================================================================== */

.ksf-cases {
  --ksf-cases-pad: 28px;
  --ksf-cases-head: 36px;
  --ksf-cases-row: minmax(0, 1fr);
  --ksf-cases-dayrow: 26px;
}

@media (pointer: coarse) {
  .ksf-cases {
    --ksf-cases-head: 50px;
  }
}

.ksf-cases__body {
  row-gap: 24px;
}

.ksf-cases__app {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 1;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  column-gap: var(--ksf-gap);
}

/* Without JS the widget is replaced by a plain list of the six cases. */
html:not(.ks-js) .ksf-cases__app,
.ks-js .ksf-cases__list {
  display: none;
}

/* ---------- Tabs: vertical list (≥ 1080) ---------- */
.ksf-cases__tabs {
  position: relative;
  display: flex;
  flex-direction: column;
  grid-column: 1 / 5;
  gap: 4px;
  margin: 0;
  padding: 0 0 0 20px;
}

/* the track the indicator slides on */
.ksf-cases__tabs::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--ks-line);
  content: "";
}

.ksf-cases__ind {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 2px;
  height: 1px;
  background: var(--ks-teal);
  transform: scaleY(0);
  transform-origin: 0 0;
  pointer-events: none;
}

html.ks-motion .ksf-cases__ind.is-live {
  transition: transform var(--ksf-dur-m) var(--ksf-ease-in-out);
}

.ksf-cases__tab {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  color: var(--ks-copy);
  background: transparent;
  font: 600 15px/1.3 var(--ksf-body);
  letter-spacing: -.005em;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition:
    color var(--ksf-dur-s) var(--ksf-ease-out),
    background-color var(--ksf-dur-s) var(--ksf-ease-out),
    box-shadow var(--ksf-dur-s) var(--ksf-ease-out);
}

.ksf-cases__tab .ksf-num {
  flex: none;
  min-width: 2ch;
  color: var(--ks-copy);
  font-size: 13px;
  transition: color var(--ksf-dur-s) var(--ksf-ease-out);
}

.ksf-cases__tab.is-on {
  color: var(--ks-ink);
  background: var(--ks-mint);
  box-shadow: 0 0 0 1px rgba(23, 142, 139, .36);
}

.ksf-cases__tab.is-on .ksf-num {
  color: var(--ks-teal-dark);
}

@media (hover: hover) and (pointer: fine) {
  .ksf-cases__tab:not(.is-on):hover {
    color: var(--ks-ink);
    background: rgba(13, 43, 56, .035);
  }
}

.ksf-cases__tab:focus-visible {
  color: var(--ks-ink);
}

/* ---------- Panel ---------- */
.ksf-cases__panel {
  position: relative;
  display: grid;
  grid-column: 5 / 13;
  grid-template-rows: auto minmax(0, 1fr) auto;
  aspect-ratio: 16 / 10;
  padding: var(--ksf-cases-pad);
  border-radius: var(--ksf-r-card);
  background: #fff;
  box-shadow: var(--ksf-sh-2);
}

.ksf-cases__title {
  display: grid;
  align-items: center;
  height: var(--ksf-cases-head);
  margin: 0 0 12px;
  padding-right: 200px;
  color: var(--ks-ink);
  font: 700 15px/1.2 var(--ks-display);
  letter-spacing: -.01em;
  white-space: nowrap;
}

.ksf-cases__title > span {
  grid-area: 1 / 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ksf-cases__stage {
  container: ksf-cases / inline-size;
  min-height: 0;
}

.ksf-cases__grid {
  position: relative;
  display: grid;
  grid-template-columns: 44px repeat(3, minmax(0, 1fr));
  grid-template-rows: var(--ksf-cases-dayrow) repeat(4, var(--ksf-cases-row));
  gap: 8px;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.ksf-cases__day,
.ksf-cases__per {
  display: grid;
  align-items: center;
  color: var(--ks-copy);
  font: 600 12px/1.2 var(--ksf-body);
}

.ksf-cases__day {
  grid-row: 1;
  justify-items: center;
}

.ksf-cases__day > span {
  grid-area: 1 / 1;
}

.ksf-cases__short {
  display: none;
}

.ksf-cases__per {
  grid-column: 1;
  justify-items: center;
  font-variant-numeric: tabular-nums lining-nums;
}

.ksf-cases__cell {
  position: relative;
  min-width: 0;
  min-height: 0;
}

/* Lesson card: the solver's recipe (.kso-lesson). */
.ksf-cases__l {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 10px 6px 12px;
  overflow: hidden;
  border-left: 3px solid var(--c);
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 12%, #fff);
  box-shadow: 0 2px 6px rgba(13, 57, 69, .07);
}

.ksf-cases__l b,
.ksf-cases__merge b {
  overflow: hidden;
  color: var(--ks-ink);
  font: 600 13px/1.2 var(--ksf-body);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ksf-cases__meta {
  overflow: hidden;
  color: color-mix(in srgb, var(--c) 70%, #0d2b38);
  font: 600 11px/1.2 var(--ksf-body);
  letter-spacing: .04em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Captions (the six tab panels share one slot: no height change) ---------- */
.ksf-cases__caps {
  display: grid;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ks-line);
}

.ksf-cases__cap {
  grid-area: 1 / 1;
  min-width: 0;
  border-radius: 6px;
  transition: opacity var(--ksf-dur-s) var(--ksf-ease-out), visibility 0s linear 0s;
}

.ksf-cases__cap[hidden] {
  display: block;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--ksf-dur-s) var(--ksf-ease-out), visibility 0s linear var(--ksf-dur-s);
}

.ksf-cases__cap p {
  max-width: 62ch;
  margin: 0;
  color: var(--ks-ink);
  font-size: 15px;
  line-height: 1.55;
}

/* A hét · B hét: lives in the A/B panel, sits in the panel head. */
.ksf-cases__seg {
  position: absolute;
  z-index: 2;
  top: var(--ksf-cases-pad);
  right: var(--ksf-cases-pad);
  display: inline-flex;
  align-items: center;
  height: var(--ksf-cases-head);
  padding: 3px;
  border-radius: var(--ksf-r-chip);
  background: var(--ks-mist);
  box-shadow: inset 0 0 0 1px var(--ks-line);
}

.ksf-cases__seg button {
  height: 100%;
  min-width: 64px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: var(--ksf-r-chip);
  color: var(--ks-copy);
  background: transparent;
  font: 600 13px/1 var(--ksf-body);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--ksf-dur-s) var(--ksf-ease-out), background-color var(--ksf-dur-s) var(--ksf-ease-out), box-shadow var(--ksf-dur-s) var(--ksf-ease-out);
}

.ksf-cases__seg button[aria-pressed="true"] {
  color: var(--ks-ink);
  background: #fff;
  box-shadow: var(--ksf-sh-1), 0 0 0 1px rgba(23, 142, 139, .36);
}

@media (hover: hover) and (pointer: fine) {
  .ksf-cases__seg button[aria-pressed="false"]:hover {
    color: var(--ks-ink);
  }
}

.ksf-cases__seg button:focus-visible {
  outline-offset: 1px;
}

/* ---------- Case states ---------- */

/* Párhuzamos blokkok: the Kedd view of 7.a, 7.b and 8.a crossfades in. */
.ksf-cases__par {
  opacity: 0;
}

.ksf-cases__panel[data-case="parallel"] .ksf-cases__par {
  opacity: 1;
  transition: opacity var(--ksf-dur-m) var(--ksf-ease-in-out);
}

.ksf-cases__panel[data-case="parallel"] .ksf-cases__base {
  opacity: 0;
  transition: opacity var(--ksf-dur-m) var(--ksf-ease-in-out);
}

/* The 8.a / 8.b block: two groups stacked in each class, like the app's group cells. */
.ksf-cases__duo {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
}

.ksf-cases__duo > .ksf-cases__half {
  transform: none;
}

.ksf-cases__duo > .ksf-cases__half > * {
  opacity: 1;
}

/* A/B hetek: Kedd 4. flips between Fizika (A) and Kémia (B). */
.ksf-cases__flip {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: perspective(520px) rotateX(0);
  transition: transform 210ms var(--ksf-ease-out);
}

.ksf-cases__flip.is-out {
  transform: perspective(520px) rotateX(90deg);
  transition: transform 210ms var(--ksf-ease-in);
}

.ksf-cases__panel[data-case="ab"] .ksf-cases__flip {
  opacity: 1;
}

.ksf-cases__panel[data-case="ab"] [data-cell="1-3"] > .ksf-cases__base {
  opacity: 0;
}

.ksf-cases__panel[data-week="a"] .ksf-cases__face.is-b,
.ksf-cases__panel[data-week="b"] .ksf-cases__face.is-a {
  opacity: 0;
}

.ksf-cases__cell::after {
  position: absolute;
  inset: -4px;
  border-radius: 11px;
  box-shadow: 0 0 0 2px rgba(23, 142, 139, .5);
  content: "";
  opacity: 0;
  pointer-events: none;
}

.ksf-cases__panel[data-case="ab"] [data-cell="1-3"]::after {
  opacity: 1;
  transition: opacity var(--ksf-dur-m) var(--ksf-ease-out);
}

/* Dupla és tripla órák: Szerda 3.–4. become one block that grows from the top cell. */
.ksf-cases__merge {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 10px 6px 15px;
  opacity: 0;
}

.ksf-cases__merge-bg {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-left: 3px solid var(--c);
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 12%, #fff);
  box-shadow: 0 2px 6px rgba(13, 57, 69, .07);
  transform: scaleY(.48);
  transform-origin: 50% 0;
}

.ksf-cases__merge > b,
.ksf-cases__merge > .ksf-cases__meta {
  opacity: 0;
}

.ksf-cases__merge b {
  white-space: normal;
}

.ksf-cases__panel[data-case="double"] .ksf-cases__merge {
  opacity: 1;
}

.ksf-cases__panel[data-case="double"] .ksf-cases__merge-bg {
  transform: none;
  transition: transform 420ms var(--ksf-ease-out);
}

.ksf-cases__panel[data-case="double"] .ksf-cases__merge > * {
  opacity: 1;
  transition: opacity 240ms var(--ksf-ease-out) 220ms;
}

.ksf-cases__panel[data-case="double"] :is([data-cell="2-2"], [data-cell="2-3"]) > .ksf-cases__base {
  opacity: 0;
  transition: opacity var(--ksf-dur-s) var(--ksf-ease-out);
}

/* Csoportbontások: Hétfő 3. splits into two groups, each in its own room. */
.ksf-cases__split {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  opacity: 0;
}

.ksf-cases__half {
  position: relative;
  inset: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 2px 8px 2px 10px;
  border-radius: 6px;
  transform: scaleX(0);
}

.ksf-cases__half > * {
  opacity: 0;
}

.ksf-cases__half b {
  font-size: 12.5px;
}

.ksf-cases__half .ksf-cases__grp {
  font-weight: 500;
}

.ksf-cases__panel[data-case="split"] .ksf-cases__split {
  opacity: 1;
}

.ksf-cases__panel[data-case="split"] .ksf-cases__half {
  transform: none;
  transition: transform 420ms var(--ksf-ease-out);
}

.ksf-cases__panel[data-case="split"] .ksf-cases__half > * {
  opacity: 1;
  transition: opacity 220ms var(--ksf-ease-out) 260ms;
}

.ksf-cases__panel[data-case="split"] [data-cell="0-2"] > .ksf-cases__base {
  opacity: 0;
  transition: opacity 160ms var(--ksf-ease-out);
}

/* Többtanáros, többtermes órák: Szerda 1. shows two teachers and two rooms. */
.ksf-cases__res {
  display: none;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

.ksf-cases__res > i {
  padding: 1px 5px;
  border-radius: var(--ksf-r-chip);
  font: 600 10.5px/1.45 var(--ksf-body);
  font-style: normal;
  white-space: nowrap;
}

.ksf-cases__res > .is-t {
  color: color-mix(in srgb, var(--c) 70%, #0d2b38);
  background: color-mix(in srgb, var(--c) 22%, #fff);
  letter-spacing: .04em;
}

.ksf-cases__res > .is-r {
  color: var(--ks-ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(13, 43, 56, .14);
}

.ksf-cases__res > i:nth-child(2) { --i: 1; }
.ksf-cases__res > i:nth-child(3) { --i: 2; }
.ksf-cases__res > i:nth-child(4) { --i: 3; }

.ksf-cases__panel[data-case="multi"] .ksf-cases__res {
  display: flex;
}

.ksf-cases__panel[data-case="multi"] [data-cell="2-0"] > .ksf-cases__base > .ksf-cases__meta {
  display: none;
}

/* When the four tags need a second line, the card grows over the gap below. */
.ksf-cases__panel[data-case="multi"] [data-cell="2-0"] > .ksf-cases__base {
  z-index: 2;
  bottom: auto;
  min-height: 100%;
  box-shadow: 0 2px 6px rgba(13, 57, 69, .07), 0 10px 24px -12px rgba(13, 43, 56, .28);
}

.ksf-cases__panel[data-case="multi"] .ksf-cases__res > i {
  animation: ksf-cases-pop 300ms var(--ksf-ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 60ms + 80ms);
}

/* Több telephely: Bakos András's two Kedd lessons, two buildings, travel time between.
   The badge is a child of the lesson card (right-centred here, the card's third line
   in the narrow grid), so it always reads as part of that lesson. */
.ksf-cases__badge {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 8px;
  display: none;
  padding: 2px 8px;
  border-radius: var(--ksf-r-chip);
  color: var(--ks-teal-dark);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(23, 142, 139, .45), 0 2px 6px rgba(13, 57, 69, .08);
  font: 600 11px/1.35 var(--ksf-body);
  font-style: normal;
  white-space: nowrap;
  translate: 0 -50%;
}

.ksf-cases__bs {
  display: none;
}

.ksf-cases__panel[data-case="sites"] .ksf-cases__badge {
  display: block;
  animation: ksf-cases-pop 300ms var(--ksf-ease-out) backwards;
}

.ksf-cases__panel[data-case="sites"] .ksf-cases__badge[data-trip="to"] {
  animation-delay: 760ms;
}

/* Measured overlay (cases.js): the Fakultáció frame and the travel path. */
.ksf-cases__ink {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ksf-cases__fac {
  fill: none;
  stroke: var(--ks-teal);
  stroke-width: 1.5;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.ksf-cases__panel[data-case="parallel"] .ksf-cases__fac {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset var(--ksf-dur-xl) var(--ksf-ease-in-out) 200ms;
}

.ksf-cases__trip {
  fill: none;
  stroke: var(--ks-teal);
  stroke-width: 1.75;
  stroke-dasharray: 2 5;
  stroke-linecap: round;
  opacity: 0;
}

.ksf-cases__trip-mask {
  fill: none;
  stroke: #fff;
  stroke-width: 10;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.ksf-cases__panel[data-case="sites"] .ksf-cases__trip {
  opacity: 1;
}

.ksf-cases__panel[data-case="sites"] .ksf-cases__trip-mask {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 600ms var(--ksf-ease-in-out) 220ms;
}

.ksf-cases__tag {
  position: absolute;
  z-index: 4;
  top: var(--y, 0);
  left: var(--x, 0);
  display: none;
  padding: 2px 9px;
  border-radius: var(--ksf-r-chip);
  color: var(--ks-teal-dark);
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--ks-teal);
  font: 600 11px/1.35 var(--ksf-body);
  white-space: nowrap;
  translate: -50% -50%;
}

/* "utazási idő" stands upright just left of the path, inside the empty right edge of
   the Kedd column: it labels the whole way, not the boundary between two lessons. */
.ksf-cases__tag--trip {
  padding: 9px 2px;
  line-height: 1.2;
  writing-mode: vertical-rl;
  translate: -100% -50%;
}

.ksf-cases__panel[data-case="parallel"] .ksf-cases__tag--fac,
.ksf-cases__panel[data-case="sites"] .ksf-cases__tag--trip {
  display: block;
  animation: ksf-cases-pop 300ms var(--ksf-ease-out) backwards;
}

/* The block label hangs from the frame's bottom edge, below the grid, so it never
   covers the lower group's teacher. */
.ksf-cases__tag--fac {
  translate: -50% -30%;
}

.ksf-cases__panel[data-case="parallel"] .ksf-cases__tag--fac {
  animation-delay: 760ms;
}

.ksf-cases__panel[data-case="sites"] .ksf-cases__tag--trip {
  animation-delay: 520ms;
}

@keyframes ksf-cases-pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(.94);
  }
}

/* ---------- Mid grid (small desktops, 1080–1199px): the four tags still fit on one line ---------- */
@container ksf-cases (min-width: 520px) and (max-width: 719px) {
  .ksf-cases__res {
    gap: 2px;
  }

  .ksf-cases__res > i {
    padding: 0 4px;
    font-size: 10px;
  }

  .ksf-cases__res > .is-t {
    letter-spacing: .02em;
  }

  .ksf-cases__half b {
    font-size: 11.5px;
  }

  .ksf-cases__half .ksf-cases__meta {
    font-size: 10.5px;
  }

  /* "Német 2. csop." leaves room for "NA · Nyelvi 2" on the same line. */
  .ksf-cases__grp .ksf-cases__long,
  .ksf-cases__sep {
    display: none;
  }

  .ksf-cases__grp .ksf-cases__short {
    display: inline;
  }
}

/* ---------- Narrow grid (container < 520px): short day names, compact cards ---------- */
@container ksf-cases (max-width: 519px) {
  .ksf-cases__grid {
    grid-template-columns: 16px repeat(3, minmax(0, 1fr));
    gap: 6px 5px;
  }

  .ksf-cases__day,
  .ksf-cases__per {
    font-size: 11px;
  }

  .ksf-cases__long {
    display: none;
  }

  .ksf-cases__short {
    display: inline;
  }

  .ksf-cases__l,
  .ksf-cases__merge {
    gap: 1px;
    padding: 4px 5px 4px 7px;
  }

  .ksf-cases__merge {
    padding-left: 9px;
  }

  .ksf-cases__l b,
  .ksf-cases__merge b {
    font-size: 11px;
  }

  .ksf-cases__meta {
    font-size: 10.5px;
  }

  .ksf-cases__half {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    row-gap: 0;
    padding: 1px 4px 1px 6px;
  }

  .ksf-cases__half b {
    font-size: 10.5px;
    line-height: 1.15;
  }

  .ksf-cases__half .ksf-cases__meta {
    font-size: 10.5px;
    line-height: 1.15;
  }

  /* "Német 2. csop." fits the narrow half; the wide card keeps "Német · 2. csoport". */
  .ksf-cases__sep {
    display: none;
  }

  /* Teachers on one line, each room on its own line; the card grows over the gap below. */
  .ksf-cases__res {
    gap: 2px 3px;
    margin-top: 1px;
  }

  .ksf-cases__res > i {
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.4;
  }

  .ksf-cases__res > .is-t {
    letter-spacing: .02em;
  }

  /* The building is the card's third line, so it can only belong to that lesson. */
  .ksf-cases__badge {
    position: static;
    justify-self: start;
    max-width: 100%;
    margin-top: 1px;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    background: none;
    box-shadow: none;
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    translate: none;
  }

  .ksf-cases__tag {
    padding: 1px 7px;
    font-size: 10px;
  }

  /* The travel path runs down the gutter right of the Kedd column (cases.js reads the
     mode); its label stands upright beside it, inside the empty right edge of the column. */
  .ksf-cases__grid {
    --ksf-cases-trip: gutter;
  }

  .ksf-cases__tag--trip {
    padding: 8px 1px;
  }
}

/* The narrowest phones (grid < 300px): the short building name, tighter half cards. */
@container ksf-cases (max-width: 299px) {
  .ksf-cases__bl {
    display: none;
  }

  .ksf-cases__bs {
    display: inline;
  }

  .ksf-cases__half {
    padding-right: 2px;
    padding-left: 5px;
  }
}

/* ---------- Below 1080: chip rail on top, panel below, fixed row heights ---------- */
@media (max-width: 1079px) {
  .ksf-cases {
    --ksf-cases-pad: 24px;
    --ksf-cases-row: 64px;
    --ksf-cases-head: 50px;
  }

  .ksf-cases__app {
    display: block;
  }

  .ksf-cases__tabs {
    flex-direction: row;
    gap: 8px;
    margin: -6px -24px 16px;
    padding: 6px 24px 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 24px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .ksf-cases__tabs::-webkit-scrollbar {
    display: none;
  }

  .ksf-cases__tabs::before {
    display: none;
  }

  .ksf-cases__ind {
    top: auto;
    bottom: 4px;
    width: 1px;
    height: 2px;
    transform: scaleX(0);
  }

  .ksf-cases__tab {
    flex: none;
    width: auto;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--ks-line);
    border-radius: var(--ksf-r-chip);
    background: #fff;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .ksf-cases__tab.is-on {
    border-color: transparent;
  }

  .ksf-cases__tab .ksf-num {
    display: none;
  }

  .ksf-cases__panel {
    aspect-ratio: auto;
    min-height: 320px;
  }

  .ksf-cases__grid {
    height: auto;
  }
}

@media (max-width: 1079px) and (pointer: coarse) {
  .ksf-cases__tab {
    min-height: 44px;
  }
}

@media (max-width: 680px) {
  .ksf-cases {
    --ksf-cases-pad: 16px;
    --ksf-cases-row: 58px;
    --ksf-cases-dayrow: 20px;
  }

  .ksf-cases__tabs {
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }

  .ksf-cases__title {
    margin-bottom: 10px;
    padding-right: 150px;
    font-size: 14px;
  }

  .ksf-cases__seg button {
    min-width: 0;
    padding: 0 12px;
  }

  .ksf-cases__caps {
    margin-top: 18px;
    padding-top: 14px;
  }

  .ksf-cases__cap p {
    font-size: 14.5px;
  }
}

/* No JS: the six cases as a plain definition list. */
.ksf-cases__list {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px var(--ksf-gap);
  margin: 0;
}

.ksf-cases__list > div {
  padding-top: 20px;
  border-top: 1px solid var(--ks-line);
}

.ksf-cases__list dt {
  margin: 0 0 8px;
  color: var(--ks-ink);
  font: 700 17px/1.3 var(--ks-display);
  letter-spacing: -.01em;
}

.ksf-cases__list dd {
  margin: 0;
  color: var(--ks-copy);
  font-size: 15px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .ksf-cases__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .ksf-cases__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

/* Reduced motion, ?ksf-static: every morph lands on its final state at once. */
html:not(.ks-motion) .ksf-cases__panel *,
html:not(.ks-motion) .ksf-cases__panel *::after,
html:not(.ks-motion) .ksf-cases__tabs * {
  transition: none !important;
  animation: none !important;
}
