*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.25s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ── HASKÖY VARIABLE FONT ── */
@font-face {
  font-family: 'Haskoy';
  src: url('/assets/fonts/woff2/Haskoy-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg:           #181613;
  --surface-dark: #0a0a0a;
  --canvas-bg:    #000000;
  --white:        #ffffff;
  --muted:        rgba(255, 255, 255, 0.55);
  --line:         rgba(255, 255, 255, 0.15);
  --line-hover:   rgba(255, 255, 255, 0.4);
  --accent-glow:  rgba(255, 255, 255, 0.035);
  --ease-smooth:  cubic-bezier(0.22, 1, 0.36, 1);
  --text-base:    clamp(1rem, 0.4vw + 0.9rem, 1.125rem);
  --text-small:   clamp(0.95rem, 0.3vw + 0.85rem, 1rem);
  --heading-2:    clamp(1.75rem, 1.6vw + 1.3rem, 2.4375rem);
}

html, body {
  height: 100%;
  font-family: 'Haskoy', sans-serif;
  background: var(--bg);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── DYNAMISCHER MAUS-GLOW (GPU-OPTIMIERT) ── */
.mouse-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 217, 173, 0.05) 0%, rgba(255, 217, 173, 0) 90%);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  filter: blur(50px);
  transition: opacity 0.5s ease;
  will-change: transform;
}

.vert-rule {
  position: fixed;
  left: clamp(24px, 4vw, 48px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line) 20%, var(--line) 80%, transparent);
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 1.5s 0.2s var(--ease-smooth) forwards;
}

/* ── LAYOUT ── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: max(clamp(28px, 5vw, 56px), env(safe-area-inset-top));
  padding-bottom: max(clamp(28px, 5vw, 56px), env(safe-area-inset-bottom));
  padding-left: max(clamp(48px, 8vw, 96px), env(safe-area-inset-left));
  padding-right: max(clamp(48px, 8vw, 96px), env(safe-area-inset-right));
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.78);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ── TOP BAR ── */
.top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  opacity: 0;
  animation: fadeIn 1s 0.1s var(--ease-smooth) forwards;
}

.monogram {
  grid-column: 1;
  justify-self: start;
  font-family: 'Haskoy', sans-serif;
  font-size: 1.95rem;
  font-weight: 500;
  color: var(--white);
  display: flex;
  align-items: baseline;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.monogram-dot {
  width: 5px;
  height: 5px;
  background: var(--white);
  border-radius: 50%;
  margin-left: 2px;
}

.back-link {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.3s var(--ease-smooth);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--white);
}

.back-link svg {
  transition: transform 0.3s var(--ease-smooth);
}

.back-link:hover svg {
  transform: translateX(-4px);
}

.lang-switcher {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.lang-switcher button {
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s var(--ease-smooth), color 0.3s var(--ease-smooth);
}

.lang-switcher button:focus-visible {
  border-radius: 999px;
  outline-offset: 2px;
}

.lang-switcher button:hover,
.lang-switcher button.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

/* ── CENTER & DIVIDER ── */
.center {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.divider {
  width: 120px;
  height: 2px;
  background: linear-gradient(to right, var(--line), transparent);
}

/* ── FOOTER ── */
.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  opacity: 0;
  animation: fadeIn 1s 1s var(--ease-smooth) forwards;
}

.location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease-smooth);
  white-space: nowrap;
}

.location:hover {
  color: var(--white);
}

.location .sep {
  opacity: 0.4;
  margin: 0 8px;
}

.legal-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s var(--ease-smooth);
  background: none;
  border: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 4px;
}

.legal-links a.active-legal {
  color: var(--white);
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: var(--white);
}

.legal-links .sep {
  opacity: 0.4;
}

.copy {
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.3s var(--ease-smooth);
  white-space: nowrap;
}

.copy:hover {
  color: var(--white);
}

/* ── TOAST NOTIFICATION (HOME) ── */
#toast {
  position: fixed;
  bottom: calc(30px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 100px);
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: transform 0.4s var(--ease-smooth);
  z-index: 100;
}

#toast.show {
  transform: translate(-50%, 0);
}

/* ── HOME PAGE ── */
body[data-page="index"] .center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 64px;
}

body[data-page="index"] .divider {
  margin: 48px 0;
  opacity: 0;
  animation: expandWidth 1s 0.5s var(--ease-smooth) forwards;
  transform-origin: left;
}

.profile-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
  flex-wrap: wrap;
}

.profile-left {
  display: flex;
  align-items: center;
  gap: clamp(28px, 4vw, 42px);
  flex-wrap: wrap;
  flex: 1 1 420px;
  min-width: 0;
}

