/**
 * Sonos Station Manager – Seiten-Design (global)
 *
 * v4.52.0: Aus dem Customizer („Design → Zusätzliches CSS“) ins Plugin
 * übernommen. Lädt auf allen Frontend-Seiten direkt nach Blocksys
 * Stylesheet (ssm_enqueue_site_styles) – dieselbe Stelle in der Kaskade wie
 * bisher das Customizer-CSS. Das Einreichungsformular steht in ssm-form.css.
 *
 *   1. Mega-Menü der Header-Navigation
 *   2. Hero und Feature-Karten (Gutenberg-Seiten: Startseite, Kontakt, App …)
 *   3. Textbereich der Gutenberg-Seiten
 *
 * Dark Mode: Die festen Hellfarben in 2 und 3 fängt ssm_print_theme_css()
 * ab (Feature-Karte, .entry-content-Netz) – dort nicht entfernen.
 *
 * @package SonosStationManager
 * @since   4.52.0
 */

/* ==========================================================================
   1. MEGA-MENÜ
   Macht aus der langen Einzelspalte ein mehrspaltiges Panel und flacht das
   verschachtelte "Jahrzehnte"-Flyout (nav-menu-taxonomy.php) in eine eigene
   Zeile ab.
   ========================================================================== */

/* Panel: mehrspaltig statt einer langen Liste */
.ct-header [data-id="menu"] > ul > li > .sub-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(148px, 1fr));
    gap: 2px 6px;
    width: max-content;
    max-width: min(620px, 92vw);
    padding: 12px;
    border-radius: 14px;
    /* gestrichelte Trenner passen nicht zu einem Raster */
    --dropdown-divider: none;
}

/* Länder sind nur 9 Einträge – zwei Spalten wirken ruhiger */
.ct-header [data-id="menu"] > ul > li:first-child > .sub-menu {
    grid-template-columns: repeat(2, minmax(148px, 1fr));
    max-width: min(420px, 92vw);
}

/* Einträge: kompakter, mit Hover-Fläche statt Trennlinie */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li,
.ct-header [data-id="menu"] > ul > li > .sub-menu .sub-menu > li {
    border: none;
}

