/* =====================================================================
   HEMDOMANIA DESIGN-SYSTEM  —  hemdo-design.css
   ---------------------------------------------------------------------
   Phase 4 des Redesigns. Diese Datei ist NEU und ersetzt nichts.
   Sie enthaelt ausschliesslich zentrale Variablen und neue Bausteine
   mit dem Praefix .hm- , damit nichts am Bestand kollidiert.

   Einbinden NACH style.css bzw. desktop_style.css:
       <link rel="stylesheet" href="hemdo-design.css?v=<?= filemtime('hemdo-design.css') ?>">

   Ziel: style.css und desktop_style.css definieren heute beide einen
   eigenen :root-Block mit denselben Werten. Langfristig verschwinden
   beide Bloecke und nur diese Datei bleibt die Quelle der Wahrheit.
   ===================================================================== */


/* =====================================================================
   1. VARIABLEN
   ===================================================================== */

:root {

    /* --- Marke -------------------------------------------------- */
    --hm-orange:          #fc6e51;   /* Akzentfarbe, wie im Bestand   */
    --hm-orange-light:    #ff8a70;
    --hm-orange-dark:     #e05a3e;
    --hm-orange-soft:     rgba(252, 110, 81, 0.12);
    --hm-cyan:            #00f2ff;   /* nur sparsam, fuer Verlaeufe   */

    /* --- Flaechen (dunkel, Standard) ---------------------------- */
    --hm-bg:              #0a0a0a;
    --hm-bg-card:         #141414;
    --hm-bg-elevated:     #1a1a1a;
    --hm-bg-hover:        #202020;
    --hm-bg-overlay:      rgba(0, 0, 0, 0.72);

    /* --- Text ---------------------------------------------------- */
    --hm-text:            #ffffff;
    --hm-text-dim:        rgba(255, 255, 255, 0.62);
    --hm-text-faint:      rgba(255, 255, 255, 0.38);

    /* --- Linien -------------------------------------------------- */
    --hm-border:          rgba(255, 255, 255, 0.08);
    --hm-border-strong:   rgba(255, 255, 255, 0.16);

    /* --- Zustandsfarben ------------------------------------------ */
    --hm-success:         #3ecf8e;
    --hm-warning:         #ffb84d;
    --hm-danger:          #ff5a5a;

    /* --- Abstaende (4er-Raster) ---------------------------------- */
    --hm-space-1:         4px;
    --hm-space-2:         8px;
    --hm-space-3:         12px;
    --hm-space-4:         16px;
    --hm-space-5:         24px;
    --hm-space-6:         32px;
    --hm-space-7:         48px;
    --hm-space-8:         64px;

    /* --- Rundungen ------------------------------------------------ */
    --hm-radius-sm:       8px;
    --hm-radius:          14px;    /* Standard fuer Karten           */
    --hm-radius-lg:       20px;
    --hm-radius-pill:     999px;

    /* --- Schatten ------------------------------------------------- */
    --hm-shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.4);
    --hm-shadow:          0 4px 16px rgba(0, 0, 0, 0.45);
    --hm-shadow-lg:       0 12px 40px rgba(0, 0, 0, 0.55);
    --hm-shadow-orange:   0 8px 28px rgba(252, 110, 81, 0.28);

    /* --- Schrift -------------------------------------------------- */
    --hm-font: 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, sans-serif;

    --hm-size-xs:         12px;
    --hm-size-sm:         14px;
    --hm-size-base:       16px;
    --hm-size-lg:         18px;
    --hm-size-xl:         22px;
    --hm-size-2xl:        28px;
    --hm-size-3xl:        36px;

    --hm-weight-normal:   400;
    --hm-weight-medium:   600;
    --hm-weight-bold:     800;

    --hm-leading-tight:   1.2;
    --hm-leading:         1.5;

    /* --- Bewegung ------------------------------------------------- */
    --hm-ease:            cubic-bezier(0.22, 0.61, 0.36, 1);
    --hm-fast:            140ms var(--hm-ease);
    --hm-normal:          240ms var(--hm-ease);
    --hm-slow:            420ms var(--hm-ease);

    /* --- Layout --------------------------------------------------- */
    --hm-top-bar-h:       56px;
    --hm-bottom-nav-h:    60px;
    --hm-sidebar-w:       220px;
    --hm-content-max:     1440px;

    /* --- Ebenen (z-index) ---------------------------------------- */
    --hm-z-base:          1;
    --hm-z-sticky:        100;
    --hm-z-overlay:       500;
    --hm-z-dialog:        800;
    --hm-z-toast:        1000;
}

