/* GRUNDEINSTELLUNGEN */

:root {
  --background: #e5e5e5;
  --blue: #40c4ff;

  --pulse-color: 64, 196, 255;

  --text-small: 16px;
  --text-normal: 20px;
  --text-large: clamp(44px, 4.4vw, 64px);

  --pulse-duration: 2.4s;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;

  background: var(--background);
  color: var(--blue);

  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--text-normal);
  font-weight: 400;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* BUTTONS */

.button {
  display: inline-block;
  margin: 0;
  padding: 0 5px 2px;

  border: 1px solid currentColor;
  border-radius: 7px;

  background: transparent;
  color: var(--blue);

  font-size: var(--text-normal);
  font-weight: 400;
  line-height: 1.15;

  text-align: center;
  text-decoration: none;

  transition: background 150ms ease;
}

.button:hover {
  background: rgb(64 196 255 / 12%);
}

/* NAVIGATION */

.navigation {
  position: fixed;
  top: 24px;
  left: 30px;
  z-index: 10;
}

.navigation nav {
  display: flex;
  gap: 5px;
}

/*
  Nur auf Home:
  Schrift und Rahmen übernehmen die aktuelle Pulsfarbe.
*/

body[data-page="home"] .navigation .button {
  color: rgb(var(--pulse-color));
}

body[data-page="home"] .navigation .button:hover {
  background: rgba(var(--pulse-color), .12);
}

/* Im Shop bleiben Navigation und Rahmen blau. */

body[data-page="shop"] .navigation .button {
  color: var(--blue);
}

/* SEITEN */

.page {
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
}

/* HOME */

.home {
  display: grid;
  place-items: center;
  isolation: isolate;
}

.home-title {
  position: relative;
  z-index: 2;

  margin: 0;
  max-width: 100%;
  padding: 24px;

  color: var(--background);
  font-size: var(--text-large);
  font-weight: 400;
  text-align: center;
  overflow-wrap: anywhere;

  pointer-events: none;
}

/* PULSIERENDER REGENBOGEN-VERLAUF */

.pulse-layer {
  position: absolute;
  inset: 0;
  z-index: 0;

  pointer-events: none;

  animation:
    heartbeat
    var(--pulse-duration)
    ease-in-out
    infinite;

  will-change: opacity;
}

.main-glow {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 110vmax;
  height: 100vmax;
  border-radius: 50%;

  background: radial-gradient(
    ellipse,
    rgba(var(--pulse-color), 1) 0%,
    rgba(var(--pulse-color), .65) 23%,
    rgba(var(--pulse-color), .25) 43%,
    rgba(var(--pulse-color), 0) 65%
  );

  animation:
    expand
    var(--pulse-duration)
    ease-in-out
    infinite;

  will-change: transform;
}

/* BLAUER MAUS-VERLAUF */

.cursor-glow {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;

  width: 600px;
  height: 600px;
  border-radius: 50%;
  opacity: 0;

  background: radial-gradient(
    circle,
    rgb(64 196 255 / 60%) 0%,
    rgb(64 196 255 / 24%) 30%,
    transparent 68%
  );

  pointer-events: none;
  transition: opacity 500ms ease;
  will-change: transform;
}

/* HERZSCHLAG */

@keyframes heartbeat {
  0%, 92%, 100% {
    opacity: 0;
  }

  19% {
    opacity: 1;
  }

  32% {
    opacity: .58;
  }

  46% {
    opacity: .95;
  }

  69% {
    opacity: .35;
  }
}

@keyframes expand {
  0%, 92%, 100% {
    transform: translate(-50%, -50%) scale(.65);
  }

  19% {
    transform: translate(-50%, -50%) scale(1);
  }

  32% {
    transform: translate(-50%, -50%) scale(.87);
  }

  46% {
    transform: translate(-50%, -50%) scale(.98);
  }

  69% {
    transform: translate(-50%, -50%) scale(.79);
  }
}

/* PAUSENTASTE */

.motion-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;

  min-width: 32px;
  min-height: 32px;
  padding: 6px;

  border: 0;
  background: transparent;

  color: rgb(var(--pulse-color));
  font-size: var(--text-small);
}

/* PAUSIERTE ANIMATION */

.animations-paused .pulse-layer,
.animations-paused .main-glow {
  animation: none;
}

.animations-paused .pulse-layer {
  opacity: .85;
}

.animations-paused .main-glow {
  transform: translate(-50%, -50%) scale(.95);
}

.animations-paused .cursor-glow {
  display: none;
}

/* SHOP */

.shop h1 {
  position: absolute;
  top: 53px;
  left: 33px;
  z-index: 1;

  margin: 0;

  font-size: var(--text-large);
  font-weight: 400;
  line-height: 1.1;
}

.product-stage {
  position: absolute;
  inset: 0;

  display: grid;
  place-items: center;
}

.product-glow {
  position: absolute;

  width: min(920px, 115vw);
  height: min(680px, 85svh);

  background: radial-gradient(
    ellipse,
    rgb(64 196 255 / 85%) 0%,
    rgb(64 196 255 / 40%) 32%,
    transparent 69%
  );

  pointer-events: none;
}