.snake-game {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: clamp(240px, 26vw, 320px);
  max-width: 320px;
  flex-shrink: 0;
  opacity: 0;
  animation: fadeUp 1s 0.8s var(--ease-smooth) forwards;
  align-self: center;
  margin-left: auto;
}

.profile-photo-wrapper {
  width: clamp(136px, 19vw, 190px);
  height: clamp(136px, 19vw, 190px);
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, rgba(208, 225, 249, 0.4), transparent 70%);
  opacity: 0;
  animation: fadeInScale 0.8s 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  flex-shrink: 0;
}

.profile-photo-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-dark);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.profile-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 20%;
  filter: grayscale(15%) contrast(105%);
}

.name {
  font-family: 'Haskoy', sans-serif;
  font-size: clamp(3.6rem, 9.2vw, 8rem);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--white);
  opacity: 0;
  animation: fadeUp 1s 0.2s var(--ease-smooth) forwards;
}

.links-list {
  display: flex;
  flex-direction: column;
  max-width: 560px;
  width: 100%;
  opacity: 0;
  animation: fadeUp 1s 0.7s var(--ease-smooth) forwards;
}

.snake-canvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: var(--canvas-bg);
  display: block;
  touch-action: none;
  cursor: pointer;
  transition: border-color 0.25s var(--ease-smooth);
}

.snake-canvas:focus {
  border-color: rgba(255, 255, 255, 0.65);
}

.snake-canvas:focus:not(:focus-visible) {
  outline: none;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: color 0.4s var(--ease-smooth);
  position: relative;
  cursor: pointer;
}

.link-row::before,
.link-row::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--line);
  transition: background-color 0.4s var(--ease-smooth), z-index 0s;
  pointer-events: none;
  z-index: 1;
}

.link-row::before { top: 0; }
.link-row::after { bottom: 0; }

.link-row + .link-row::before {
  display: none;
}

.link-row:hover,
.link-row:focus-visible {
  color: var(--white);
}

.link-row:hover::before,
.link-row:focus-visible::before,
.link-row:hover::after,
.link-row:focus-visible::after {
  background-color: var(--line-hover);
  z-index: 2;
}

.link-row + .link-row:hover::before,
.link-row + .link-row:focus-visible::before {
  display: block;
}

.link-info {
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.4s var(--ease-smooth);
}

.link-row:hover .link-info,
.link-row:focus-visible .link-info {
  transform: translateX(10px);
}

.link-icon {
  color: var(--white);
  opacity: 0.65;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s var(--ease-smooth);
}

.link-row:hover .link-icon,
.link-row:focus-visible .link-icon {
  opacity: 1;
}

.arrow-icon {
  opacity: 0;
  transform: translateX(-15px);
  transition: opacity 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
  color: var(--white);
}

.link-row:hover .arrow-icon,
.link-row:focus-visible .arrow-icon {
  opacity: 1;
  transform: translateX(0);
}

.link-row-split {
  padding: 0;
  cursor: default;
}

.link-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 12px 24px 0;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: color 0.4s var(--ease-smooth);
}

.link-row-main:hover,
.link-row-main:focus-visible {
  color: var(--white);
}

.link-row-split:hover .link-info {
  transform: none;
}

.link-row-split:hover .link-icon {
  opacity: 0.65;
}

.link-row-split:hover .arrow-icon {
  opacity: 0;
  transform: translateX(-15px);
}

.link-row-main:hover .link-info,
.link-row-main:focus-visible .link-info {
  transform: translateX(10px);
}

.link-row-main:hover .link-icon,
.link-row-main:focus-visible .link-icon {
  opacity: 1;
}

.link-row-main:hover .arrow-icon,
.link-row-main:focus-visible .arrow-icon {
  opacity: 1;
  transform: translateX(0);
}

.qr-trigger {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s var(--ease-smooth), background-color 0.3s var(--ease-smooth);
}

.qr-trigger:hover,
.qr-trigger:focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

/* ── QR CODE DIALOG ── */
.qr-dialog {
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  max-width: calc(100vw - 32px);
  overflow: visible;
}