/* Helle Flaechen. Wird per class="hm-light" auf einem Bereich
   gesetzt, nicht global. So bleiben dunkle und helle Bereiche
   mischbar, wie im Auftrag unter Punkt 1 beschrieben.            */
.hm-light {
    --hm-bg:              #f7f7f8;
    --hm-bg-card:         #ffffff;
    --hm-bg-elevated:     #ffffff;
    --hm-bg-hover:        #eeeef0;
    --hm-text:            #111111;
    --hm-text-dim:        rgba(0, 0, 0, 0.6);
    --hm-text-faint:      rgba(0, 0, 0, 0.38);
    --hm-border:          rgba(0, 0, 0, 0.1);
    --hm-border-strong:   rgba(0, 0, 0, 0.18);
    --hm-shadow:          0 4px 16px rgba(0, 0, 0, 0.1);
    --hm-shadow-lg:       0 12px 40px rgba(0, 0, 0, 0.14);

    background: var(--hm-bg);
    color: var(--hm-text);
}

/* Breakpoints koennen in @media nicht als Variable stehen.
   Verbindliche Werte fuer das gesamte Projekt:
       Smartphone      bis  599px    1 Spalte
       Grosses Handy   ab   600px    2 Spalten
       Tablet          ab   900px    3 Spalten
       Desktop         ab  1200px    4 Spalten
       Grosser Desktop ab  1600px    5 Spalten
   Keine anderen Breakpoints einfuehren. Der Bestand hat heute
   dreizehn verschiedene, das ist genau das Problem.              */


/* =====================================================================
   2. GRUNDLAGEN
   ===================================================================== */

.hm-scope,
.hm-scope * { box-sizing: border-box; }

.hm-scope {
    font-family: var(--hm-font);
    font-size: var(--hm-size-base);
    line-height: var(--hm-leading);
    color: var(--hm-text);
    -webkit-font-smoothing: antialiased;
}

/* Kein waagerechtes Wegrutschen der Seite, und Scrollen immer
   mit einem Finger. Siehe Punkt 18 des Auftrags.                 */
.hm-scope { max-width: 100%; overflow-x: clip; touch-action: pan-y; }

.hm-h1 { font-size: var(--hm-size-3xl); font-weight: var(--hm-weight-bold);
         line-height: var(--hm-leading-tight); }
.hm-h2 { font-size: var(--hm-size-2xl); font-weight: var(--hm-weight-bold);
         line-height: var(--hm-leading-tight); }
.hm-h3 { font-size: var(--hm-size-xl);  font-weight: var(--hm-weight-medium); }
.hm-meta { font-size: var(--hm-size-sm); color: var(--hm-text-dim); }

@media (max-width: 599px) {
    .hm-h1 { font-size: var(--hm-size-2xl); }
    .hm-h2 { font-size: var(--hm-size-xl); }
}


/* =====================================================================
   3. KNOEPFE
   ===================================================================== */

.hm-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--hm-space-2);
    min-height: 44px;                 /* Daumengroesse, nicht kleiner */
    padding: 0 var(--hm-space-5);
    border: 1px solid transparent;
    border-radius: var(--hm-radius-pill);
    background: var(--hm-bg-elevated);
    color: var(--hm-text);
    font: inherit;
    font-weight: var(--hm-weight-medium);
    cursor: pointer;
    transition: background var(--hm-fast), transform var(--hm-fast),
                border-color var(--hm-fast);
}
.hm-btn:hover  { background: var(--hm-bg-hover); }
.hm-btn:active { transform: scale(0.97); }
.hm-btn:focus-visible {
    outline: 2px solid var(--hm-orange);
    outline-offset: 2px;
}

.hm-btn--primary {
    background: var(--hm-orange);
    color: #fff;
    box-shadow: var(--hm-shadow-orange);
}
.hm-btn--primary:hover { background: var(--hm-orange-light); }

