/**
 * EHNES Magazin — Search · Filter · Grid
 *
 * Design-Tokens:
 *   Primary  #29BD98  (Brand)
 *   Dark     #0C1E21  (Hero/Footer)
 *   Text     #15293A
 *   Muted    #5C6873
 *   Border   #DDE5E1
 *   Soft     #F0F7F4
 *
 * Layout: impulse.de-Style — Bild-on-top-Karte, Kategorie-Pill auf
 * dem Bild, Titel in Fraunces, Lead in Ubuntu, Meta-Zeile mit Autor
 * und Datum.
 */

/* ============================================================
   Search
   ============================================================ */
.ehnes-mag-search {
    width: 100%;
    margin: 0 0 1.5rem;
}
.ehnes-mag-search__label {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: #FFFFFF;
    border: 1.5px solid #DDE5E1;
    border-radius: 999px;
    padding: .15rem .9rem .15rem 1.15rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ehnes-mag-search__icon {
    width: 18px;
    height: 18px;
    color: #5C6873;
    flex: 0 0 auto;
}
.ehnes-mag-search__input {
    flex: 1 1 auto;
    border: 0;
    outline: none;
    background: transparent;
    padding: .8rem 0;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    color: #15293A;
    width: 100%;
    min-width: 0;
}
.ehnes-mag-search__input::placeholder { color: #8A949C; }
.ehnes-mag-search__input::-webkit-search-decoration,
.ehnes-mag-search__input::-webkit-search-cancel-button,
.ehnes-mag-search__input::-webkit-search-results-button,
.ehnes-mag-search__input::-webkit-search-results-decoration { display: none; }

.ehnes-mag-search__clear {
    background: transparent;
    border: 0;
    color: #8A949C;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: .25rem .35rem;
    flex: 0 0 auto;
    transition: color 120ms ease;
}
.ehnes-mag-search__clear:hover { color: #15293A; }

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   Filter (Pills)
   ============================================================ */
.ehnes-mag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 0 0 1.5rem;
}
.ehnes-mag-filter__pill {
    display: inline-flex;
    align-items: center;
    background: #FFFFFF;
    color: #15293A;
    border: 1.5px solid #DDE5E1;
    border-radius: 999px;
    padding: .55rem 1.1rem;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}
.ehnes-mag-filter__pill:hover {
    border-color: #29BD98;
    color: #0C1E21;
    transform: translateY(-1px);
}
.ehnes-mag-filter__pill[aria-selected="true"] {
    background: #29BD98;
    border-color: #29BD98;
    color: #FFFFFF;
}

/* ============================================================
   Grid
   ============================================================ */
.ehnes-mag-grid { width: 100%; }

.ehnes-mag-grid__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    transition: opacity 200ms ease;
}
.ehnes-mag-grid__list.is-loading { opacity: .5; pointer-events: none; }

[data-cols="2"] .ehnes-mag-grid__list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-cols="4"] .ehnes-mag-grid__list--grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .ehnes-mag-grid__list--grid,
    [data-cols="2"] .ehnes-mag-grid__list--grid,
    [data-cols="4"] .ehnes-mag-grid__list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .ehnes-mag-grid__list--grid,
    [data-cols="2"] .ehnes-mag-grid__list--grid,
    [data-cols="4"] .ehnes-mag-grid__list--grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Masonry-Layout (verschachteltes Grid via CSS columns)
   - Karten behalten natuerliche Hoehe (kein aspect-ratio-Lock auf
     Bild im Masonry-Modus)
   - column-count adaptiv, gap-spacing manuell ueber margin-bottom
   ============================================================ */
.ehnes-mag-grid__list--masonry {
    display: block;
    column-count: 3;
    column-gap: 24px;
}
[data-cols="2"] .ehnes-mag-grid__list--masonry { column-count: 2; }
[data-cols="4"] .ehnes-mag-grid__list--masonry { column-count: 4; }

.ehnes-mag-grid__list--masonry > .ehnes-mag-card {
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    width: 100%;
    margin-bottom: 24px;
    display: inline-block;     /* hilft Safari/Chrome bei break-inside */
    vertical-align: top;
}

/* Masonry: Bild behaelt natuerliche Proportion (kein 16:10-Crop) */
.ehnes-mag-grid__list--masonry .ehnes-mag-card__media {
    aspect-ratio: auto;
}
.ehnes-mag-grid__list--masonry .ehnes-mag-card__media img {
    height: auto;
    object-fit: contain;
    aspect-ratio: auto;
}