.qr-dialog::backdrop {
  background: rgba(10, 9, 8, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.qr-dialog-card {
  width: min(320px, calc(100vw - 32px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.qr-dialog-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qr-dialog-title {
  font-family: 'Haskoy', sans-serif;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

.qr-dialog-close {
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s var(--ease-smooth), background-color 0.25s var(--ease-smooth);
}

.qr-dialog-close:hover,
.qr-dialog-close:focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.qr-code-frame {
  background: var(--white);
  padding: 16px;
  border-radius: 16px;
  line-height: 0;
}

.qr-code-frame img {
  display: block;
  width: 224px;
  max-width: 100%;
  height: auto;
}

.qr-dialog-caption {
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

/* ── LEGAL PAGES (IMPRESSUM & DATENSCHUTZ) ── */
body[data-page="impressum"] .center,
body[data-page="datenschutz"] .center {
  padding-block: 56px;
  opacity: 0;
  animation: fadeUp 1s 0.3s var(--ease-smooth) forwards;
}

body[data-page="impressum"] .divider,
body[data-page="datenschutz"] .divider {
  margin-bottom: 48px;
}

.page-title {
  font-family: 'Haskoy', sans-serif;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.page-subtitle {
  color: var(--white);
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: 48px;
}

section {
  margin-bottom: 40px;
}

h2 {
  font-family: 'Haskoy', sans-serif;
  font-weight: 500;
  font-size: var(--heading-2);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

p, address {
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--white);
  font-style: normal;
  max-width: 65ch;
  margin-bottom: 8px;
}

.rights-list {
  margin: 0 0 8px 1.2em;
  max-width: 65ch;
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--white);
}

.policy-updated {
  color: var(--muted);
  margin-top: 16px;
}

a.inline-link {
  color: var(--white);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s var(--ease-smooth);
}

a.inline-link:hover {
  text-decoration-color: var(--white);
}

/* ── 404 PAGE ── */
body[data-page="404"] .center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 56px;
  opacity: 0;
  animation: fadeUp 1s 0.3s var(--ease-smooth) forwards;
}

body[data-page="404"] .page-subtitle {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

body[data-page="404"] .divider {
  margin-bottom: 32px;
}

body[data-page="404"] .bottom {
  animation-delay: 0.6s;
}

.error-code {
  font-family: 'Haskoy', sans-serif;
  font-size: clamp(4.5rem, 11vw, 8.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.page-text {
  color: var(--muted);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 520px;
}

.home-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 420px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--white);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: padding-left 0.35s var(--ease-smooth), border-color 0.35s var(--ease-smooth);
}

.home-cta:hover {
  padding-left: 10px;
  border-color: rgba(255, 255, 255, 0.35);
}

.home-cta svg {
  transition: transform 0.35s var(--ease-smooth);
}

.home-cta:hover svg {
  transform: translateX(4px);
}

/* ── ANIMATIONS & PREFERENCES ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes expandWidth {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: rgba(255, 255, 255, 0.85);
    --line: rgba(255, 255, 255, 0.45);
    --line-hover: rgba(255, 255, 255, 0.85);
  }

  .snake-canvas {
    border-color: rgba(255, 255, 255, 0.55);
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  body[data-page="index"] .vert-rule {
    display: none;
  }

  body[data-page="index"] .page {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  body[data-page="index"] .top {
    gap: 12px;
    width: 100%;
  }

  body[data-page="index"] .monogram {
    font-size: 1.5rem;
  }

  .profile-group {
    flex-direction: column;
    gap: 40px;
    align-items: center;
  }

  .profile-left {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .name {
    font-size: clamp(3.8rem, 14vw, 5.2rem);
    text-align: center;
  }

  .profile-photo-wrapper {
    width: clamp(176px, 46vw, 212px);
    height: clamp(176px, 46vw, 212px);
  }

  .snake-game {
    margin: 0 auto;
    width: 100%;
    max-width: 360px;
  }

  .snake-canvas {
    max-width: 100%;
  }

  .link-row {
    padding: 16px 0;
    font-size: 0.95rem;
  }

  .link-row-split {
    padding: 0;
  }

  .link-row-main {
    padding: 16px 12px 16px 0;
  }

  body[data-page="index"] .bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 40px;
  }

  body[data-page="index"] .location {
    flex-wrap: wrap;
    white-space: normal;
  }

  body[data-page="index"] .legal-links,
  body[data-page="index"] .location,
  body[data-page="index"] .copy {
    width: 100%;
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .vert-rule {
    display: none;
  }

  .page {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .top {
    gap: 12px;
    width: 100%;
  }

  .monogram {
    font-size: 1.5rem;
  }

  .back-link {
    text-align: end;
  }

  .bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 40px;
  }

  .location {
    flex-wrap: wrap;
    white-space: normal;
  }

  .location,
  .legal-links,
  .legal-links a,
  .copy {
    font-size: 0.95rem;
    line-height: 1.4;
  }

  body[data-page="impressum"] p,
  body[data-page="impressum"] address,
  body[data-page="impressum"] h2,
  body[data-page="impressum"] ul,
  body[data-page="datenschutz"] p,
  body[data-page="datenschutz"] address,
  body[data-page="datenschutz"] h2,
  body[data-page="datenschutz"] ul {
    padding-right: 12px;
    word-break: break-word;
  }
}