.hm-btn--ghost {
    background: transparent;
    border-color: var(--hm-border-strong);
}
.hm-btn--icon {
    min-width: 44px; padding: 0;
    border-radius: var(--hm-radius-pill);
}


/* =====================================================================
   4. DAS HEMD — LIKE-KNOPF
   ---------------------------------------------------------------------
   Die Grafiken liegen unter:
       nicht geliked   /Dateien/Herz.png
       geliked         /Dateien/Herz Rot.png   (mit Leerzeichen!)

   Der Zustand wird ueber die Klasse .is-liked gefuehrt, NICHT mehr
   ueber den Dateinamen im src. Das Bild tauscht JavaScript aus, der
   Zustand steht in der Klasse und in aria-pressed.
   ===================================================================== */

.hm-like {
    display: inline-flex; align-items: center; gap: var(--hm-space-2);
    min-height: 44px; padding: 0 var(--hm-space-3);
    background: none; border: 0; color: var(--hm-text-dim);
    font: inherit; font-size: var(--hm-size-sm);
    cursor: pointer;
}
.hm-like__icon {
    width: 30px; height: 30px;
    object-fit: contain;
    display: block;
    transition: transform var(--hm-normal), filter var(--hm-normal);
}
.hm-like:active .hm-like__icon { transform: scale(0.9); }

.hm-like.is-liked { color: var(--hm-text); }
.hm-like.is-liked .hm-like__icon {
    filter: drop-shadow(0 0 10px rgba(252, 110, 81, 0.6));
}

/* Animation beim Setzen: kurz groesser, kleiner Bounce, zurueck. */
.hm-like.is-bouncing .hm-like__icon { animation: hmShirtPop 520ms var(--hm-ease); }

@keyframes hmShirtPop {
      0% { transform: scale(1); }
     30% { transform: scale(1.35) rotate(-6deg); }
     55% { transform: scale(0.92) rotate(3deg); }
     78% { transform: scale(1.08) rotate(-1deg); }
    100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
    .hm-like.is-bouncing .hm-like__icon { animation: none; }
    .hm-scope * { transition-duration: 1ms !important; }
}


/* =====================================================================
   5. VIDEOKARTE
   ---------------------------------------------------------------------
   Passt sich dem Seitenverhaeltnis an. Hochformat wird NICHT auf die
   volle Breite gezogen, sondern bekommt einen ruhigen Rahmen.
   ===================================================================== */

.hm-card {
    display: flex; flex-direction: column;
    background: var(--hm-bg-card);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    overflow: hidden;
    text-decoration: none; color: inherit;
    transition: transform var(--hm-normal), box-shadow var(--hm-normal),
                border-color var(--hm-normal);
}
@media (hover: hover) {
    .hm-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--hm-shadow-lg);
        border-color: var(--hm-border-strong);
    }
}
.hm-card:active { transform: scale(0.99); }

.hm-card__thumb {
    position: relative;
    aspect-ratio: 16 / 9;             /* Standard: Querformat        */
    background: var(--hm-bg-elevated);
    overflow: hidden;
}
.hm-card__thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

