/* =========================================
   Variablen & Basis
   ========================================= */
:root{
  --text: #e8eef6;
  --muted: #98a4b3;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-strong: 0 25px 60px rgba(0,0,0,.55);

  --gap: 18px;
  --cols-max: 4;
  --card-target: 320px;
  --container-max: calc(var(--cols-max) * var(--card-target) + (var(--cols-max) - 1) * var(--gap));

  /* Vertikale Abstände – größer als vorher */
  --space-title-top: 120px;   /* Überschrift weiter nach unten (mehr Top-Abstand) */
  --space-between:   56px;    /* Abstand zwischen den Blöcken */
}

*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: var(--text);
  background:#0b1016 url('hintergrund.jpg') center/cover no-repeat fixed;
  min-height:100svh;
  padding:32px 24px;
  overflow-x:hidden;
}
.container{
  width:100%;
  max-width: var(--container-max);
  margin:0 auto;
  animation: fadeIn .6s ease both;
}

/* =========================================
   Titel (Genos 400, clean weiß)
   ========================================= */
.title{
  margin: var(--space-title-top) 0 var(--space-between) 0;
  text-align:center;
  font-family: "Genos", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;                  /* Regular 400 */
  font-size: clamp(48px, 10vw, 84px);
  line-height: 1.05;
  color: #fff;                       /* clean weiß */
  letter-spacing: .4px;
  text-shadow: none;
}

/* =========================================
   Suchfeld (Pill, milchig, jetzt weniger transparent → 0.65)
   ========================================= */
.search-wrap{ margin: 0 0 calc(var(--space-between) * 1.2); }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 20, 30, .65);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  padding: 8px 10px 8px 12px; /* Höhe reduziert */
  box-shadow: var(--shadow);
  max-width: 66%; /* Breite ~2/3 */
  margin: 0 auto; /* zentriert */
}
.g-logo{ display:grid; place-items:center; width:28px; height:28px; border-radius:999px; background:rgba(255,255,255,.06); }
.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;  /* vorher 18px */
  line-height: 1.2;
  padding: 6px 4px;
}

.search button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 8px 14px; /* kleiner */
  background: linear-gradient(135deg, rgba(139,92,246,.35), rgba(34,211,238,.30));
  color: #eef2ff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}
.search button:hover{ transform: translateY(-1px); filter:brightness(1.08); }

/* =========================================
   Grid Layouts
   ========================================= */
.grid{
  display:grid; gap: var(--gap);
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1200px){
  .container{ max-width: calc(3 * var(--card-target) + 2 * var(--gap)); }
  .grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px){
  .container{ max-width: calc(2 * var(--card-target) + 1 * var(--gap)); }
  .grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px){
  .container{ max-width: 100%; }
  .grid{ grid-template-columns: 1fr; }
}

/* =========================================
   Kacheln (kein Milchglas, ~35% Transparenz → 0.65, 3D Tilt)
   ========================================= */
.services{ margin-bottom: calc(var(--space-between) * 1.2); }
.services .hitbox{ position:relative; padding: 12px; margin:-12px; }
.sensor{
  position:absolute; inset:0; border-radius: var(--radius);
  z-index:2; background:transparent;
}
.card{
  display:block; width:100%;
  position:relative;
  background: rgba(15,20,30,.65);  /* ~50–65% dunkel-transparent */
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  padding:18px;
  color:inherit; text-decoration:none;
  box-shadow: var(--shadow);
  overflow:hidden; isolation:isolate;
  transform-style: preserve-3d; backface-visibility: hidden;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s cubic-bezier(.2,.8,.2,1), border-color .35s ease;
}

/* >>> Gradient-Glow wie in der REFERENZ (konischer Verlauf + Blur + Rotation) <<< */
.card::before{
  content:""; position:absolute; inset:-1px; border-radius: calc(var(--radius) + 1px);
  /* kräftiger conic-gradient in Lila/Türkis – identische Anmutung wie referenz.html */
  background: conic-gradient(from 180deg,
              rgba(139,92,246,.70),   /* var(--accent) */
              rgba(34,211,238,.70),   /* var(--accent-2) */
              rgba(139,92,246,.70));  /* var(--accent) */
  filter: blur(20px);
  opacity: 0;                         /* erst auf Hover sichtbar */
  transition: opacity .45s ease;
  z-index:-1;
  animation: spin 12s linear infinite; /* sanfte Drehung wie früher */
}

