/* ==========================================================================
   Retrobörse — Typografie- und Bildsystem
   Lädt nach main.css und woocommerce.css (inc/enqueue.php) und setzt dort
   zentral Schriftgrößen, Zeilenhöhen, Textbreiten, Abstände und die drei
   Bildtypen (Foto, Flyer/Poster, Logo). Farben bleiben bei den Customizer-
   Variablen (--text, --accent …), die Display-Schrift bei --font-display.
   ========================================================================== */

:root {
  /* Schriftgrößen (16 px = 1rem) */
  --fs-body:   clamp(1rem, 0.95rem + 0.3vw, 1.125rem);      /* 16–18 px */
  --fs-lead:   clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); /* 18–21 px */
  --fs-small:  0.9375rem;                                    /* 15 px */
  --fs-label:  0.875rem;                                     /* 14 px – Minimum für Metadaten/Labels */
  --fs-h1:     clamp(1.875rem, 1.4rem + 1.6vw, 3rem);        /* 30–48 px */
  --fs-h2:     clamp(1.5rem, 1.3rem + 0.7vw, 2.125rem);      /* 24–34 px */
  --fs-h3:     clamp(1.25rem, 1.15rem + 0.3vw, 1.5rem);      /* 20–24 px */
  --fs-h4:     clamp(1.125rem, 1.08rem + 0.2vw, 1.25rem);    /* 18–20 px */
  --fs-section: clamp(1.875rem, 1.3rem + 1.8vw, 2.75rem);    /* 30–44 px – Startseiten-Sektionen */
  --fs-nav:    clamp(1rem, 0.95rem + 0.2vw, 1.125rem);       /* 16–18 px */
  --fs-button: 1rem;                                         /* 16 px */

  /* Zeilenhöhen */
  --lh-body:    1.65;
  --lh-heading: 1.08;
  --lh-title:   1.02;

  /* Textbreiten */
  --measure:      46rem;   /* 736 px – Fließtext */
  --measure-wide: 48.75rem; /* 780 px – Beitragsspalte */
  --poster-max:   30rem;   /* 480 px – Flyer/Poster über dem Beitrag */

  /* Vertikale Abstände */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;

  /* Bilder */
  --ratio-photo: 16 / 9;
  --ratio-card:  3 / 2;
  --rb-focus:    50% 50%;
  --logo-bg:     #f4f4ef;
}

/* ── Grundschrift ─────────────────────────────────────────────────────────── */

body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

/* ── Titel und Überschriften (Display-Schrift nur hier, in Navigation und Labels) ── */

.rb-page-title {
  font-size: var(--fs-h1);
  line-height: var(--lh-title);
  margin-bottom: var(--space-3);
}

.rb-prose h2,
.rb-page-content > h2,
.rb-boerse-content h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); }

.rb-prose h3,
.rb-page-content > h3,
.rb-boerse-content h3 { font-size: var(--fs-h3); line-height: 1.15; }

.rb-prose h4,
.rb-page-content > h4 { font-size: var(--fs-h4); line-height: 1.2; }

.rb-post-title,
.wp-block-post-template .wp-block-post-title { font-size: var(--fs-h4); line-height: 1.25; }

/* Sektions- und Seitenüberschriften der Startseite/Vorlagen auf dieselbe ruhigere Skala */
.rb-home-title,
.rb-story__title,
.rb-page-content .rb-story__title { font-size: var(--fs-section); line-height: 1.02; }
.rb-page-block > h2,
.rb-page-block > .wp-block-group__inner-container > h2 { font-size: var(--fs-h2); }
.rb-home-card h3 { font-size: var(--fs-h4); }
.rb-ticket-box__title { font-size: var(--fs-h3); }
.rb-story__date { font-size: clamp(1.5rem, 1.2rem + 1vw, 2.25rem); }

/* Börsen-Detailseite: Termin bleibt die prominente Angabe (keine Metadaten-Größe),
   Zwischenüberschriften in der normalen H2-Skala */
.rb-boerse-date.rb-boerse-date--single {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.25rem);
  letter-spacing: 0.01em;
}
.rb-boerse-location-panel h2,
.rb-boerse-section-head h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); }

/* Aufbau: Titel oben über die volle Breite, darunter Location/Infos links und Flyer
   rechts, die Karte darunter über die volle Breite (single-rb_boerse.php) */
.rb-boerse-head { padding: var(--space-4) 0 var(--space-4); }
.rb-boerse-head .rb-boerse-status { margin-bottom: var(--space-2); }
.rb-boerse-head .rb-page-title { margin-bottom: var(--space-1); }