/* Hochformat: Bild vollstaendig zeigen, Flaeche ruhig fuellen.    */
.hm-card--portrait .hm-card__thumb { aspect-ratio: 3 / 4; }
.hm-card--portrait .hm-card__thumb img { object-fit: contain;
    background: #000; }
.hm-card--square   .hm-card__thumb { aspect-ratio: 1 / 1; }

/* Laufzeit unten rechts im Bild */
.hm-card__duration {
    position: absolute; right: var(--hm-space-2); bottom: var(--hm-space-2);
    padding: 2px var(--hm-space-2);
    background: rgba(0, 0, 0, 0.78);
    border-radius: var(--hm-radius-sm);
    font-size: var(--hm-size-xs); font-weight: var(--hm-weight-medium);
    color: #fff;
}

/* Fortschrittsbalken fuer Weiterschauen */
.hm-card__progress {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px; background: rgba(255, 255, 255, 0.2);
}
.hm-card__progress span {
    display: block; height: 100%;
    background: var(--hm-orange);
}

.hm-card__body { padding: var(--hm-space-3); display: grid;
                 gap: var(--hm-space-1); }
.hm-card__title {
    font-size: var(--hm-size-base); font-weight: var(--hm-weight-medium);
    line-height: var(--hm-leading-tight);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.hm-card__sub { font-size: var(--hm-size-sm); color: var(--hm-text-dim); }


/* =====================================================================
   6. RASTER UND REIHEN
   ===================================================================== */

.hm-grid {
    display: grid;
    gap: var(--hm-space-4);
    grid-template-columns: 1fr;
}
@media (min-width:  600px) { .hm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width:  900px) { .hm-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .hm-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1600px) { .hm-grid { grid-template-columns: repeat(5, 1fr); } }

/* Waagerecht scrollbare Reihe fuer die Startseite.
   scroll-snap sorgt fuer sauberes Einrasten auf dem Handy.        */
.hm-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72%;
    gap: var(--hm-space-3);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;   /* zieht die Seite nicht mit   */
    padding-bottom: var(--hm-space-2);
    scrollbar-width: none;
}
.hm-row::-webkit-scrollbar { display: none; }
.hm-row > * { scroll-snap-align: start; }

@media (min-width:  600px) { .hm-row { grid-auto-columns: 44%; } }
@media (min-width:  900px) { .hm-row { grid-auto-columns: 30%; } }
@media (min-width: 1200px) { .hm-row { grid-auto-columns: 23%; } }
@media (min-width: 1600px) { .hm-row { grid-auto-columns: 18%; } }

.hm-section { margin-bottom: var(--hm-space-7); }
.hm-section__head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--hm-space-3);
    margin-bottom: var(--hm-space-3);
}
.hm-section__more {
    color: var(--hm-orange); text-decoration: none;
    font-size: var(--hm-size-sm); font-weight: var(--hm-weight-medium);
}


/* =====================================================================
   7. FORMULARE
   ===================================================================== */

.hm-field {
    width: 100%; min-height: 44px;
    padding: var(--hm-space-3) var(--hm-space-4);
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius-sm);
    color: var(--hm-text);
    font: inherit;
    font-size: var(--hm-size-base);   /* 16px, sonst zoomt iOS hinein */
    transition: border-color var(--hm-fast), background var(--hm-fast);
}
.hm-field::placeholder { color: var(--hm-text-faint); }
.hm-field:focus {
    outline: none;
    border-color: var(--hm-orange);
    background: var(--hm-bg-hover);
}
.hm-label {
    display: block; margin-bottom: var(--hm-space-2);
    font-size: var(--hm-size-sm); color: var(--hm-text-dim);
}


/* =====================================================================
   8. DIALOG, PILLEN, HINWEISE
   ===================================================================== */

.hm-dialog {
    position: fixed; inset: 0; z-index: var(--hm-z-dialog);
    display: grid; place-items: end center;
    background: var(--hm-bg-overlay);
    padding: 0;
}
.hm-dialog__panel {
    width: 100%; max-width: 560px;
    max-height: 85vh; overflow-y: auto;
    padding: var(--hm-space-5);
    background: var(--hm-bg-card);
    border-radius: var(--hm-radius-lg) var(--hm-radius-lg) 0 0;
    box-shadow: var(--hm-shadow-lg);
    padding-bottom: calc(var(--hm-space-5) + env(safe-area-inset-bottom));
}
@media (min-width: 900px) {
    .hm-dialog { place-items: center; }
    .hm-dialog__panel { border-radius: var(--hm-radius-lg); }
}

.hm-pill {
    display: inline-flex; align-items: center; gap: var(--hm-space-1);
    padding: var(--hm-space-1) var(--hm-space-3);
    background: var(--hm-orange-soft);
    color: var(--hm-orange);
    border-radius: var(--hm-radius-pill);
    font-size: var(--hm-size-xs); font-weight: var(--hm-weight-medium);
}

.hm-skeleton {
    background: linear-gradient(90deg,
        var(--hm-bg-elevated) 25%,
        var(--hm-bg-hover)    37%,
        var(--hm-bg-elevated) 63%);
    background-size: 400% 100%;
    animation: hmShimmer 1.4s linear infinite;
    border-radius: var(--hm-radius-sm);
}
@keyframes hmShimmer {
      0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}


/* =====================================================================
   9. SICHERE BEREICHE (Handy mit Aussparung)
   ===================================================================== */

.hm-safe-top    { padding-top:    env(safe-area-inset-top); }
.hm-safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
