/* ==========================================================================
   Base Styles & Vintage Ski Poster Layout — skicup.ch
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100svh;
  border: var(--page-frame) solid #ffffff;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: var(--color-body);
  background-color: var(--color-paper-base);
  /* Blue Paper Texture: scrolls with content like real poster paper */
  background-image:
    url("../assets/ski-cup-kandersteg-belle-epoque-nostalgieskirennen-hintergrund-blaues-papier.webp"),
    radial-gradient(circle at 20% 15%, rgba(44, 92, 152, 0.35), transparent 55%),
    radial-gradient(circle at 80% 75%, rgba(10, 24, 48, 0.55), transparent 60%),
    linear-gradient(170deg, #1b3d6b 0%, #16335b 50%, #102646 100%);
  background-image:
    image-set(
      url("../assets/papier_hintergrund_bsc.jxl") type("image/jxl"),
      url("../assets/ski-cup-kandersteg-belle-epoque-nostalgieskirennen-hintergrund-blaues-papier.webp") type("image/webp")
    ),
    radial-gradient(circle at 20% 15%, rgba(44, 92, 152, 0.35), transparent 55%),
    radial-gradient(circle at 80% 75%, rgba(10, 24, 48, 0.55), transparent 60%),
    linear-gradient(170deg, #1b3d6b 0%, #16335b 50%, #102646 100%);
  background-size: 100% auto, auto, auto, auto;
  background-repeat: repeat-y, no-repeat, no-repeat, no-repeat;
  background-position: center top;
  background-attachment: scroll;
  overflow-wrap: break-word;
}

/* Subtle paper grain overlay rendered above paper, text, and ink */
body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.75'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

body > :not(dialog) {
  position: relative;
  z-index: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6,
.headline {
  font-family: var(--font-headline);
  color: var(--color-headline);
  margin: 0 0 0.4em;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-wrap: balance;
  text-shadow:
    0 -1px 1px rgba(4, 12, 26, 0.78),
    0 1px 0 rgba(255, 245, 190, 0.22),
    0 2px 4px rgba(4, 12, 26, 0.4);
}

h1 {
  font-size: var(--text-h1);
  line-height: 1.15;
}

h2 {
  font-size: var(--text-h2);
  line-height: 0.92;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  h1 {
    line-height: 1.32;
  }

  h2 {
    line-height: 1.18;
  }
}

h3 {
  font-size: var(--text-h3);
  line-height: 1.24;
}

h4 {
  font-size: var(--text-h4);
  line-height: 1.28;
}

.legal-page h2,
.legal-page h3,
.legal-page h4 {
  font-family: var(--font-body);
  color: var(--color-body);
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.25;
}

p, li {
  color: var(--color-body);
  max-width: 60ch;
  text-wrap: pretty;
}

p {
  margin: 0 0 1em;
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.5;
}

a {
  color: var(--color-headline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-body);
}

/* Poster Equal-Width Lockup (per equal-width-text-lines guide) */
.poster-lockup {
  width: 100%;
  font-family: var(--font-headline);
  color: var(--color-headline);
  text-transform: uppercase;
  font-size: clamp(1.75rem, 1rem + 2.5vw, 3.25rem);
  line-height: 0.92;
  display: grid;
  gap: 0.12em;
  text-fit: grow per-line-all 300%;
  text-shadow:
    0 -1px 1px rgba(4, 12, 26, 0.78),
    0 1px 0 rgba(255, 245, 190, 0.22),
    0 2px 4px rgba(4, 12, 26, 0.4);
}

.poster-lockup > span {
  display: block;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

@supports not (text-fit: grow) {
  .poster-lockup > span {
    width: fit-content;
    font-size: min(var(--text-fit-scale, 1) * 1em, 300%);
  }
}

.poster-lockup--mixed {
  text-transform: none;
}

/* Poster Hero (Centered Swiss Ski Poster Layout) */
.poster-hero-section {
  padding-block: clamp(0.65rem, 1.5vh, 1.25rem) clamp(1.75rem, 4vh, 3rem);
}

.poster-hero {
  width: min(100% - 2 * var(--gutter), 44rem);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.poster-hero-title {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poster-hero-art {
  display: block;
  margin-top: 0;
  margin-bottom: clamp(-0.5rem, -1vh, 0rem);
}

.poster-hero-art img {
  width: auto;
  max-width: 100%;
  max-height: clamp(18rem, 52svh, 34rem);
  height: auto;
  margin-inline: auto;
}

.poster-hero-date {
  display: block;
  margin: 0.15em 0 0;
  font-family: var(--font-body);
  font-size: clamp(1.65rem, 1rem + 2.4vw, 3.1rem);
  line-height: 1.05;
  color: var(--color-headline);
  letter-spacing: 0.02em;
  text-shadow:
    0 -1px 1px rgba(4, 12, 26, 0.78),
    0 1px 0 rgba(255, 245, 190, 0.22),
    0 2px 4px rgba(4, 12, 26, 0.4);
}

.poster-hero-sub {
  margin: clamp(0.45rem, 1.2vh, 0.85rem) auto 0;
  max-width: 100%;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.75rem + 1vw, 1.45rem);
  line-height: 1.28;
  color: var(--color-body);
}

.poster-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: clamp(0.85rem, 2vh, 1.35rem);
}

/* Program + U-Shaped Photo Collage */
.program-collage {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(19rem, 25rem) minmax(12rem, 1fr);
  column-gap: clamp(1rem, 2.2vw, 1.75rem);
  row-gap: clamp(0.6rem, 1.2vw, 0.9rem);
  align-items: start;
}

.collage-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.6rem, 1.2vw, 0.9rem);
}

.collage-side .collage-item {
  margin-bottom: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.collage-side .collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collage-span-2,
.collage-side .collage-item.collage-span-2 {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
}

.collage-bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1.45fr 1fr;
  gap: clamp(0.6rem, 1.2vw, 0.9rem);
  align-items: start;
  margin-top: 0;
}

.collage-item {
  margin: 0;
}

.collage-item img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: transform 160ms ease;
}