@media (max-width: 1024px) {
    .ehnes-mag-grid__list--masonry,
    [data-cols="2"] .ehnes-mag-grid__list--masonry,
    [data-cols="4"] .ehnes-mag-grid__list--masonry { column-count: 2; }
}
@media (max-width: 600px) {
    .ehnes-mag-grid__list--masonry,
    [data-cols="2"] .ehnes-mag-grid__list--masonry,
    [data-cols="4"] .ehnes-mag-grid__list--masonry { column-count: 1; }
}

/* ============================================================
   Karte (impulse.de-Style)
   ============================================================ */
.ehnes-mag-card {
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #ECEFEC;
    transition: transform 200ms ease, box-shadow 200ms ease;
    display: flex;
    flex-direction: column;
}
.ehnes-mag-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(12, 30, 33, .10);
}

.ehnes-mag-card__link {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ehnes-mag-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #E8EFEC;
}
.ehnes-mag-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}
.ehnes-mag-card:hover .ehnes-mag-card__media img { transform: scale(1.04); }

.ehnes-mag-card__media--placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E8EFEC 0%, #D9E2DC 100%);
}

.ehnes-mag-card__cat {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #29BD98;
    color: #FFFFFF;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .35rem .7rem;
    border-radius: 999px;
}

/* Premium-Badge (HeartBit+) - oben rechts auf der Bildmedien-Box.
   Identische Optik zum Listing-Badge: weisser Container, dezent
   gerundet, leichter Schatten. background-image kommt inline (PHP/JS). */
.ehnes-mag-card__premium {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 114px;
    height: 78px;
    background-color: rgba(255, 255, 255, .94);
    background-size: 88px auto;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
    z-index: 2;
    pointer-events: none;
}
@media (max-width: 600px) {
    .ehnes-mag-card__premium {
        width: 92px;
        height: 62px;
        background-size: 72px auto;
        top: 10px;
        right: 10px;
        border-radius: 9px;
    }
}

.ehnes-mag-card__body {
    padding: 1.1rem 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    flex: 1;
}

