/* Logo Styles für Header */
.fixed-logo {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  z-index: 9999;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  mix-blend-mode: difference;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.fixed-logo:visited,
.fixed-logo:active,
.fixed-logo:focus,
.fixed-logo:hover {
  opacity: 1;
  text-decoration: none;
  outline: none;
  background: transparent;
}

.fixed-logo.visible {
  opacity: 1;
  visibility: visible;
}

.fixed-logo img {
  width: 100%;
  height: auto;
  display: block;
  filter: contrast(2) brightness(1.5);
  opacity: 1;
}

/* Unterseiten: Logo bleibt mittig wie auf Hauptseite, Editorial-Link ist sichtbar */
.subpage-editorial {
  pointer-events: auto;
  opacity: 1;
}

.hero-editorial-link {
  position: fixed;
  top: 43px;
  right: clamp(1rem, 3vw, 2rem);
  transform: translateY(-50%);
  font-family: "Oficia Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  color: #fff;
  text-decoration: underline;
  text-decoration-color: #fff;
  text-underline-offset: 0.35em;
  transition: color 0.2s ease;
  z-index: 9999;
  cursor: pointer;
  mix-blend-mode: difference;
}

.hero-editorial-link:hover {
  color: #ddd;
}

.side-link {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  cursor: pointer;
  mix-blend-mode: difference;
  /* SVG sizing */
  width: 140px;
  height: 13px;
  color: #fff;
}

.side-link--right {
  right: clamp(1rem, 3vw, 2rem);
}

.side-link--left {
  left: clamp(1rem, 3vw, 2rem);
  transform: translateY(-50%) rotate(180deg);
}

.side-link svg {
  width: 100%;
  height: 100%;
  display: block;
}

.side-link .arrow-part {
  fill: currentColor;
  transition: fill 0.2s ease;
}

.side-link:hover .arrow-part {
  fill: #ddd;
}

/* Animation Defs */
.side-link .arrow-circle {
  transform-origin: center;
  transform-box: fill-box;
}

.side-link .arrow-line {
  transform-origin: left center;
  transform-box: fill-box;
}

.side-link:hover .arrow-circle {
  animation: arrow-circle-anim 0.4s ease-in-out forwards;
}

.side-link:hover .arrow-line {
  animation: arrow-line-anim 0.4s ease-in-out forwards;
}

@keyframes arrow-circle-anim {
  0% { transform: translateX(0); }
  60% { transform: translateX(-128px); } /* Retract slower */
  100% { transform: translateX(0); } /* Return faster */
}

@keyframes arrow-line-anim {
  0% { transform: scaleX(1); }
  60% { transform: scaleX(0); } /* Retract slower */
  100% { transform: scaleX(1); } /* Return faster */
}

.layout-toggle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(3, 3, 3, 0.6);
  color: #fff;
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  font-family: "Oficia Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  cursor: pointer;
  position: fixed;
  left: clamp(1rem, 3vw, 2rem);
  top: 43px;
  transform: translateY(-50%);
  z-index: 9999;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.3s ease;
  mix-blend-mode: difference;
}

.layout-toggle .toggle-indicator {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 3px rgba(3, 3, 3, 0.9);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.layout-toggle.is-active {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.layout-toggle.is-active .toggle-indicator {
  background: #fff;
  border-color: #fff;
}

.hero-controls {
  position: fixed;
  top: 100px;
  left: clamp(1rem, 3vw, 2rem);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* CTA Button */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  bottom: 20px;
  height: 34px;
  padding: 0 20px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  font-family: "Oficia Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 10pt;
  text-decoration: none;
  width: fit-content;
  background: rgba(255, 255, 255, 0.55);
  position: fixed;
  transform: none;
  z-index: 10;
  left: 50%;
  transform: translateX(-50%);
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.cta:hover {
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.95);
}

.cta:focus-visible {
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.95);
  outline: 2px solid rgba(0, 0, 0, 0.95);
  outline-offset: 3px;
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
  
  .hero-editorial-link {
    font-size: 14px;
  }
  
  .side-link {
    font-size: 30px; /* Kept for fallback, though generic styles override */
    top: auto;
    bottom: 2rem;
    transform: none; /* Reset vertical centering */
  }

  .side-link--right {
    right: 20px;
    left: auto;
  }

  .side-link--left {
    left: 20px;
    right: auto;
    transform: rotate(180deg);
  }

  .hero-controls {
    top: 0.75rem;
    left: 0.75rem;
  }
}

/* Mobile adjustments for logo */
@media (max-width: 630px) {
  .fixed-logo {
    width: 110px;
    top: 20px;
    left: 36%;
  }
  
  /* Specific adjustment for subpages, editorial, impressum, datenschutz */
  body.subpage .fixed-logo {
    left: 28%;
  }
  
  /* Fix for side links overlapping on mobile */
  .side-link {
    width: 80px; /* Reduced from 140px */
  }
  
  .side-link--right {
    right: 6px; /* Reduced from clamp(1rem, 3vw, 2rem) */
  }
  
  .side-link--left {
    left: 6px; /* Reduced from clamp(1rem, 3vw, 2rem) */
  }
  
  /* Adjust animation for shorter lines */
  @keyframes arrow-circle-anim {
    0% { transform: translateX(0); }
    60% { transform: translateX(-88px); } /* Adjusted for shorter line */
    100% { transform: translateX(0); }
  }
}

/* Extra small screens - prevent header overlap */
@media (max-width: 600px) {
  /* Specific adjustment for subpages on very small screens */
  body.subpage .fixed-logo {
    left: 50%;
  }

  .hero-editorial-link {
    font-size: 12px;
    letter-spacing: 0.1em;
    top: 40px; /* Align with logo visual center */
    right: 15px;
  }

  .layout-toggle {
    font-size: 11px;
    padding: 0.4rem 0.8rem 0.4rem 2rem;
    top: 40px; /* Align with logo visual center */
    left: 15px;
  }
  
  .layout-toggle .toggle-indicator {
    width: 0.8rem;
    height: 0.8rem;
    left: 0.6rem;
  }
}
