/* Startseite v2: Sammelseite für die Apps. Nur von templates/home.php geladen. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../innerpulse/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../innerpulse/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: light dark;
  --ah-bg: #fbfbfc;
  --ah-ink: #0b0c0e;
  --ah-dim: #5d6471;
  --ah-tile: #ffffff;
  --ah-line: #eceef1;
  --ah-shadow: rgba(16, 24, 40, .22);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ah-bg: #0d0e10;
    --ah-ink: #f2f3f5;
    --ah-dim: #9aa1ad;
    --ah-tile: #16181c;
    --ah-line: #23262c;
    --ah-shadow: rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--ah-bg);
  color: var(--ah-ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }

.ah {
  flex: 1;
  display: grid;
  align-content: center;
  gap: clamp(36px, 6vw, 72px);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) max(5vw, 16px);
}

.ah-head { text-align: center; }
.ah-head h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -.025em;
  font-weight: 700;
  text-wrap: balance;
}
.ah-head p { margin: 14px 0 0; color: var(--ah-dim); font-size: 17px; text-wrap: balance; }

.ah-apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 36px);
  perspective: 900px;
}
.ah-apps li { display: flex; }

/* Bewegungslogik nach den UX- und Animationsprinzipien:
   Slow in/out: Hereinkommendes ease-out, Zurückkehrendes ease-in.
   Snappy Timing: Zustandswechsel 100 bis 300 ms.
   Squash: Kachel gibt beim Drücken nach, federt beim Loslassen leicht über (Follow Through).
   Solid Drawing: Kippen mit Tiefe, Icon liegt vor der Kachel, das Leuchten wandert gegen die Neigung (Secondary Action).
   Frequency of Use: Hover ist häufig, deshalb nur 6 Grad Neigung. */
.ah-app {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --s: 1;
  --gx: 0;
  --gy: 0;
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  text-align: center;
  padding: clamp(28px, 4vw, 44px) 20px 30px;
  background: var(--ah-tile);
  border: 1px solid var(--ah-line);
  border-radius: 32px;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift)) scale(var(--s));
  transition: transform 300ms var(--ease-in), box-shadow 300ms var(--ease-in);
  -webkit-tap-highlight-color: transparent;
}
.ah-app:hover, .ah-app:focus-visible {
  --lift: -4px;
  box-shadow: 0 24px 48px -24px var(--ah-shadow);
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}
.ah-app.is-tracking { transition: transform 120ms var(--ease-out), box-shadow 250ms var(--ease-out); }
.ah-app:active {
  --s: .97;
  --lift: 0px;
  transition: transform 100ms var(--ease-out);
}
.ah-app.is-released { transition: transform 300ms var(--spring), box-shadow 250ms var(--ease-out); }
.ah-app:focus-visible { outline: 3px solid #2e90e0; outline-offset: 4px; }

.ah-icon {
  position: relative;
  display: block;
  width: min(62%, 170px);
  aspect-ratio: 1;
  margin-bottom: 18px;
  transform: translateZ(40px);
}
.ah-icon img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 22.5%; }
.ah-glow {
  filter: blur(28px) saturate(1.6);
  opacity: .55;
  transform: translate(calc(var(--gx) * -12px), calc(18% + var(--gy) * -12px)) scale(.92);
  transition: transform 300ms var(--ease-in), opacity 300ms var(--ease-in);
}
.ah-app:hover .ah-glow, .ah-app:focus-visible .ah-glow { opacity: .75; transition: transform 250ms var(--ease-out), opacity 250ms var(--ease-out); }
.ah-app.is-tracking .ah-glow { transition: transform 120ms var(--ease-out), opacity 250ms var(--ease-out); }
.ah-face { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 8px 18px rgba(0, 0, 0, .12); }

/* Einstieg: einmal pro Seitenaufruf, gestaffelt (Overlapping), schnell rein und sanft landen */
@keyframes ah-in { from { opacity: 0; transform: translateY(12px); } }
.ah-head, .ah-apps li { animation: ah-in 400ms cubic-bezier(0, 0, .2, 1) backwards; }
.ah-apps li:nth-child(1) { animation-delay: 80ms; }
.ah-apps li:nth-child(2) { animation-delay: 140ms; }
.ah-apps li:nth-child(3) { animation-delay: 200ms; }

.ah-name { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.ah-tag { color: var(--ah-dim); font-size: 15px; max-width: 22em; text-wrap: balance; }

.ah-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 18px;
  padding: 16px 16px 24px;
  font-size: 14px;
  color: var(--ah-dim);
}
.ah-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.ah-foot a:hover, .ah-foot a:focus-visible { color: var(--ah-ink); }

@media (max-width: 720px) {
  .ah-apps { grid-template-columns: minmax(0, 1fr); max-width: 420px; width: 100%; margin: 0 auto; }
  .ah-app {
    grid-template-columns: 88px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    text-align: left;
    column-gap: 20px;
    row-gap: 2px;
    padding: 20px;
    border-radius: 26px;
  }
  .ah-icon { grid-row: span 2; width: 88px; margin: 0; transform: none; }
  .ah-app:hover, .ah-app:focus-visible { --lift: 0px; }
  .ah-tag { text-wrap: pretty; }
}

@media (prefers-reduced-motion: reduce) {
  .ah-head, .ah-apps li { animation: none; }
  .ah-app, .ah-app:hover, .ah-app:active, .ah-glow { transition: none; }
  .ah-app:hover, .ah-app:focus-visible { --lift: 0px; }
}
