/* ==========================================================================
   Responsive layer (tablet <= 980px, phone <= 767px) + card-link fix (bottom)
   Always loaded (independent of the kf_ds_enabled toggle).
   Goals:
   - stack the desktop image/text combos (1/5-1/5-3/5, 15/24-9/24) so text never
     ends up in a narrow column
   - drop desktop-only max-widths on text
   - one consistent type scale + readable weights across all pages
   Divi 5 emits per-module CSS late, hence the `body` prefix and !important.
   ========================================================================== */

:root{
  --kf-gutter: 2rem;
  --kf-fs-title: clamp(1.625rem, 7vw, 3.5rem);  /* page title (H1 / first heading) */
  --kf-fs-lead:  clamp(1.125rem, 3.4vw, 1.5rem);/* intro / subtitle under the title */
  --kf-fs-h2:    clamp(1.5rem, 5vw, 2.25rem);   /* section headings */
  --kf-fs-card:  clamp(1.25rem, 4.2vw, 1.75rem);/* event card titles */
  --kf-fs-h3:    1.25rem;
  --kf-fs-h4:    1.125rem;
  --kf-fs-body:  1.0625rem;
  --kf-fs-small: 0.9375rem;
}

@media (max-width: 980px){

  /* ---------- layout ---------- */

  /* consistent side gutters instead of Divi's 80% row width */
  body #main-content .et_pb_row{
    width: calc(100% - 2 * var(--kf-gutter)) !important;
    max-width: none !important;
  }

  /* image + text combos: stack instead of squeezing the text into 1/5 */
  body #main-content .et_block_row_1-5_1-5_3-5 > .et_block_column,
  body #main-content .et_block_row > .et_pb_column_1_5,
  body #main-content .et_block_row > .et_pb_column_2_5,
  body #main-content .et_block_row > .et_pb_column_3_5,
  body #main-content .et_block_row > .et_pb_column_1_3,
  body #main-content .et_block_row > .et_pb_column_2_3{
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
  }
  body #main-content .et_block_row_1-5_1-5_3-5 .et_pb_image{
    max-width: 28rem;
  }

  /* single event: text + details stack (row is nowrap by default) */
  body .et_pb_row:has(> .et_flex_column_15_24_tablet){
    flex-wrap: wrap !important;
  }
  body .et_flex_column_15_24_tablet,
  body .et_flex_column_9_24_tablet{
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* desktop reading-width caps (640px / 65% / 77vw / 92%) make text columns narrow */
  body #main-content .et_pb_text,
  body #main-content .et_pb_heading,
  body #main-content .et_pb_promo_description,
  body #main-content .et_pb_toggle_content{
    max-width: 100% !important;
  }
  /* modules with a fixed desktop width (56% / 80% / ...) */
  body #main-content .et_pb_text,
  body #main-content .et_pb_promo{
    width: 100% !important;
  }
  body #main-content .et_pb_promo{
    max-width: 100% !important;
  }

  /* ---------- typography ---------- */

  body #main-content :is(h1,h2,h3,h4){
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
  }

  /* page title */
  body #main-content .et_pb_heading_0 :is(h1,h2),
  body #main-content .et_pb_promo_description h1,
  body #main-content h1.entry-title{
    font-size: var(--kf-fs-title) !important;
    line-height: 1.05em !important;
    font-weight: 800 !important;
  }
  /* desktop zoom (scale 112%) pushes the title out of the viewport */
  body #main-content .et_pb_section_0 :is(.et_pb_heading_0, .et_pb_heading_1){
    transform: none !important;
  }

  /* lead / subtitle (second heading of the hero, or the intro text on Porträt) */
  body #main-content .et_pb_section_0 .et_pb_heading_1 h2,
  body #main-content .et_pb_section_0 .et_pb_text_0 p{
    font-size: var(--kf-fs-lead) !important;
    line-height: 1.4em !important;
    font-weight: 400 !important;
  }

  /* section headings */
  body #main-content .et_pb_column:not(.et_flex_column) .et_pb_heading:not(.et_pb_heading_0):not(.et_pb_heading_1) .et_pb_heading_container :is(h2){
    font-size: var(--kf-fs-h2) !important;
    line-height: 1.15em !important;
    font-weight: 800 !important;
  }

  /* event card titles */
  body #main-content .et_flex_column .et_pb_heading_container h2{
    font-size: var(--kf-fs-card) !important;
    line-height: 1.15em !important;
    font-weight: 700 !important;
  }

  body #main-content .et_pb_text_inner h3,
  body #main-content .et_pb_heading_container h3{
    font-size: var(--kf-fs-h3) !important;
    line-height: 1.25em !important;
  }
  body #main-content .et_pb_text_inner h4{
    font-size: var(--kf-fs-h4) !important;
  }

  /* body copy: no hairline weights, one size */
  body #main-content .et_pb_text_inner :is(p,li),
  body #main-content .et_pb_blurb_description,
  body #main-content .et_pb_promo_description p,
  body #main-content .et_pb_toggle_content :is(p,li){
    font-size: var(--kf-fs-body) !important;
    line-height: 1.6em !important;
    font-weight: 400 !important;
  }
  body #main-content .et_pb_gallery_title{
    font-weight: 400 !important;
  }
}

@media (max-width: 767px){
  :root{ --kf-gutter: 1.25rem; }

  body #main-content .et_pb_promo{
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* ==========================================================================
   Card links: real <a> in the card title + cover <a> over the whole card
   (injected by assets/js/kf-card-links.js). Always on, all viewports.
   ========================================================================== */
body .et_pb_column.kf-card{
  position: relative;
}
body a.kf-card-link{
  color: inherit;
  text-decoration: none;
}
body a.kf-card-cover{
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  -webkit-tap-highlight-color: transparent;
}
body a.kf-card-link:focus-visible{
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ==========================================================================
   Above-the-fold entrance: CSS-only, starts at first paint.
   Divi hides animated modules (opacity:0) until its JS fires the 1s fade, and
   that waits for window load, i.e. for the big hero image. Result: header image
   visible, title/text missing for seconds. Everything in the first section is
   animated by CSS instead (shorter, no JS dependency); Divi's later JS start is
   a no-op because the animation name stays the same.
   ========================================================================== */
@keyframes kf-hero-in{
  from{ opacity: 0; transform: translateY(12px); }
  to{   opacity: 1; transform: none; }
}
body #main-content [class*="et_pb_section_0"] .et_animated,
body [class*="et_pb_section_0_tb_body"] .et_animated{
  animation: kf-hero-in .6s ease-out both !important;
  animation-delay: 0s !important;
}
body #main-content [class*="et_pb_section_0"] .et_pb_heading_1,
body #main-content [class*="et_pb_section_0"] .et_pb_text_0{
  animation-delay: .12s !important;
}
body #main-content [class*="et_pb_section_0"] .et_animated ~ .et_animated:not(.et_pb_heading_1):not(.et_pb_text_0){
  animation-delay: .24s !important;
}
@media (prefers-reduced-motion: reduce){
  body #main-content [class*="et_pb_section_0"] .et_animated,
  body [class*="et_pb_section_0_tb_body"] .et_animated{
    animation: none !important;
    opacity: 1 !important;
  }
}