.ct-header [data-id="menu"] .sub-menu > li > a {
    padding: 9px 12px;
    border-radius: 9px;
    line-height: 1.25;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ct-header [data-id="menu"] .sub-menu > li > a:hover,
.ct-header [data-id="menu"] .sub-menu > li > a:focus-visible {
    background-color: rgba(255, 255, 255, 0.08);
}

/* "Jahrzehnte": Flyout auflösen, eigene Zeile im Raster */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children {
    grid-column: 1 / -1;
    order: 99; /* ans Ende, als abgesetzte Gruppe */
    display: block; /* Blocksy setzt hier flex – sonst steht das Label neben den Pills */
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Die Überschrift der Gruppe wird zum Label, nicht zum Menüpunkt */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > a {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
    padding: 0 12px 6px;
    pointer-events: none;
    display: block;
}

/* Pfeil des aufgeklappten Flyouts entfernen */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > a .ct-toggle-dropdown-desktop,
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > a svg {
    display: none;
}

/* Die Unterpunkte direkt zeigen – kein zweites Flyout mehr.
   visibility/pointer-events vom Panel erben, NICHT fest visible/auto:
   sonst liegen die Pills bei geschlossenem Panel unsichtbar, aber
   anfassbar im Seiteninhalt – die Maus darüber öffnete das Genre-Menü. */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > .sub-menu {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    opacity: 1;
    visibility: inherit;
    transform: none;
    box-shadow: none;
    background: none;
    border: none;
    pointer-events: inherit;
}

/* Jahrzehnte als kompakte Pills */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > .sub-menu > li > a {
    padding: 6px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.06);
    font-size: 0.82rem;
}

.ct-header [data-id="menu"] > ul > li > .sub-menu > li.menu-item-has-children > .sub-menu > li > a:hover {
    background-color: rgba(0, 180, 216, 0.22);
}

/* "Alle anzeigen" (nav-menu-taxonomy.php, seit 4.33.0) */
.ct-header [data-id="menu"] > ul > li > .sub-menu > li.ssm-menu-all {
    grid-column: 1 / -1;
    order: 100; /* hinter der Jahrzehnte-Gruppe */
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.ct-header [data-id="menu"] > ul > li > .sub-menu > li.ssm-menu-all > a {
    font-size: 0.82rem;
    opacity: 0.7;
}

.ct-header [data-id="menu"] > ul > li > .sub-menu > li.ssm-menu-all > a::after {
    content: " →";
}

.ct-header [data-id="menu"] > ul > li > .sub-menu > li.ssm-menu-all > a:hover {
    opacity: 1;
}

/* Schmale Viewports: wieder einspaltig */
@media (max-width: 782px) {
    .ct-header [data-id="menu"] > ul > li > .sub-menu,
    .ct-header [data-id="menu"] > ul > li:first-child > .sub-menu {
        grid-template-columns: 1fr;
        max-width: 92vw;
    }
}

/* ==========================================================================
   2. HERO UND FEATURE-KARTEN
   Klassen aus den Gutenberg-Seiten (Block → Erweitert → Zusätzliche Klassen).
   ========================================================================== */

.soundnode-hero h1 {
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.02em;
    font-weight: 800;
}

.hero-subtext {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 400;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.soundnode-feature-card {
    text-align: center;
    padding: 2.5rem 2rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f1f5f9;
}

.soundnode-feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: #00B4D8;
}

.soundnode-feature-card h3 {
    margin-bottom: 0.2rem;
    color: #1e293b;
    font-weight: 700;
    font-size: 1.2rem;
}

/* ==========================================================================
   3. TEXTBEREICH DER GUTENBERG-SEITEN
   Nur Gutenberg-Blöcke (.wp-block-heading, .wp-block-paragraph,
   .wp-block-list). Bisher trafen die Regeln jedes h2/h4/p/ul in einer
   Gruppe – auch Plugin-Ausgaben: Favoriten-Titel (35 statt 21 px, 48 px
   Abstand oben), Künstler-Wolke, Kachel-Texte, Einreichungsformular.
   :where() hält die Spezifität auf dem alten Stand (0,2,1 bzw. 0,1,1),
   damit sich gegenüber Theme und Dark-Mode-Regeln nichts verschiebt.
   ========================================================================== */

.wp-block-group:not(.soundnode-hero) h2:where(.wp-block-heading) {
    font-size: 2.2rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.wp-block-group:not(.soundnode-hero) h4:where(.wp-block-heading) {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

/* Linie nach H4 */
.wp-block-group:not(.soundnode-hero) h4:where(.wp-block-heading)::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
    margin-left: 1rem;
}

/* Listen mit Cyan-Punkt */
.wp-block-group ul.wp-block-list {
    margin-top: 1rem;
    padding-left: 1rem;
}

.wp-block-group ul.wp-block-list li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
    list-style: none;
}

.wp-block-group ul.wp-block-list li::before {
    content: "•";
    color: #00B4D8;
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -4px;
    line-height: 1.5rem;
}

/* Fließtext */
.wp-block-group p:where(.wp-block-paragraph) {
    color: #334155;
    line-height: 1.5;
    font-size: 1.05rem;
    margin-bottom: 1.1rem;
}

@media (max-width: 768px) {
    .soundnode-hero h1 {
        font-size: 2.5rem !important;
    }

    .wp-block-group:not(.soundnode-hero) h2:where(.wp-block-heading) {
        font-size: 1.75rem;
    }
}

/* ==========================================================================
   SPRACHUMSCHALTER (v4.64.0, i18n.php)
   Header: kompakter Umschalter im Text-Element ([gtranslate] → Plugin).
   Mobiles Menü: Eintrag mit Untermenü. Globus vor der aktuellen Sprache.
   ========================================================================== */

.ssm-lang-dropdown {
    position: relative;
    display: inline-block;
}

.ssm-lang-dropdown > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    color: inherit;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.ssm-lang-dropdown > summary::-webkit-details-marker {
    display: none;
}

.ssm-lang-dropdown > summary:hover,
.ssm-lang-dropdown[open] > summary {
    background-color: color-mix(in srgb, currentColor 10%, transparent);
}

.ssm-lang-dropdown > summary:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.ssm-lang-dropdown__icon {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    background-color: currentColor;
}

.ssm-lang-dropdown__list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    min-width: 160px;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--ssm-border, #e2e8f0);
    border-radius: 12px;
    background-color: var(--ssm-background, #ffffff);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.ssm-lang-dropdown__list li {
    margin: 0;
    padding: 0;
}

/* Mobiles Menü (Offcanvas): Liste unter dem Knopf statt seitlich daneben */
#offcanvas .ssm-lang-dropdown__list {
    position: static;
    margin-top: 8px;
}

.ssm-lang-dropdown__list a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--ssm-text, #334155);
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
}

.ssm-lang-dropdown__list a:hover,
.ssm-lang-dropdown__list a:focus-visible {
    background-color: color-mix(in srgb, currentColor 8%, transparent);
}

.ssm-lang-dropdown__list a[aria-current="true"] {
    font-weight: 600;
}

.ssm-lang-menu > a::before {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.35em;
    vertical-align: -0.15em;
    background-color: currentColor;
}

.ssm-lang-menu > a::before,
.ssm-lang-dropdown__icon {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E") center / contain no-repeat;
}
