/*
 * Design-Skin "App-Kacheln Blau" (Slug: mobile-app-tiles)
 * Farbschema an olaf-albrecht.de angelehnt, aber mit echtem, unterscheidbarem Light/Dark-Mode
 * (siehe Farbvariablen-Block unten fuer die Begruendung): Light Mode ist hell mit dunklem,
 * markentreuem Text; Dark Mode zeigt die kraeftige Original-Markenoptik (Blau #0082c9, weisser
 * Text, volles Amber #ffb000). Kacheln UND Navigation sind komplett auf Smartphone-Bedienung
 * optimiert statt nur "responsive mitgedacht":
 *   - Kachel-Raster: 2 Spalten auf dem Smartphone (quadratische "App-Icon"-Optik, grosse
 *     Tipp-Flaechen), erst auf breiteren Bildschirmen mehr Spalten.
 *   - Navigation: auf Mobilgeraeten (<= 767.98px) wird die Leiste zu einem fixen Dock am UNTEREN
 *     Bildschirmrand (wie die Tab-Leiste einer nativen App) statt oben zu kleben - das
 *     Ausklapp-Menue und das Sprachmenue oeffnen dabei passend NACH OBEN statt nach unten.
 *   Ab 768px (Tablet/Desktop) bleibt die gewohnte obere Leiste bestehen, das Kachel-Raster bleibt
 *   aber weiterhin grosszuegig und kachel-betont.
 *
 * DE: Enthaelt AUSSCHLIESSLICH Abweichungen/Ergaenzungen zu overrides.css - wird NACH dem
 *     Standard-Stylesheet geladen (siehe fragments/layout.html). Kachel-Raster-Regeln sind
 *     bewusst per ":has(.tile-card)" auf Zeilen eingegrenzt, die tatsaechlich Kacheln enthalten -
 *     normale Bootstrap-Formulare (Login, Checkout-Adresse usw.) nutzen ebenfalls ".row", bleiben
 *     dadurch aber unberuehrt.
 * EN: Contains ONLY overrides/additions on top of overrides.css - loaded AFTER the base
 *     stylesheet. Tile-grid rules are deliberately scoped via ":has(.tile-card)" to rows that
 *     actually contain tiles - plain Bootstrap form rows (login, checkout address, etc.) also use
 *     ".row" but stay untouched.
 */

/* ---- Farbvariablen (Hell/Dunkel) -- color variables (light/dark) ----
   DE: Nutzer-Feedback: "im Light Mode mit weisser Schrift" - die urspruengliche erste Fassung
       nutzte denselben kraeftigen Blauton als Flaeche in BEIDEN Modi (weisser Text auch im
       "Light Mode"), was dem ueblichen Verstaendnis von "Light Mode" (heller Hintergrund, dunkler
       Text) widerspricht. Jetzt: Hell = ein wirklich heller, nur leicht blaustichiger Hintergrund
       mit dunkler, markentreuer Schrift (dunkles Marine statt reinem Schwarz) und einem
       GEDUNKELTEN Amber-Akzent (reiner "#ffb000" hat auf hellem Grund zu wenig Kontrast fuer Text
       - gleiches Prinzip wie der projektweite Standard-Light-Theme in overrides.css, das aus
       demselben Grund ebenfalls eine dunklere Akzentfarbe im Hellmodus nutzt).
       Dunkel = bewusst UNVERAENDERT die kraeftige Original-Markenoptik von olaf-albrecht.de
       (Blau + weisser Text + volles Amber) - dort ist Blau der Hintergrund und weisser Text
       klassisch richtig, siehe Kontrastpruefung unten.
   EN: User feedback: "white text even in Light Mode" - the original first version used the same
       strong blue as the surface in BOTH modes (white text even in "Light Mode"), which conflicts
       with the usual expectation of "Light Mode" (light background, dark text). Now: Light = a
       genuinely light, only faintly blue-tinted background with dark, on-brand text (dark navy
       instead of pure black) and a DARKENED amber accent (plain "#ffb000" has too little text
       contrast on a light background - same principle the project-wide default light theme in
       overrides.css already uses for the same reason).
       Dark = deliberately UNCHANGED, the original strong olaf-albrecht.de brand look (blue
       background + white text + full-strength amber) - there blue-as-background with white text
       is the classic, correctly-contrasted combination, see contrast check below. */