.ehnes-mag-card__title {
    font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
    font-weight: 500;
    font-size: 1.2rem;
    line-height: 1.3;
    color: #15293A;
    margin: 0;
    transition: color 150ms ease;
}
.ehnes-mag-card:hover .ehnes-mag-card__title { color: #0C1E21; }

.ehnes-mag-card__excerpt {
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .92rem;
    line-height: 1.55;
    color: #5C6873;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ehnes-mag-card__meta {
    margin-top: auto;
    padding-top: .5rem;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .78rem;
    color: #8A949C;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
.ehnes-mag-card__author { color: #5C6873; font-weight: 600; }

/* ============================================================
   Empty / Status / Mehr-Laden
   ============================================================ */
.ehnes-mag-grid__empty {
    text-align: center;
    color: #5C6873;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    padding: 3rem 1rem;
    margin: 0;
}
.ehnes-mag-grid__status {
    text-align: center;
    color: #8A949C;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .9rem;
    margin: 1rem 0 0;
}
.ehnes-mag-grid__more {
    display: flex;
    justify-content: center;
    margin: 2rem 0 0;
}
/* Buttons - Basis-Styling kommt aus widgets.css unified pattern. */
.ehnes-mag-grid__more-btn {
    background: transparent;
    color: #15293A;
    border-color: #C9D2CD;
}
.ehnes-mag-grid__more-btn:hover {
    background: #29BD98;
    border-color: #29BD98;
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* ============================================================
   Slider (Heise-Style Top-Headlines)
   ============================================================ */
.ehnes-mag-slider {
    position: relative;
    background: #0C1E21;
    padding: 28px 56px;
    border-radius: 12px;
    overflow: hidden;
}
.ehnes-mag-slider__inner { overflow: hidden; }

.ehnes-mag-slider__card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    color: inherit;
    text-decoration: none;
    height: 100%;
    padding: .25rem .15rem;
}

/* Premium-Badge im Slider - kompakt, oben rechts der Karte */
.ehnes-mag-slider__premium {
    position: absolute;
    top: -2px;
    right: 0;
    width: 32px;
    height: 22px;
    background-color: rgba(255, 255, 255, .94);
    background-size: 24px auto;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
    pointer-events: none;
}

.ehnes-mag-slider__cat {
    display: inline-block;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #29BD98;
    align-self: flex-start;
}

.ehnes-mag-slider__title {
    font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
    font-weight: 500;
    font-size: 1.05rem;
    line-height: 1.3;
    color: #FFFFFF;
    margin: 0;
    transition: color 150ms ease;
    /* 3 Zeilen-Truncate */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ehnes-mag-slider__meta {
    margin-top: auto;
    padding-top: .35rem;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .78rem;
    color: #A9B8B8;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
.ehnes-mag-slider__sep { color: #5C6873; }
.ehnes-mag-slider__author { color: #C8D2D0; }

/* Pfeil-Buttons */
.ehnes-mag-slider__arrow {
    position: absolute;
    top: 50%;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .08);
    color: #FFFFFF;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: background 150ms ease, transform 150ms ease;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
}
.ehnes-mag-slider__arrow:hover { background: #29BD98; }
.ehnes-mag-slider__arrow:disabled,
.ehnes-mag-slider__arrow.swiper-button-disabled { opacity: .3; cursor: default; }
.ehnes-mag-slider__arrow svg { width: 18px; height: 18px; }

.ehnes-mag-slider__arrow--prev { left: 12px; }
.ehnes-mag-slider__arrow--next { right: 12px; }

@media (max-width: 600px) {
    .ehnes-mag-slider { padding: 22px 44px; border-radius: 10px; }
    .ehnes-mag-slider__arrow { width: 32px; height: 32px; }
    .ehnes-mag-slider__arrow svg { width: 15px; height: 15px; }
    .ehnes-mag-slider__title { font-size: 1rem; }
}

/* ============================================================
   Podcast-Bar (c't 4004-Style)
   ============================================================ */
.ehnes-podcast-bar {
    position: relative;
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, #14304b 0%, #0C1E21 60%, #0C1E21 100%);
    border-radius: 12px;
    padding: 22px;
    gap: 22px;
    color: #FFFFFF;
    overflow: hidden;
}

.ehnes-podcast-bar__cover {
    flex: 0 0 auto;
    width: 130px;
    height: 130px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,.05);
}
.ehnes-podcast-bar__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ehnes-podcast-bar__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ehnes-podcast-bar__eyebrow {
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #29BD98;
    margin: 0 0 .35rem;
}
.ehnes-podcast-bar__title {
    font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
    font-weight: 500;
    font-size: 1.45rem;
    line-height: 1.25;
    color: #FFFFFF;
    margin: 0;
}
.ehnes-podcast-bar__episode {
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .9rem;
    color: #C8D2D0;
    margin: .55rem 0 0;
}

.ehnes-podcast-bar__player {
    margin-top: .9rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
}

.ehnes-podcast-bar__play {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    background: #29BD98;
    color: #FFFFFF;
    text-decoration: none;
    padding: 11px 22px 13px;
    border-radius: 999px;
    border: 0;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}
.ehnes-podcast-bar__play:hover { background: #FFFFFF; color: #0C1E21; transform: translateY(-1px); }
.ehnes-podcast-bar__play svg { width: 14px; height: 14px; }

.ehnes-podcast-bar__platforms {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.ehnes-podcast-bar__platforms a {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #FFFFFF;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}
.ehnes-podcast-bar__platforms a:hover { background: #29BD98; color: #FFFFFF; }
.ehnes-podcast-bar__platforms svg { width: 16px; height: 16px; }

.ehnes-podcast-bar__all {
    position: absolute;
    top: 18px;
    right: 22px;
    color: #FFFFFF;
    text-decoration: none;
    font-family: 'Ubuntu', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
    font-size: .85rem;
    font-weight: 600;
    opacity: .85;
    transition: opacity 120ms ease, color 120ms ease;
}
.ehnes-podcast-bar__all:hover { opacity: 1; color: #29BD98; }

/* HTML5 Audio inline (wenn Audio-URL gesetzt) */
.ehnes-podcast-bar__audio {
    flex: 1 1 auto;
    min-width: 220px;
    max-width: 360px;
    height: 36px;
}
.ehnes-podcast-bar__audio::-webkit-media-controls-panel { background: rgba(255,255,255,.1); }

@media (max-width: 700px) {
    .ehnes-podcast-bar { flex-direction: column; gap: 16px; padding: 22px 18px; }
    .ehnes-podcast-bar__cover { width: 80px; height: 80px; }
    .ehnes-podcast-bar__title { font-size: 1.2rem; }
    .ehnes-podcast-bar__all { position: static; margin-top: .5rem; }
}
