/* ============================================================
   Startseite — minimal, Vollbild-Animation
   ============================================================ */

body.home {
  position: relative;
  min-height: max(100svh, 540px);
  overflow-x: hidden;
  cursor: crosshair;
}
body.home a { cursor: pointer; }

/* ---------- Hintergrund: langsam treibendes Polarlicht ---------- */
.aurora {
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.5;
}
.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.aurora::before {
  width: 55vmax;
  height: 40vmax;
  left: 18%;
  top: 22%;
  background: radial-gradient(closest-side, rgba(56, 224, 245, 0.35), transparent);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.aurora::after {
  width: 60vmax;
  height: 45vmax;
  right: 12%;
  top: 30%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, 0.32), transparent);
  animation: drift-b 28s ease-in-out infinite alternate;
}
@keyframes drift-a {
  to { transform: translate(14vw, 8vh) rotate(25deg) scale(1.15); }
}
@keyframes drift-b {
  to { transform: translate(-16vw, -6vh) rotate(-20deg) scale(0.9); }
}

/* Feines Raster wie auf einem Bildschirm */
body.home::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 42%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 42%, #000 20%, transparent 75%);
}

/* ---------- Leiterbahnen (Vektor) ---------- */
#circuit {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
#circuit .trace {
  fill: none;
  stroke: rgba(77, 140, 255, 0.32);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: var(--len);
  animation: trace-draw var(--dur) cubic-bezier(0.5, 0, 0.2, 1) var(--delay) backwards;
}
@keyframes trace-draw {
  from { stroke-dashoffset: var(--len); }
  to   { stroke-dashoffset: 0; }
}
#circuit .pulse {
  fill: none;
  stroke: #38e0f5;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dashoffset: var(--dash);
  opacity: 0;
  animation: trace-pulse var(--dur) linear var(--delay) infinite;
}
@keyframes trace-pulse {
  0%   { stroke-dashoffset: var(--dash); opacity: 1; }
  40%  { opacity: 1; }
  41%  { opacity: 0; }
  100% { stroke-dashoffset: calc(var(--len) * -2.4); opacity: 0; }
}
#circuit .via {
  fill: #070b16;
  stroke: rgba(56, 224, 245, 0.6);
  stroke-width: 1.4;
  transform-box: fill-box;
  transform-origin: center;
  animation: via-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) var(--delay) backwards;
}
#circuit .pad {
  fill: rgba(56, 224, 245, 0.7);
  animation: via-pop 0.3s ease-out var(--delay) backwards;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes via-pop {
  from { transform: scale(0); opacity: 0; }
}

/* ---------- Partikel-Leinwand ---------- */
#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Fadenkreuz ---------- */
.reticle {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.reticle.on { opacity: 1; }
.reticle svg {
  position: absolute;
  left: -40px;
  top: -40px;
  overflow: visible;
}
.reticle .r-ring {
  fill: none;
  stroke: rgba(56, 224, 245, 0.55);
  stroke-width: 1;
  stroke-dasharray: 4 6;
  transform-origin: center;
  animation: spin 6s linear infinite;
}
.reticle .r-tick,
.reticle .r-corner {
  fill: none;
  stroke: rgba(56, 224, 245, 0.85);
  stroke-width: 1.2;
}
.reticle .r-dot { fill: #38e0f5; }
.reticle.fire svg { animation: fire 0.45s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fire {
  0%   { transform: scale(0.6); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.r-read {
  position: absolute;
  left: 30px;
  top: 26px;
  white-space: nowrap;
  color: rgba(56, 224, 245, 0.75);
  font: 600 10px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
}
@media (hover: none) {
  .r-read { display: none; }
}

/* ---------- Kopfzeile ---------- */
.home-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 24px 0;
}

/* ---------- Titel (Fallback ohne JavaScript) ---------- */
.home-title {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  width: 90%;
  text-align: center;
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  background: linear-gradient(100deg, #38e0f5 0%, #4d8cff 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-title span {
  display: block;
  margin-top: 0.4em;
  font-size: 0.2em;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
}
/* Mit Animation: Titel nur für Screenreader & Suchmaschinen */
.has-canvas .home-title {
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Inhalt unter dem Schriftzug ---------- */
.home-content {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 0 20px;
  text-align: center;
}

/* Terminal-Zeile */
.it-line {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  min-height: 1.5em;
  color: var(--text);
  font: 500 clamp(0.95rem, 2.4vw, 1.3rem)/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
}
.it-line .prompt { color: var(--accent); }
.it-line .caret {
  width: 0.6em;
  height: 1.15em;
  margin-left: -0.45em;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Buttons: beide identisch */
.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  animation: fade-up 1s var(--ease) 2.3s both;
}
.btn-glass {
  min-width: 210px;
  border-color: rgba(56, 224, 245, 0.28);
  background: rgba(7, 11, 22, 0.55);
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn-glass svg { color: var(--accent); }
.btn-glass:hover {
  border-color: var(--accent);
  background: rgba(56, 224, 245, 0.08);
  box-shadow: 0 0 0 1px rgba(56, 224, 245, 0.25), 0 10px 30px -12px var(--accent-glow);
  transform: translateY(-2px);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Fußzeile ---------- */
.home-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 0 24px max(20px, env(safe-area-inset-bottom));
  color: var(--text-dim);
  font-size: 0.85rem;
}
.home-footer nav { display: flex; gap: 20px; }
.home-footer a { text-decoration: none; }
.home-footer a:hover { color: var(--text); }

/* ---------- Hochformat (Handy) ---------- */
@media (max-aspect-ratio: 9/10) {
  .home-title { top: 38%; }
  .home-content { top: 56%; gap: 32px; }
  .home-actions { flex-direction: column; width: 100%; max-width: 320px; }
  .home-actions .btn { width: 100%; }
  .home-footer { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #circuit .pulse, .reticle { display: none; }
  .it-line .caret { animation: none; }
}

.has-canvas .home-content:not(.placed) { visibility: hidden; }