:root,
html[data-theme="light"] {
    --bw-bg: #f2f8fc;
    --bw-text: #0a2f45;
    --bw-surface: #ffffff;
    --bw-accent: #8a5a30;
    --bw-accent-contrast: #ffffff;
    --bw-accent-hover: #6e4624;
    --bw-border: rgba(10, 47, 69, 0.15);
    --bw-tile-image-bg: rgba(10, 47, 69, 0.07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bw-bg: #052c45;
        --bw-text: #eaf6ff;
        --bw-surface: #0c3f60;
        --bw-accent: #ffb000;
        --bw-accent-contrast: #1a1200;
        --bw-accent-hover: #ffc84d;
        --bw-border: rgba(255, 255, 255, 0.16);
        --bw-tile-image-bg: rgba(255, 255, 255, 0.14);
    }
}

html[data-theme="dark"] {
    --bw-bg: #052c45;
    --bw-text: #eaf6ff;
    --bw-surface: #0c3f60;
    --bw-accent: #ffb000;
    --bw-accent-contrast: #1a1200;
    --bw-accent-hover: #ffc84d;
    --bw-border: rgba(255, 255, 255, 0.16);
    --bw-tile-image-bg: rgba(255, 255, 255, 0.14);
}

/* Links in Fliesstext sollen wie auf dem Vorbild unterstrichen-frei in Amber erscheinen; Bootstrap
   setzt sonst eine Standard-Unterstreichung. */
a {
    text-decoration: none;
}

a:hover {
    color: var(--bw-accent-hover);
}

/* DE: Navigations-Links (Hauptmenue-Unterpunkte im Aufklapp-Panel UND die kleinen Kachel-Links
   darin, siehe "nav-tile") erben sonst die allgemeine Amber-Linkfarbe von oben - auf dem
   mittelblauen Kachel-/Panel-Hintergrund dieses Designs ist das zu kontrastarm (Kontrast ca.
   2,3:1, Bug-Report Nutzer). Dort gilt deshalb WEISS wie der uebrige Navigationstext
   (".nav-link-tile" nutzt bereits "--bw-text"), Amber bleibt der Fliesstext-Marke vorbehalten.
   EN: Navigation links (main-menu sub-items in the flyout panel AND the small tile links inside
   it, see "nav-tile") otherwise inherit the general amber link colour from above - against this
   design's mid-blue tile/panel background that has too little contrast (~2.3:1, user bug
   report). There they get WHITE like the rest of the nav text instead (".nav-link-tile" already
   uses "--bw-text"), amber stays reserved for body-copy links. */
.nav-dropdown-panel a,
.lang-dropdown-option {
    color: var(--bw-text);
}

.nav-dropdown-panel a:hover,
.lang-dropdown-option:hover {
    color: var(--bw-accent);
}

/* DE: Bootstraps ".navbar-brand" folgt NICHT unseren "--bw-*"-Variablen (eigenes Bootstrap-
   Farbsystem, siehe overrides.css-Kommentar bei ".navbar") - ohne diese Regel bleibt der
   Firmenname hier schwarz auf dem dunklen Dock/der dunklen Kachel-Navbar und ist praktisch
   unlesbar (Kontrast-Bug-Report Nutzer).
   EN: Bootstrap's ".navbar-brand" does NOT follow our "--bw-*" variables (its own Bootstrap
   colour system) - without this rule the company name stays black on this design's dark
   dock/navbar and is practically unreadable (user-reported contrast bug). */
.navbar-brand {
    color: var(--bw-text);
}

/* ======================================================================
   KACHEL-RASTER / TILE GRID - 2 Spalten auf dem Smartphone, "App-Icon"-Optik
   ====================================================================== */

.row.g-4:has(.tile-card) {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 0;
}

.row.g-4:has(.tile-card) > [class*="col-"] {
    width: auto;
    max-width: none;
    padding: 0;
    flex: none;
}