.collage-item:hover img {
  transform: scale(1.015);
}

.collage-center {
  text-align: center;
  padding-inline: clamp(0.25rem, 1vw, 0.75rem);
}

.collage-center h2 {
  font-size: clamp(1.75rem, 1.1rem + 2vw, 2.8rem);
  line-height: 0.88;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 0;
  margin-bottom: 0.55em;
}

@media (max-width: 720px) {
  h2,
  .collage-center h2 {
    font-size: clamp(1.7rem, 7vw, 2.5rem);
    line-height: 1.28;
  }
}

.program-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.program-item {
  position: relative;
  padding-block: clamp(0.6rem, 1.2vw, 0.9rem);
  border-bottom: 1px solid var(--color-border);
  transition: opacity 200ms ease, filter 200ms ease;
}

.program-item:last-child {
  border-bottom: 0;
}

.program-live-sujet {
  display: none;
}

.live-time-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--color-ink-muted);
}

body[data-stage="live"] .live-time-bar {
  display: inline-flex;
}

.live-time-bar select {
  background: transparent;
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.5rem;
  font: inherit;
}

body[data-stage="live"] .program-item.is-past {
  opacity: 0.35;
  filter: grayscale(0.75);
}

body[data-stage="live"] .program-item.is-live .program-live-sujet {
  display: block;
  position: absolute;
  left: clamp(0.25rem, 2vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(2.6rem, 4.2vw, 4rem);
  pointer-events: none;
}

.program-live-sujet img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 720px) {
  body[data-stage="live"] .program-item.is-live .program-live-sujet {
    position: static;
    transform: none;
    width: 2.5rem;
    margin: 0 auto 0.35rem;
  }
}

.program-item h3 {
  font-size: clamp(1.3rem, 1rem + 1vw, 1.85rem);
  letter-spacing: 0.02em;
  margin: 0 0 0.2em;
}

.program-meta {
  margin: 0;
  max-width: none;
  font-family: var(--font-tall);
  font-size: clamp(0.95rem, 0.85rem + 0.35vw, 1.15rem);
  letter-spacing: 0.04em;
  color: var(--color-body);
}