/* PRODUKTBILD OHNE AUSSCHNITTMASKE */

.stone {
  position: relative;
  display: block;

  width: clamp(250px, 25vw, 370px);
  max-width: 85vw;
  height: auto;

  object-fit: contain;
}

.product-buttons {
  position: absolute;
  bottom: 24px;
  left: 50%;

  display: grid;
  gap: 4px;
  width: 158px;

  transform: translateX(-50%);
}

.product-label {
  cursor: default;
}

/* POP-UP-FENSTER */

dialog {
  position: fixed;
  inset: 24px 32px auto auto;

  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100svh - 48px);

  margin: 0;
  padding: 6px 9px;
  overflow: auto;

  border: 1px solid var(--blue);
  border-radius: 7px;

  background: var(--background);
  color: var(--blue);

  font-size: var(--text-small);
}

dialog::backdrop {
  background: transparent;
}

.window-header {
  position: relative;

  padding: 0 25px 3px;
  border-bottom: 1px solid var(--blue);

  text-align: center;
}

.window-header h2 {
  margin: 0;
  font-size: var(--text-normal);
  font-weight: 400;
}

.close {
  position: absolute;
  top: -3px;
  right: 0;

  padding: 0 3px;
  border: 0;
  background: transparent;

  font-size: 24px;
  line-height: 1;
}

dialog p {
  margin: 7px 0;
  line-height: 1.2;
}

.specifications {
  margin: 0;
}

.specifications div {
  padding: 4px 0;
  border-top: 1px solid var(--blue);
}

.specifications dd {
  margin: 0;
}

/* TAGEBUCH-VORSCHAU */

.diary-window {
  inset: 50% auto auto 50%;

  width: min(1050px, calc(100vw - 40px));
  padding: 9px;

  transform: translate(-50%, -50%);
}

.diary-window img {
  display: block;

  width: 100%;
  max-height: 65svh;
  margin-top: 10px;

  object-fit: contain;
}

.diary-caption {
  text-align: center;
}

.checkout {
  margin: 7px 0;
}

/* SMARTPHONE */

@media (max-width: 600px) {
  .navigation {
    top: 18px;
    left: 18px;
  }

  .shop h1 {
    top: 55px;
    left: 18px;
  }

  .stone {
    width: 280px;
    max-width: 85vw;
  }

  .product-buttons {
    bottom: 24px;
  }

  dialog:not(.diary-window) {
    top: 112px;
    right: 16px;
    max-height: calc(100svh - 128px);
  }
}

@media (pointer: coarse) {
  .cursor-glow {
    display: none;
  }
}

/* MEHR PLATZ BEI FLACHEN FENSTERN */

@media (max-height: 550px) {
  .shop {
    min-height: 550px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .cursor-glow {
    transition: none;
  }
}
.product-stage { top: 145px; bottom: 165px; touch-action: pan-y; }
.stone { max-height: 100%; object-fit: contain; }
.gallery-arrow { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--blue); font-size: 36px; width: 44px; height: 48px; }
.previous { left: max(18px, calc(50% - 270px)); }
.next { right: max(18px, calc(50% - 270px)); }
.product-image-wrap { position: relative; z-index: 1; height: 100%; max-width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; }
.product-image-wrap .stone { max-height: calc(100% - 32px); flex-shrink: 1; min-height: 0; }
.gallery-counter { position: relative; margin: 0; font-size: var(--text-small); flex-shrink: 0; }
#image-placeholder { position: relative; font-size: var(--text-small); }
@media (max-width: 600px) { .stone { max-width: calc(100vw - 120px); } }

/* GALERIE-STEUERUNG DIREKT OBERHALB DES MEMORY-STONE-BUTTONS */
.gallery-controls {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  width: min(800px, calc(100vw - 36px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateX(-50%);
}
.gallery-controls .gallery-arrow {
  position: static;
  transform: none;
  flex: 0 0 44px;
}
.gallery-controls .gallery-counter {
  position: static;
  margin: 0;
  text-align: center;
}

/* GALERIE-FEINSCHLIFF: PFEILE NEBEN DER BILDNUMMER */
.gallery-controls {
  width: 240px;
  max-width: calc(100vw - 36px);
}
.gallery-controls .gallery-arrow,
.gallery-controls .gallery-counter {
  font-size: var(--text-normal);
  font-weight: 400;
}

/* NUR PRODUKTBILDER VERGRÖSSERN – Restliches Design unverändert */
.stone {
  width: clamp(340px, 36vw, 540px);
  max-width: 92vw;
}
@media (max-width: 600px) {
  .stone {
    width: 380px;
    max-width: calc(100vw - 40px);
  }
}

/* FIX: Galerienavigation liegt klickbar über dem vergrösserten Produktbild. */
.product-buttons {
  z-index: 4;
}
.gallery-controls {
  z-index: 5;
}