/* Terminzeile: Standardschrift, Datum leicht betont, Uhrzeit mit Trennpunkt */
.rb-boerse-when {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5em;
  margin: 0;
  font-size: var(--fs-lead);
  line-height: 1.4;
  color: var(--text-secondary);
}
.rb-boerse-when__date { color: var(--text); font-weight: 600; }
.rb-boerse-when__time::before { content: '·'; margin-right: 0.5em; color: var(--accent); }
@media (max-width: 600px) {
  .rb-boerse-when { flex-direction: column; }
  .rb-boerse-when__time::before { content: none; }
}

.rb-boerse-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
  margin-bottom: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.rb-boerse-intro--has-image { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); }

.rb-boerse-intro__info { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.rb-boerse-intro__info > * { margin: 0; }
.rb-boerse-intro__info .rb-boerse-location-panel { width: 100%; }
.rb-boerse-intro .rb-boerse-hero__image { width: 100%; aspect-ratio: auto; }
.rb-boerse-hero__image img.rb-img--poster { max-width: 100%; }

.rb-boerse-intro .rb-boerse-location-panel { min-height: 0; }

/* Kennzahlen (Besucher, Aussteller, Tische): deutlich, aber nicht plakatgroß */
.rb-boerse-single .rb-boerse-stat strong { font-size: clamp(2rem, 1.5rem + 1.5vw, 3rem); line-height: 1; }
.rb-boerse-intro .rb-boerse-stats { gap: var(--space-3) var(--space-4); }

.rb-boerse-map-section { margin: 0 0 var(--space-5); }

/* Börsen-Übersicht (/boersen/): Kartentitel in der H2-Skala, darunter eine ruhige
   Terminzeile wie auf der Detailseite, Kennzahlen kleiner */
.rb-boerse-card h2 { font-size: clamp(1.375rem, 1.25rem + 0.45vw, 1.75rem); line-height: 1.1; margin-bottom: var(--space-1); }
.rb-boerse-card .rb-boerse-date {
  margin: 0 0 var(--space-1);
  font-family: 'DM Sans', sans-serif;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.rb-boerse-card .rb-boerse-location { margin-bottom: var(--space-3); }
.rb-boerse-card .rb-boerse-status { margin-bottom: var(--space-2); }
.rb-boerse-stat strong { font-size: clamp(1.75rem, 1.4rem + 1vw, 2.5rem); }
.rb-boerse-map-section > .rb-boerse-map { width: 100%; }

@media (max-width: 900px) {
  .rb-boerse-intro--has-image { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .rb-boerse-intro .rb-boerse-hero__image { max-width: 26rem; }
}

/* ── Fließtext: Standardschrift, Lesebreite, gleichmäßige Abstände ─────────── */

.rb-prose,
.rb-page-content {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.rb-prose {
  font-weight: 400;
}

.rb-prose > * { margin-top: 0; margin-bottom: var(--space-3); }
.rb-prose > :is(h2, h3, h4) { margin-top: var(--space-5); margin-bottom: var(--space-2); }
.rb-prose > :first-child { margin-top: 0; }
.rb-prose > :is(figure, .wp-block-image, .wp-block-embed, .wp-block-gallery) { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.rb-prose :is(ul, ol) { padding-left: 1.25em; }
.rb-prose li + li { margin-top: var(--space-1); }

/* Produktbeschreibung (WooCommerce-Tabs, Kurzbeschreibung): gleiche Textregeln wie Beiträge */
.woocommerce div.product .woocommerce-tabs .panel,
.woocommerce div.product .woocommerce-product-details__short-description {
  max-width: var(--measure);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-secondary);
}
.woocommerce div.product .woocommerce-tabs .panel > * + *,
.woocommerce div.product .woocommerce-product-details__short-description > * + * { margin-top: var(--space-3); }
.woocommerce div.product .woocommerce-tabs .panel > h2:first-child {
  font-size: var(--fs-h3);
  line-height: 1.15;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.woocommerce div.product .woocommerce-tabs .panel > :is(h2, h3, h4):not(:first-child) { margin-top: var(--space-4); color: var(--text); }
.woocommerce div.product .woocommerce-tabs .panel :is(ul, ol),
.woocommerce div.product .woocommerce-product-details__short-description :is(ul, ol) { padding-left: 1.25em; }
.woocommerce div.product .woocommerce-tabs .panel li + li { margin-top: var(--space-1); }
.woocommerce div.product .woocommerce-tabs .panel table { width: 100%; border-collapse: collapse; }
.woocommerce div.product .woocommerce-tabs .panel :is(th, td) { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border); text-align: left; }

/* Lange Textbereiche auf ~740–780 px begrenzen */
.rb-main--single { --rb-read-width: var(--measure-wide); }
.rb-boerse-content { max-width: var(--measure-wide); }

/* Absätze in Kadence-Spalten und Gruppen-Blöcken: keine feste Lesebreite – dort gibt das
   Layout im Editor die Breite vor (z. B. vollbreite Zeilen über einer Logo-Liste). */

/* Text direkt im Seiteninhalt: Lesebreite, linke Kante bleibt an der Inhaltsflucht */
.rb-page-content > :is(p, ul, ol, blockquote, h2, h3, h4) {
  max-width: var(--measure);
  margin-left: max(0px, calc((100% - (1400px - 2 * var(--rb-page-pad))) / 2));
  margin-right: auto;
}

.rb-page-header { margin-bottom: var(--space-5); }
.rb-post-excerpt { font-size: var(--fs-small); line-height: 1.6; }

/* ── Metadaten, Tags und kleine Labels: mindestens 14 px ──────────────────── */

.rb-post-meta,
.rb-post-meta-bar,
.rb-post-cats,
.rb-post-tags,
.rb-archive-kicker,
.rb-eyebrow,
.rb-hero-eyebrow,
.rb-boerse-date,
.rb-boerse-stat > span,
.rb-boerse-status,
.rb-next-boerse .rb-boerse-status,
.rb-boerse-time,
.rb-boerse-ical,
.rb-boerse-maplink a,
.rb-back-link,
.rb-read-more,
.rb-breadcrumb,
.rb-topbar,
.rb-topbar__badge,
.rb-ticket-note,
.rb-ticket-box__eyebrow,
.rb-next-boerse-block__title,
.rb-story__badge,
.rb-sponsor__kicker,
.rb-footer-col .widget-title,
.rb-footer-copy,
body.woocommerce-page .rb-footer-copy,
.rb-footer-nav a,
body.woocommerce-page .rb-footer-nav a,
.rb-sidebar .widget-title,
.rb-comments .comment-metadata,
.rb-comments .comment-form label,
.rb-comments .reply a,
.rb-comment__badge,
.rb-comment__pending,
.rb-like__count,
.rb-trust-label,
.rb-kat-count,
.wpcf7 label,
.wpcf7 .wpcf7-not-valid-tip,
.wp-block-kadence-posts .loop-entry .entry-taxonomies,
.wp-block-kadence-posts .loop-entry .entry-taxonomies a,
.wp-block-kadence-posts .loop-entry .entry-meta,
.wp-block-kadence-posts .loop-entry .post-more-link {
  font-size: var(--fs-label);
}

/* Gesperrte Versal-Labels bei 14 px etwas enger laufen lassen */
.rb-post-meta,
.rb-post-meta-bar,
.rb-post-cats,
.rb-archive-kicker,
.rb-eyebrow,
.rb-hero-eyebrow,
.rb-boerse-date,
.rb-boerse-status,
.rb-ticket-note,
.rb-ticket-box__eyebrow,
.rb-story__badge,
.rb-sponsor__kicker,
.rb-boerse-ical { letter-spacing: 0.08em; }

@media (max-width: 768px) {
  .rb-topbar { font-size: var(--fs-label); }
}

/* ── Navigation und Buttons: 16–18 px ─────────────────────────────────────── */

.rb-nav-links a { font-size: var(--fs-nav); }
.rb-nav-links .sub-menu a { font-size: var(--fs-button); }

.rb-btn-primary,
.rb-btn-ghost,
.rb-nav-btn,
.wp-block-button__link { font-size: var(--fs-button); }

.rb-btn-primary,
.rb-btn-ghost { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 480px) {
  .rb-nav-btn { font-size: var(--fs-label); }
}

/* ==========================================================================
   Bilder: rb-img--photo · rb-img--poster · rb-img--logo (inc/media-types.php)
   Bild-Block: Stile is-style-rb-photo · is-style-rb-poster · is-style-rb-logo
   ========================================================================== */

/* 1) Fotos: einheitliches Querformat, zugeschnitten, Fokus über --rb-focus
   (eine Inline-Angabe object-position am Bild hat Vorrang) */
.rb-img--photo,
.wp-block-image.is-style-rb-photo img {
  width: 100%;
  object-fit: cover;
  object-position: var(--rb-focus);
}

.wp-block-image.is-style-rb-photo img { aspect-ratio: var(--ratio-photo); height: auto; }

/* Beitrag: Kopf (Kategorie, Titel, Meta) und Beitragsbild in derselben Spalte wie der Text */
.rb-post-single .rb-post-header { max-width: var(--rb-read-width); margin-left: auto; margin-right: auto; }
.rb-post-single .rb-post-featured-img { max-width: 100%; }

.rb-post-featured-img img.rb-img--photo,
.rb-page-hero-img img.rb-img--photo {
  aspect-ratio: var(--ratio-photo);
  height: auto;
  max-height: none;
}

.rb-post-thumb,
.rb-boerse-card__media { aspect-ratio: var(--ratio-card); }

/* 2) Flyer und Poster: immer vollständig, nie zugeschnitten, zentriert
   (img.… erreicht die Spezifität der Beitragsbild-Regeln aus main.css) */
.rb-img--poster,
.rb-post-featured-img img.rb-img--poster,
.rb-page-hero-img img.rb-img--poster,
.wp-block-image.is-style-rb-poster img {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
}

.rb-post-featured-img:has(.rb-img--poster),
.rb-page-hero-img:has(.rb-img--poster),
.wp-block-image.is-style-rb-poster {
  max-width: var(--poster-max);
  margin: var(--space-4) auto var(--space-5);
  border: 0;
  border-radius: 0;
  background: none;
}

/* Flyer-Rahmen (inc/media-types.php): in Karten füllt eine unscharfe, abgedunkelte Kopie
   die Fläche, der Flyer bleibt vollständig; über dem Beitrag nur ein schlichter Rahmen */
.rb-poster-frame { position: relative; display: block; height: 100%; overflow: hidden; }
.rb-poster-frame > img { position: relative; z-index: 1; }

.rb-post-thumb .rb-poster-frame::before,
.rb-boerse-card__media .rb-poster-frame::before,
.wp-block-kadence-posts .post-thumbnail .rb-poster-frame::before {
  content: '';
  position: absolute;
  inset: -24px;
  background: var(--rb-poster-bg) center / cover no-repeat;
  filter: blur(18px) brightness(0.55) saturate(1.1);
}

.wp-block-kadence-posts .post-thumbnail-inner .rb-poster-frame { position: absolute; inset: 0; }

/* Flyer in Karten und im Börsen-Kopf: ganze Grafik in der Bildfläche */
.rb-post-thumb:has(.rb-img--poster),
.rb-boerse-card__media:has(.rb-img--poster) { background: var(--surface2); }

.rb-post-thumb img.rb-img--poster,
.rb-boerse-card__media img.rb-img--poster {
  height: 100%;
  padding: var(--space-1);
  object-fit: contain;
  box-sizing: border-box;
}

.rb-boerse-hero__image:has(.rb-img--poster) { aspect-ratio: auto; background: none; }
.rb-boerse-hero__image img.rb-img--poster { height: auto; max-width: var(--poster-max); margin: 0 auto; object-fit: contain; }

/* Karten zoomen beim Hover nur Fotos */
.rb-post-card:hover .rb-post-thumb .rb-img--poster,
.rb-boerse-card:hover .rb-boerse-card__media .rb-img--poster { transform: none; }

/* 3) Logos und Sponsoren: einheitliche helle Box, nichts verzerrt oder beschnitten */
.rb-img--logo,
.wp-block-image.is-style-rb-logo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  object-position: center;
  padding: var(--space-2);
  background: var(--logo-bg);
  border-radius: 0;
  box-sizing: border-box;
}

.wp-block-image.is-style-rb-logo { max-width: 320px; }

.rb-sponsor__img.rb-img--logo { max-width: 260px; max-height: none; }

/* Kadence-Beitragsliste (z. B. Sponsoren): Kadence gibt die 3:2-Fläche vor,
   darin wird das Logo vollständig gezeigt statt zugeschnitten */
.wp-block-kadence-posts .loop-entry .post-thumbnail img.rb-img--logo { object-fit: contain; }
.wp-block-kadence-posts .loop-entry .post-thumbnail img.rb-img--poster {
  height: 100%;
  object-fit: contain;
  padding: var(--space-1);
  background: none;
  box-sizing: border-box;
}

/* Bild lädt nicht (frontend.js setzt .rb-img-fallback an die Stelle) */
.rb-img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: var(--ratio-card);
  padding: var(--space-2);
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: var(--fs-label);
  text-align: center;
}

.rb-img-fallback--logo { aspect-ratio: 3 / 2; background: var(--logo-bg); color: #333; }
.rb-img-fallback--poster { aspect-ratio: 1 / 1.4; max-width: var(--poster-max); margin: 0 auto; }

/* Mobil: Flyer nahezu über die ganze Inhaltsbreite */
@media (max-width: 768px) {
  .rb-post-featured-img:has(.rb-img--poster),
  .wp-block-image.is-style-rb-poster { max-width: min(100%, 26rem); margin: var(--space-3) auto var(--space-4); }
}