.services .hitbox:hover .card{ border-color: rgba(139,92,246,.45); box-shadow: var(--shadow-strong); }
.services .hitbox:hover .card::before{ opacity:.4; } /* Sichtbarkeit wie in der Referenz */

/* Inhalt */
.icon{
  width:48px; height:48px; border-radius:14px; display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(139,92,246,.26), rgba(34,211,238,.20));
  border:1px solid rgba(255,255,255,.10); margin-bottom:12px;
}
.icon svg{ width:22px; height:22px; opacity:.95; }
h3{ margin:0 0 6px 0; font-size:19px; letter-spacing:.2px; color:#fff; }
p{ margin:0 0 10px 0; color:var(--muted); font-size:14px; line-height:1.45; }
.meta{ display:flex; align-items:center; gap:10px; color:#b3c0ff; font-size:12px; opacity:.9; }
.pill{ border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.04); padding:4px 8px; border-radius:999px; }
.arrow{ margin-left:auto; transition: transform .35s ease; }
.services .hitbox:hover .arrow{ transform: translateX(6px); }


/* Footer */
footer{ margin-top: calc(var(--space-between) * 1.2); color:var(--muted); font-size:12px; text-align:center; opacity:.8; }

/* Footer unten fixieren */
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1; /* Inhalt nimmt Resthöhe ein */
  display: flex;
  flex-direction: column;
}

footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  opacity: .8;
  padding: 18px 0 8px 0;
}


/* Animation */
@keyframes fadeIn{ from{ opacity:0; transform: translateY(6px) } to{ opacity:1; transform:none } }
/* neu hinzugefügt für den Glow-Verlauf (wie referenz.html) */ 

/* =========================================
   Favoriten – Styling & Variablen
   ========================================= */
:root{
  --fav-gap: 14px;                 /* Abstand zwischen Mini-Kacheln */
  --fav-size: 90px;                /* Breite/Höhe der Klickfläche */
  --fav-radius: 14px;              /* Rundung */
  --fav-bg-hover: rgba(255,255,255,.08); /* graues transparentes Quadrat */
  --fav-shadow: 0 10px 16px rgba(0,0,0,.35); /* Schatten unter Icon */
  --fav-label: #c9d4e6;           /* Textfarbe unter Icon */
  --fav-menu-bg: #121821;         /* Menü-Hintergrund */
  --fav-menu-border: rgba(255,255,255,.08);
}

.favorites{ 
  margin-top: calc(var(--space-between) * 1.0);
}
.favorites-title{
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .2px;
  color:#fff;
}

/* Grid – automatisch umbrechend */
.fav-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--fav-size), 1fr));
  gap: var(--fav-gap);
}

/* Basis-Kachel */
.fav-item{
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  text-align: center;
}

.fav-box{
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1/1;              /* Quadratisch */
  border-radius: var(--fav-radius);
  transition: background .25s ease;
}

.fav-icon{
  width: 42px; height: 42px;
  display: grid; place-items:center;
  transition: transform .25s ease, filter .25s ease, box-shadow .25s ease;
  will-change: transform;
  box-shadow: none;
}

/* Label unter dem Square */
.fav-label{
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--fav-label);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;    /* zu lange Namen einkürzen */
  white-space: nowrap;
}

/* Hover-Verhalten: graues Quadrat + Icon lift + Schatten */
.fav-item:hover .fav-box{ background: var(--fav-bg-hover); }
.fav-item:hover .fav-icon{ transform: translateY(-5px); box-shadow: var(--fav-shadow); }

/* Drei-Punkte-Menü (Kebab) – erscheint erst auf Hover */
.fav-kebab{
  position: absolute;
  top: -1px; right: -1px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(0,0,0,.01);
  border: 1px solid rgba(255,255,255,.08);
  opacity: 0; pointer-events: none; 
  transition: opacity .2s ease, background .2s ease;
}
.fav-item:hover .fav-kebab{ opacity: 1; pointer-events: auto; }
.fav-kebab:hover{ background: rgba(0,0,0,.35); }