/* Equipment (Ausrüstung: Skiverleih & Kleiderverleih) */
.equipment-header {
  text-align: center;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.equipment-grid {
  width: min(100%, 46rem);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(2rem, 4.5vw, 3.5rem);
  align-items: stretch;
}

body[data-stage="live"] .equipment-grid {
  grid-template-columns: minmax(0, 32rem);
  justify-content: center;
}

.calendar-event.is-past {
  opacity: 0.35;
  filter: grayscale(0.75);
}

.equipment-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%;
}

.equipment-media {
  margin: 0 0 1.25rem;
  width: 100%;
}

.equipment-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
}

.equipment-item h3 {
  font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2rem);
  margin: 0 0 0.45em;
}

.equipment-item p {
  margin: 0 0 1.25rem;
  max-width: 34ch;
}

.equipment-item .btn {
  margin-top: auto;
}

.rennschein-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rennschein-cta .section-header {
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

.rennschein-media {
  margin: 0 0 clamp(1.25rem, 2.5vw, 1.85rem);
  width: min(100%, 36rem);
}

.rennschein-media img {
  display: block;
  width: 100%;
  height: auto;
}

.rennschein-text {
  max-width: 44ch;
  margin: 0 0 clamp(1.25rem, 2.5vw, 1.75rem);
}

@media (max-width: 960px) {
  .program-collage {
    grid-template-columns: 1fr;
  }

  .collage-center {
    order: 1;
  }

  .collage-side--left {
    order: 2;
  }

  .collage-side--right {
    order: 3;
  }

  .collage-bottom {
    order: 4;
    grid-template-columns: repeat(2, 1fr);
  }

  .collage-bottom > :first-child {
    grid-column: 1 / -1;
  }
}

/* Layout Containers */
.container {
  width: min(100% - 2 * var(--gutter), var(--container-max));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-gap);
}

.section-header {
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

.eyebrow {
  font-family: var(--font-tall);
  font-size: var(--text-h4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-body);
  margin-bottom: 0.5rem;
}

/* Header & Navigation */
.site-header {
  position: relative;
  z-index: 20;
  background: transparent;
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding-block: 0.65rem;
}

.brand {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  text-align: center;
  font-family: var(--font-headline);
  font-size: clamp(1.35rem, 1rem + 1.1vw, 2rem);
  color: var(--color-headline);
  text-decoration: none;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow:
    0 -1px 1px rgba(4, 12, 26, 0.78),
    0 1px 0 rgba(255, 245, 190, 0.22);
}

.main-nav {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

.main-nav a {
  font-family: var(--font-tall);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-body);
  text-decoration: none;
}

.main-nav a[aria-current="page"],
.main-nav a:hover {
  color: var(--color-headline);
}

.header-controls {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
}

@media (max-width: 1024px) {
  .header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.75rem;
  }

  .brand,
  .main-nav,
  .header-controls {
    grid-column: 1;
    grid-row: auto;
    justify-self: center;
    justify-content: center;
  }
}

.lang-switch {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  border: 0;
  border-radius: 0;
}

.lang-switch button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--color-body);
  opacity: 0.6;
  border: 0;
  padding: 0 0.35rem;
  font-family: var(--font-tall);
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.lang-switch button:hover {
  opacity: 0.9;
}

.lang-switch button[aria-pressed="true"] {
  background: transparent;
  color: var(--color-headline);
  opacity: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  min-block-size: 2.75rem;
  border: 2px solid var(--color-headline);
  border-radius: 0.25rem;
  font-family: var(--font-headline);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease;
}

.btn-primary {
  background: var(--color-headline);
  color: var(--color-paper-deep);
}

.btn-primary:hover {
  background: var(--color-body);
  border-color: var(--color-body);
  color: var(--color-paper-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-headline);
}

.btn-ghost:hover {
  background: rgba(216, 186, 39, 0.14);
  color: var(--color-headline);
}

/* Stage Bar (3 Stadien: Vor dem Event / Am Event-Tag / Nach dem Event) */
.stage-bar {
  background: transparent;
  border-top: 1px dashed var(--color-border);
  padding-block: 0.9rem;
}

