/* Theermann Media – Startseite */
:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.62);
  --glass: rgba(30, 30, 36, 0.55);
  --glass-solid: #1c1c21;
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-top: rgba(255, 255, 255, 0.2);
  --accent: #34c759;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* gedämpft, ohne Überschwingen */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font: 1rem/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Farbflächen hinter dem Glas, damit der Blur etwas zu verwischen hat */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 15% 10%, rgba(52, 199, 89, 0.16), transparent 70%),
    radial-gradient(45vmax 45vmax at 90% 20%, rgba(10, 132, 255, 0.14), transparent 70%),
    radial-gradient(50vmax 50vmax at 60% 100%, rgba(191, 90, 242, 0.12), transparent 70%);
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 3px;
  border-radius: 12px;
}

/* ===== Layout ===== */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(4.5rem, 10vh, 7rem) 1.25rem 2.5rem;
}

.header { text-align: center; margin-bottom: clamp(2.25rem, 6vh, 3.5rem); }

.header h1 {
  margin: 0 0 0.5rem;
  font: 700 clamp(2.1rem, 5.5vw, 3.5rem)/1.05 var(--font-display);
  letter-spacing: -0.025em;
  font-optical-sizing: auto;
}

.header p {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--text-2);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 36rem) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 62rem) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ===== Karten ===== */
.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.5rem 1.25rem 1.25rem;
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-top);
  border-radius: 22px;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.45s var(--ease-out), border-color 0.3s ease, box-shadow 0.45s var(--ease-out);
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 20px 44px rgba(0, 0, 0, 0.45);
  }
}

/* Feedback sofort beim Drücken */
.card:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 14px rgba(0, 0, 0, 0.35);
}

.icon svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-blue   { background: linear-gradient(160deg, #4aa8ff, #0a6cff); }
.icon-orange { background: linear-gradient(160deg, #ffb340, #ff8a00); }
.icon-purple { background: linear-gradient(160deg, #c98bff, #8e44e8); }
.icon-green  { background: linear-gradient(160deg, #5be07f, #1fae4a); }

.card h2 {
  margin: 0 0 0.35rem;
  font: 600 1.1875rem/1.2 var(--font-display);
  letter-spacing: -0.012em;
}

.card p {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.cta {
  margin-top: auto;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
}

.cta i {
  display: inline-block;
  font-style: normal;
  transition: transform 0.35s var(--ease-out);
}

@media (hover: hover) {
  .card:hover .cta i { transform: translateX(3px); }
}

/* ===== Topbar / Benutzer ===== */
.topbar {
  position: fixed;
  top: max(0.9rem, env(safe-area-inset-top));
  right: max(1.1rem, env(safe-area-inset-right));
  z-index: 50;
}

.login-pill {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-top);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  transition: transform 0.2s var(--ease-out), background 0.2s ease;
}

.login-pill:hover { background: rgba(60, 60, 70, 0.6); }
.login-pill:active { transform: scale(0.96); transition-duration: 0.1s; }

.user-menu { position: relative; }

.user-trigger {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.3s var(--ease-out);
}

.user-trigger:active { transform: scale(0.92); transition-duration: 0.1s; }

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(160deg, #5be07f, #1fae4a);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset, 0 4px 14px rgba(52, 199, 89, 0.35);
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-img[hidden] { display: none; }

/* Menü entsteht am Avatar (oben rechts) und schließt auf demselben Weg */
.user-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 13rem;
  padding: 0.5rem;
  background: rgba(34, 34, 40, 0.72);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-top);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.88);
  filter: blur(6px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.35s var(--ease-out),
    filter 0.25s var(--ease-out),
    visibility 0s linear 0.35s;
}

.user-panel[hidden] { display: block; } /* Sichtbarkeit steuert .is-open */

.user-menu.is-open .user-panel {
  opacity: 1;
  transform: none;
  filter: none;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.user-name {
  padding: 0.4rem 0.75rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-panel a {
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.user-panel a:hover,
.user-panel a:focus-visible { background: rgba(255, 255, 255, 0.1); }
.user-panel a:active { background: rgba(255, 255, 255, 0.16); }

.user-panel hr {
  margin: 0.35rem 0.5rem;
  border: 0;
  border-top: 1px solid var(--stroke);
}

/* ===== Footer ===== */
.footer {
  margin-top: clamp(3rem, 8vh, 4.5rem);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.footer-links {
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover { color: var(--text); text-decoration: underline; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ===== Barrierefreiheit ===== */
@media (prefers-reduced-motion: reduce) {
  .card { animation: fade 0.3s ease both; animation-delay: 0s; }
  .card, .cta i, .user-trigger, .login-pill, .user-panel { transition-property: opacity, background, border-color; transition-duration: 0.2s; }
  .card:hover, .card:active { transform: none; }
  .user-panel { transform: none; filter: none; }
  .cta i { transform: none !important; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-transparency: reduce) {
  .card, .login-pill, .user-panel {
    background: var(--glass-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root { --text-2: rgba(255, 255, 255, 0.85); --stroke: rgba(255, 255, 255, 0.5); --stroke-top: rgba(255, 255, 255, 0.6); }
  .card, .login-pill, .user-panel { background: var(--glass-solid); }
}