@media (min-width: 576px) {
    .row.g-4:has(.tile-card) {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 992px) {
    .row.g-4:has(.tile-card) {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Quadratische Bildflaeche mit eigenem, leicht abgesetztem Ton (statt der Standard-Kartenfarbe) -
   wirkt wie das Icon-Feld einer App-Kachel statt wie ein Foto-Ausschnitt. */
.tile-card {
    border-radius: 1.1rem;
    border: 1px solid var(--bw-border);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.18);
}

.tile-card .tile-card-image {
    aspect-ratio: 1 / 1;
    background-color: var(--bw-tile-image-bg);
}

.tile-card .tile-card-body {
    padding: 0.75rem 0.6rem;
    text-align: center;
}

.tile-card .tile-card-body h2 {
    font-size: 0.95rem;
    font-weight: 700;
}

@media (min-width: 576px) {
    .tile-card .tile-card-body h2 {
        font-size: 1.1rem;
    }
}

/* Untermenue-Kacheln (Navigations-Dropdown) folgen derselben 2-Spalten-Logik auf dem Smartphone. */
.nav-tile-grid {
    grid-template-columns: repeat(2, 1fr);
}

.nav-tile {
    border-radius: 0.75rem;
}

/* ---- Buttons / Status-Pillen als abgerundete "App"-Elemente -------------------------- */
.btn-brand {
    border-radius: 999px;
    font-weight: 600;
}

.status-pill {
    border-radius: 999px;
}

.nav-link-tile {
    border-radius: 0.75rem;
}

/* ======================================================================
   NAVIGATION ALS UNTERER APP-DOCK AUF SMARTPHONES (<= 767.98px)
   STRUCTURE: navigation as a bottom app dock on smartphones (<= 767.98px)
   ======================================================================
   DE: Die Navbar ist in overrides.css "position:fixed; top:0; left:0; right:0" - hier wird daraus
       auf Smartphone-Breiten stattdessen eine fixe Leiste am UNTEREN Bildschirmrand, wie die
       Tab-Leiste einer nativen App. Der Seiteninhalt braucht deshalb keinen margin-top mehr
       (kein Platzhalter oben noetig), bekommt stattdessen unten ein padding-bottom in Hoehe der
       Leiste, damit der letzte Seiteninhalt nicht vom Dock verdeckt wird. Das Ausklapp-Menue
       (".nav-toggle:checked ~ .navlinks") waechst dank "bottom:0" automatisch NACH OBEN statt den
       Bildschirm nach unten zu sprengen - es ist dieselbe Flex-Box, nur am unteren statt oberen
       Rand verankert. Sprachmenue bekommt zusaetzlich "bottom:100%" statt "top:100%", damit es
       ebenfalls nach oben statt aus dem Bildschirm heraus nach unten aufklappt.
   EN: The navbar is "position:fixed; top:0; left:0; right:0" in overrides.css - here, on
       smartphone widths, it instead becomes a fixed bar at the BOTTOM of the screen, like a
       native app's tab bar. The page content no longer needs margin-top, but gets a
       padding-bottom in the bar's height instead so the last content isn't covered by the dock.
       The expanding menu (".nav-toggle:checked ~ .navlinks") grows UPWARD automatically thanks to
       "bottom:0" instead of overflowing off the bottom of the screen - it's the same flex box,
       just anchored to the bottom instead of the top edge. The language menu additionally gets
       "bottom:100%" instead of "top:100%" so it also opens upward instead of off-screen below. */
@media (max-width: 767.98px) {
    .navbar {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-bottom: none !important;
        border-top: 1px solid var(--bw-border);
        box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.25);
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .site-header ~ main,
    .navbar ~ main {
        margin-top: 0 !important;
        padding-bottom: 4.9rem;
    }

    /* Grosszuegigere Tipp-Flaechen (Mindestgroesse ~44px, Apple/Google-Empfehlung) fuer Hamburger
       und die Icon-Gruppe (Warenkorb/Konto/Theme), damit auf dem Touchscreen nichts daneben
       getroffen wird. */
    .navlinks-toggle {
        padding: 0.5rem;
        font-size: 1.4rem;
    }

    .nav-icons a,
    .nav-icons .lang-dropdown summary {
        min-width: 2.5rem;
        min-height: 2.5rem;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem !important;
    }

    /* Sprachmenue oeffnet nach oben statt nach unten (siehe Erklaerung oben). */
    .lang-dropdown-panel {
        top: auto !important;
        bottom: 100%;
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    /* Ausklapp-Hauptmenue bekommt dieselbe Kartenfarbe wie der Rest des Designs statt
       durchsichtig auf dem Dock zu schweben. */
    .nav-toggle:checked ~ .navlinks {
        background-color: var(--bw-surface);
        border-radius: 0.75rem;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
}