.stage-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--text-small);
}

.stage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stage-pill {
  background: transparent;
  color: var(--color-body);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-family: var(--font-tall);
  letter-spacing: 0.05em;
  cursor: pointer;
}

.stage-pill[aria-pressed="true"] {
  background: var(--color-headline);
  color: var(--color-paper-deep);
  border-color: var(--color-headline);
}

/* Media Rules: Illustrations vs. Real Photos */
.illustration-layer {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
  background: transparent;
}

.illustration-slot {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-card);
  padding: 2rem;
  text-align: center;
  background: rgba(10, 24, 46, 0.25);
}

.photo-frame {
  margin: 0;
  background: var(--color-frame);
  padding: 0.65rem 0.65rem 1.25rem;
  border-radius: 0.2rem;
  box-shadow:
    0 14px 32px rgba(4, 10, 22, 0.45),
    inset 0 0 0 1px var(--color-frame-inner);
  color: var(--color-paper-deep);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid #d2c8a2;
}

.photo-frame figcaption {
  margin-top: 0.65rem;
  font-family: var(--font-tall);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--color-paper-deep);
}

/* Cards & Grids */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: clamp(1.5rem, 3.5vw, 2.5rem);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
}

.highlight-media {
  margin: 0 0 0.75rem;
  width: 100%;
}

.highlight-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 25%;
}

.highlight-time {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.poster-card {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Live Indicator & Program Timeline (Event Day) */
.live-banner {
  border: 0;
  background: transparent;
  padding: 0;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 92, 71, 0.16);
  border: 1px solid var(--color-live);
  color: #ffd3cc;
  font-family: var(--font-tall);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.live-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--color-live);
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.3); }
}

.timeline {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
}

.timeline-item.is-live {
  border-bottom: 2px solid var(--color-headline);
  background: transparent;
  box-shadow: none;
}

.timeline-item.is-past {
  opacity: 0.58;
}

.timeline-time {
  font-family: var(--font-headline);
  font-size: 1.4rem;
  color: var(--color-headline);
  text-shadow:
    0 -1px 1px rgba(4, 12, 26, 0.78),
    0 1px 0 rgba(255, 245, 190, 0.22);
}

/* Native Modal Dialog (Crumpled Kraft Paper Poster Pop-up) */
dialog.modal-dialog {
  width: min(94vw, 54rem);
  max-height: 90svh;
  overflow-y: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: #c5b190;
  background-image:
    linear-gradient(125deg, rgba(255, 255, 255, 0.14) 0%, transparent 32%, rgba(45, 32, 16, 0.14) 52%, transparent 74%, rgba(255, 255, 255, 0.1) 100%),
    url("../assets/ski-cup-kandersteg-belle-epoque-nostalgieskirennen-popup-hintergrund.webp");
  background-size: cover;
  background-position: center;
  color: #16243a;
  clip-path: polygon(
    0.4% 0.8%, 7% 0.2%, 15% 1.1%, 24% 0.3%, 35% 0.9%, 48% 0.1%, 61% 1%, 74% 0.3%, 86% 0.9%, 95% 0.2%, 99.4% 0.9%,
    99.8% 12%, 99% 26%, 99.7% 41%, 99.1% 57%, 99.8% 72%, 99.2% 87%, 99.6% 99.1%,
    92% 99.7%, 81% 98.9%, 69% 99.6%, 56% 99%, 43% 99.8%, 31% 99.1%, 19% 99.7%, 8% 98.9%, 0.6% 99.5%,
    0.2% 86%, 0.9% 71%, 0.2% 55%, 0.8% 39%, 0.1% 24%, 0.7% 11%
  );
  box-shadow: inset 0 0 36px rgba(45, 32, 16, 0.25);
}

dialog.modal-dialog p,
dialog.modal-dialog li,
dialog.modal-dialog strong {
  color: #16243a;
}