/* Menü-Popup */
.fav-menu{
  position: absolute;
  top: 36px; right: 6px;
  min-width: 140px;
  background: var(--fav-menu-bg);
  border: 1px solid var(--fav-menu-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 10;
}
.fav-menu button{
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.fav-menu button:hover{ background: rgba(255,255,255,.06); }

/* Plus-Kachel optisch etwas “deaktiviert” */
.fav-add .fav-box{ border: 1px dashed rgba(255,255,255,.14); }
.fav-add:hover .fav-box{ background: var(--fav-bg-hover); border-style: solid; }

/* Kleine Responsive-Anpassung */
@media (max-width: 560px){
  :root{ --fav-size: 84px; }
  .fav-icon{ width: 45px; height: 45px; }
}

:root{
  --fav-icon-size: 60px;   /* Iconfläche (vorher 42px) */
  --fav-lift: 10px;        /* Hover-Lift in px (vorher 10px) */
}

.fav-icon{
  width: var(--fav-icon-size);
  height: var(--fav-icon-size);
}

.fav-icon img{
  display: block;
  width: calc(var(--fav-icon-size) - 6px);  /* leicht kleiner, damit Luft bleibt */
  height: calc(var(--fav-icon-size) - 6px);
}

/* ===== Favoriten-Icon: Rand-Halo fix + größer + sauberer Schatten (OVERRIDE) ===== */
:root{
  --fav-icon-size: 48px;      /* Icon-Fläche */
  --fav-lift: 5px;           /* Hover-Lift */
  --fav-shadow-y: 10px;       /* Schatten-Versatz nach unten */
  --fav-shadow-blur: 14px;    /* Schatten-Weichheit */
  --fav-shadow-opacity: .80;  /* Schatten-Deckkraft */
}

.fav-icon{
  width: var(--fav-icon-size);
  height: var(--fav-icon-size);
  display: grid;
  place-items: center;
}

/* Bild füllt die Fläche komplett – kein Zwischenraum mehr → kein heller Rand */
.fav-icon img{
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 22%; /* kannst du auf 0% setzen, wenn du keine Rundung willst */
  /* Schatten direkt am Bild (folgt der runden PNG-Kante) */
  filter: drop-shadow(0 var(--fav-shadow-y) var(--fav-shadow-blur) rgba(0,0,0,var(--fav-shadow-opacity)));
}

/* Hover: höher heben, aber KEIN box-shadow mehr auf dem Container (rechteckiger Halo) */
.fav-item:hover .fav-icon{
  transform: translateY(calc(-1 * var(--fav-lift)));
  box-shadow: none; /* überschreibt evtl. frühere Regel */
}
.fav-item:hover .fav-icon img{
  filter: drop-shadow(0 calc(var(--fav-shadow-y) + 2px) calc(var(--fav-shadow-blur) + 2px) rgba(0,0,0,var(--fav-shadow-opacity)));
}

/* ===========================
   MOBILE FIXES (<= 680px)
   =========================== */
@media (max-width: 680px){

  /* 1) Hintergrund: auf Mobile als echtes FIXED-Overlay rendern
        (Workaround für Android/WebKit Bugs mit background-attachment: fixed) */
  body{
    background: #0b1016;                 /* Basisfarbe */
    padding: 20px 14px;                  /* etwas schmaler */
    overflow-x: hidden;                  /* sicherheitshalber */
  }
  body::before{
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0b1016 url('hintergrund.jpg') center/cover no-repeat;
    will-change: transform;              /* glattes scrollen */
    transform: translateZ(0);
  }

  /* 2) Horizontal-Scroll killen:
        negative Außenabstände der Kachel-Hitboxen neutralisieren */
  .services .hitbox{
    margin: 0;           /* war -12px → kann über den Viewport ragen */
    padding: 10px;       /* etwas kompakter */
  }

  /* 3) Suchleiste: volle Breite, keine Überläufe */
  .search-wrap{ margin-bottom: 28px; }
  .search{
    max-width: 100%;
    width: 100%;
    padding: 8px 10px;
  }
  .search input{
    min-width: 0;        /* lässt flex korrekt schrumpfen */
    font-size: 16px;     /* mobile-optimiert, verhindert Zoom */
  }
  .search button{
    flex: 0 0 auto;      /* Button behält eigene Größe */
    padding: 8px 12px;
    white-space: nowrap;
  }

  /* 4) Kacheln & Titel etwas kompakter */
  .title{
    font-size: clamp(36px, 12vw, 56px);
    margin-top: 36px;
    margin-bottom: 24px;
  }
  .grid{ gap: 14px; }

  /* 5) Favoriten-Grid kompakter, ohne Überlauf */
  :root{
    --fav-size: 88px;
    --fav-gap: 12px;
    --fav-icon-size: 46px;
  }
}

/* Zusätzliche Sicherheit auch für sehr kleine Geräte (<= 360px) */
@media (max-width: 360px){
  .search{ padding: 6px 8px; }
  .search button{ padding: 6px 10px; }
  :root{ --fav-size: 80px; --fav-icon-size: 42px; }
}