dialog.modal-dialog h2,
dialog.modal-dialog h3,
dialog.modal-dialog h4 {
  color: #102646;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

dialog.modal-dialog a:not(.btn) {
  color: #102646;
}

dialog.modal-dialog .btn-ghost {
  color: #102646;
  border-color: #102646;
}

dialog.modal-dialog .btn-ghost:hover {
  background: rgba(16, 38, 70, 0.1);
}

dialog.modal-dialog .btn-primary {
  background: #102646;
  border-color: #102646;
  color: #f4efe0;
}

dialog.modal-dialog .btn-primary:hover {
  background: #16335b;
  border-color: #16335b;
  color: #f4efe0;
}

dialog.modal-dialog:modal {
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: calc(100vw - 1.5rem);
  max-height: 90dvh;
  overscroll-behavior: contain;
}

dialog.modal-dialog::backdrop {
  background: rgba(6, 15, 30, 0.62);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.85rem 1rem;
  border-bottom: 1px solid rgba(16, 38, 70, 0.22);
}

.modal-body {
  padding: 1.25rem 1.85rem 1.75rem;
}

.modal-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem 2rem;
  align-items: start;
}

.modal-copy p:first-child,
.modal-copy h4:first-child {
  margin-top: 0;
}

.modal-costs {
  font-size: 1.15rem;
}

.modal-res-contact {
  margin-top: 1.25rem;
}

.modal-res-contact p {
  margin-bottom: 0.75rem;
}

@media (max-width: 720px) {
  .modal-split {
    grid-template-columns: 1fr;
  }

  .modal-header {
    padding: 1rem 1.25rem 0.85rem;
  }

  .modal-body {
    padding: 1rem 1.25rem 1.35rem;
  }

  .modal-header form button[type="submit"] {
    font-size: 0;
    line-height: 0;
    padding: 0.45rem;
    min-width: 2.35rem;
    min-height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .modal-header form button[type="submit"]::before {
    content: "×";
    font-size: 1.55rem;
    line-height: 1;
  }
}

/* Compact Slideshow inside Pop-ups */
.modal-slideshow {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  text-align: center;
}

.modal-slides {
  position: relative;
}

.modal-slide {
  display: none;
  margin: 0;
}

.modal-slide.is-active {
  display: block;
}

.modal-slide img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 14rem;
  height: auto;
  margin-inline: auto;
}

.modal-slide-controls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
}

.modal-slide-btn {
  background: transparent;
  border: 1px solid rgba(16, 38, 70, 0.45);
  color: #102646;
  border-radius: 0.2rem;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-tall);
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
}

.modal-slide-btn:hover {
  background: rgba(16, 38, 70, 0.1);
}

.modal-slide-counter {
  font-family: var(--font-tall);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: #102646;
}

.lightbox-stage {
  text-align: center;
}

.lightbox-stage img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 68svh;
  height: auto;
  margin-inline: auto;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.embed-frame {
  width: 100%;
  min-height: 62svh;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  background: #ffffff;
}

.calendar-section {
  text-align: center;
}

.calendar-section h2 {
  margin-bottom: 1.25rem;
}

.calendar-section .calendar-event {
  margin-inline: auto;
  margin-bottom: 0.65rem;
}

.photo-hero-grid {
  gap: 1.5rem 2.5rem;
  align-items: stretch;
  margin-bottom: clamp(3.25rem, 6vw, 5rem);
}

.photo-hero-figure {
  position: relative;
  margin: 0;
  min-height: 15rem;
  overflow: hidden;
}

.photo-hero-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

@media (min-width: 721px) {
  .photo-hero-figure img {
    position: absolute;
    inset: 0;
  }
}

.lageplan-grid {
  display: grid;
  grid-template-columns: 1.882fr 1fr;
  gap: 1.5rem 2.25rem;
  align-items: start;
}

.lageplan-side-photo {
  margin: 0;
}

.lageplan-side-photo img {
  display: block;
  width: 100%;
  height: auto;
}

/* Post-Event Drifting Photos ("Snowflakes" behind typography) */
body[data-stage="post"] .site-header,
body[data-stage="post"] main,
body[data-stage="post"] .site-footer {
  position: relative;
  z-index: 1;
}

.post-snow-layer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

body[data-stage="post"] .post-snow-layer {
  display: block;
}

.post-snow-img {
  position: absolute;
  left: var(--x, 10%);
  top: 0;
  width: var(--w, clamp(8rem, 13vw, 12.5rem));
  height: auto;
  opacity: 0.24;
  transform: translate3d(0, -55vh, 0) rotate(var(--rot, 0deg));
  will-change: transform;
  animation: post-snowfall var(--dur, 24s) linear var(--del, 0s) infinite;
}

@keyframes post-snowfall {
  0% {
    transform: translate3d(0, -55vh, 0) rotate(var(--rot, 0deg));
  }
  50% {
    transform: translate3d(var(--sway, 16px), 35vh, 0) rotate(calc(var(--rot, 0deg) * -0.5));
  }
  100% {
    transform: translate3d(0, 115vh, 0) rotate(var(--rot, 0deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-snow-img {
    animation: none;
    transform: translate3d(0, 18vh, 0) rotate(var(--rot, 0deg));
  }
}

@media (max-width: 768px) {
  .lageplan-grid {
    display: block;
  }

  .lageplan-side-photo {
    display: none;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: 2.5rem;
  background: transparent;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 2rem clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

@media (min-width: 820px) {
  .footer-grid {
    grid-template-columns: 1.15fr 1fr 1fr;
    align-items: stretch;
  }

  .footer-partner-logo img {
    width: min(100%, 11.5rem);
  }

  .footer-anreise-links,
  .footer-col > a:last-child {
    margin-top: auto;
  }
}

.footer-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
}

.footer-col h3 {
  font-size: var(--text-lead);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}

.footer-col p {
  margin: 0 0 0.75rem;
}

.footer-partner-logo {
  display: block;
  margin: 0 0 0.75rem;
}

.footer-partner-logo img {
  display: block;
  width: min(100%, 8rem);
  height: auto;
}

.footer-partner-title {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.footer-col-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.footer-anreise-lead {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.footer-anreise-media {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
}

.footer-anreise-media img {
  display: block;
  width: min(100%, 16.5rem);
  height: auto;
}

.footer-anreise-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.25rem;
}

.footer-anreise-links span {
  white-space: nowrap;
}

.footer-col-legal {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-photo-credits {
  font-size: 0.8em;
  opacity: 0.85;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

/* Visibility helpers for 3-stage state */
[data-stage-only] {
  display: none;
}

body[data-stage="pre"] [data-stage-only~="pre"],
body[data-stage="live"] [data-stage-only~="live"],
body[data-stage="post"] [data-stage-only~="post"] {
  display: block;
}

body[data-stage="pre"] .btn[data-stage-only~="pre"],
body[data-stage="live"] .btn[data-stage-only~="live"],
body[data-stage="post"] .btn[data-stage-only~="post"] {
  display: inline-flex;
}

body[data-stage="pre"] .equipment-item[data-stage-only~="pre"],
body[data-stage="live"] .equipment-item[data-stage-only~="live"],
body[data-stage="post"] .equipment-item[data-stage-only~="post"] {
  display: flex;
}

@media (max-width: 640px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

/* Mobile: center-align layout & typography */
@media (max-width: 768px) {
  body {
    text-align: center;
  }

  p {
    margin-inline: auto;
  }

  .header-inner,
  .main-nav,
  .header-controls,
  .poster-hero-actions,
  .calendar-actions,
  .modal-actions {
    justify-content: center;
  }

  .section-header,
  .collage-center,
  .rennschein-copy,
  .poster-card,
  .highlight-card,
  .calendar-event,
  .modal-copy,
  .program-item,
  .timeline-item,
  .photo-hero-figure figcaption {
    text-align: center;
    justify-items: center;
  }

  .footer-col,
  .footer-col-links,
  .footer-col-legal,
  .footer-meta {
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .footer-grid {
    justify-items: center;
    text-align: center;
  }

  .footer-partner-logo,
  .footer-anreise-media {
    width: 100%;
  }

  .footer-anreise-links,
  .footer-links {
    justify-content: center;
  }

  .footer-partner-logo img,
  .footer-anreise-media img {
    margin-inline: auto;
  }

  .legal-page ul,
  .legal-page ol {
    padding-left: 0;
    list-style-position: inside;
  }
}
