/* Styled after axaat-concept.de: Inter, dark green primary, mint accent, zinc neutrals,
   pill buttons, white cards with 20px radius. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  --primary-50: #e6f4ea;
  --primary-100: #c8e6d0;
  --primary-500: #006414;
  --primary-600: #005010;
  --accent-cyan: #06d6a0;
  --neutral-50: #fafafa;
  --neutral-100: #f4f4f5;
  --neutral-200: #e4e4e7;
  --neutral-300: #d4d4d8;
  --neutral-500: #71717a;
  --neutral-700: #3f3f46;
  --neutral-900: #18181b;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-primary: 0 4px 12px 0 rgb(0 100 20 / 0.25);
  --gradient-primary: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  --gradient-accent: linear-gradient(90deg, var(--primary-500), var(--accent-cyan));
  --gradient-text: linear-gradient(135deg, var(--primary-600), var(--accent-cyan));
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --wood-light: #e9c9a0;
  --wood-dark: #b8875a;
  /* On wide screens header and tools stay inside the website's content width (1280px,
     like .container on axaat-concept.de) instead of sticking to the window edges. */
  --edge: max(0px, (100vw - 1280px) / 2);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--neutral-50);
  color: var(--neutral-700);
  font: 400 16px/1.5 "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#viewer, #viewer canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

/* --- header (top left) --- */
.top {
  position: fixed;
  top: 0;
  left: var(--edge);
  right: calc(var(--edge) + 128px);
  padding: 20px 24px 0;
  pointer-events: none;
}
/* back to the website (the header itself ignores the pointer so the model stays draggable) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 10px -4px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  color: var(--neutral-500);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  pointer-events: auto;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.back-link svg { width: 18px; height: 18px; }
.back-link:hover { color: var(--primary-500); background: var(--primary-50); }
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-500);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.top h1 {
  margin: 0;
  color: var(--neutral-900);
  font-size: clamp(22px, 3.4vw, 36px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* input hints: one line per gesture, mouse or touch variant */
.hints {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--neutral-700);
  font-size: 15px;
  font-weight: 500;
}
.hints li {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.hints li + li { margin-top: 8px; }
.hints svg { width: 28px; height: 28px; stroke-width: 1.5; color: var(--neutral-700); }
.hints svg .fill { fill: var(--primary-500); stroke: none; }
.hint-touch { display: none !important; }
@media (pointer: coarse) {
  .hint-mouse { display: none !important; }
  .hint-touch { display: flex !important; }
}

/* Embedded in a page: zooming needs Ctrl/⌘ + wheel (plain wheel scrolls the page) */
.kbd-embedded { display: none; }
.embedded .kbd-embedded {
  display: inline-block;
  margin-right: -4px;
  padding: 1px 6px;
  border: 1px solid var(--neutral-300);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  color: var(--neutral-700);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.wheel-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: rgb(24 24 27 / 0.82);
  color: #fff;
  font-size: 14.4px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms var(--ease);
  z-index: 6;
}
.wheel-hint.show { opacity: 1; }

/* --- tools (top right) --- */
.tools {
  position: fixed;
  top: 16px;
  right: calc(var(--edge) + 16px);
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.9);
  color: var(--neutral-700);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] {
  background: var(--primary-50);
  border-color: var(--primary-100);
  color: var(--primary-500);
}

.settings { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  padding: 14px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 5;
}
.popover-label {
  margin: 0 0 8px;
  color: var(--neutral-500);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.segmented {
  display: flex;
  padding: 3px;
  border-radius: var(--radius-full);
  background: var(--neutral-100);
}
.segmented button {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--neutral-700);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.segmented button:hover { color: var(--primary-500); }
.segmented button[aria-checked="true"] {
  background: #fff;
  color: var(--primary-500);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.pill-btn {
  position: fixed;
  left: 50%;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 70px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 14px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.9);
  color: var(--neutral-700);
  font-size: 14.4px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  white-space: nowrap;
  animation: pop-in 200ms var(--ease);
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.pill-btn:hover { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-500); }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* --- step bar (bottom) --- */
.bar {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-lg);
}

.round-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--neutral-100);
  color: var(--neutral-700);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.round-btn:hover { background: var(--primary-50); color: var(--primary-500); }
.round-btn:active { transform: translateY(1px); }
.round-btn .icon-play { fill: currentColor; stroke-width: 1.5; margin-left: 2px; }
#btn-play .icon-pause { display: none; }
#btn-play.is-playing .icon-play { display: none; }
#btn-play.is-playing .icon-pause { display: block; }

/* Zurück + Weiter side by side, skip icons (|◀ ▶|) with text */
.step-nav {
  flex: none;
  display: flex;
  gap: 6px;
}
.step-nav svg { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.8; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px 0 16px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-full);
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn-secondary:hover { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-600); }
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary:disabled { opacity: 0.45; cursor: default; background: var(--neutral-100); border-color: var(--neutral-200); color: var(--neutral-700); transform: none; }

.btn-primary {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 22px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
  cursor: pointer;
  transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
.btn-primary:hover { box-shadow: 0 6px 16px 0 rgb(0 100 20 / 0.32); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; transform: none; cursor: default; }

/* one segment per step: grey = to do, gradient = done, filling while it plays.
   Drag across the bar to scrub; a click plays that step. */
.steps {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  padding: 0 6px;
  cursor: pointer;
  touch-action: none;       /* finger drags scrub instead of scrolling */
  user-select: none;
}
.steps.scrubbing, .steps.scrubbing .step { cursor: grabbing; }

/* small dot at the current position; only on hover / while dragging, so the bar stays calm */
.scrub-handle {
  --x: 0px;
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--primary-500);
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
  opacity: 0;
  transform: translateX(var(--x));
  transition: opacity 150ms var(--ease);
}
.steps:hover .scrub-handle, .steps.scrubbing .scrub-handle { opacity: 1; }
.step {
  --fill: 0%;
  position: relative;
  flex: 1;
  min-width: 6px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.step::before, .step::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: var(--radius-full);
  transition: height 150ms var(--ease), margin-top 150ms var(--ease);
}
.step::before { right: 0; background: var(--neutral-200); }
.step::after { width: var(--fill); background: var(--gradient-accent); }
.step:hover::before { background: var(--neutral-300); }
/* the whole bar gets thicker on hover / while dragging */
.steps:hover .step::before, .steps:hover .step::after,
.steps.scrubbing .step::before, .steps.scrubbing .step::after,
.step.current::before, .step.current::after { height: 10px; margin-top: -5px; }
.step.current::before { background: var(--primary-100); }
/* keyboard focus: a ring around the segment bar instead of the button box */
.step:focus-visible { outline: none; }
.step:focus-visible::before { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent-cyan); }

/* --- loading screen: two wooden halves closing into a ball --- */
#loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--neutral-50);
  transition: opacity 500ms var(--ease);
  z-index: 10;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader.error .ball { animation: none; opacity: 0.4; }
#loader.error #loader-text { color: var(--neutral-700); }

.ball {
  position: relative;
  width: 72px;
  height: 72px;
}
.half {
  position: absolute;
  top: 0;
  width: 36px;
  height: 72px;
  background:
    repeating-linear-gradient(100deg, rgba(120, 72, 30, 0.18) 0 3px, transparent 3px 9px),
    linear-gradient(135deg, var(--wood-light), var(--wood-dark));
  box-shadow: inset 0 0 0 1px rgba(90, 55, 25, 0.25);
}
.half.left {
  left: 0;
  border-radius: 36px 0 0 36px;
  animation: close-left 1.6s ease-in-out infinite;
}
.half.right {
  right: 0;
  border-radius: 0 36px 36px 0;
  animation: close-right 1.6s ease-in-out infinite;
}
@keyframes close-left {
  0%, 100% { transform: translateX(-14px) rotate(-8deg); }
  45%, 60% { transform: translateX(0) rotate(0); }
}
@keyframes close-right {
  0%, 100% { transform: translateX(14px) rotate(8deg); }
  45%, 60% { transform: translateX(0) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .half.left, .half.right { animation: none; }
}

#loader-text {
  margin: 0;
  color: var(--neutral-500);
  font-size: 14.4px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.progress {
  width: min(240px, 60vw);
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--neutral-200);
  overflow: hidden;
}
#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-accent);
  transition: width 0.2s ease;
}

/* --- small viewports (phones, small embeds) --- */
@media (max-width: 600px) {
  .top { right: 104px; padding: 14px 16px 0; }
  .hints { font-size: 13px; margin-top: 8px; }
  .tools { top: 12px; right: 12px; gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .pill-btn { height: 40px; padding: 0 14px 0 12px; font-size: 13px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 106px); }
  /* two rows: step segments on top, buttons below */
  .bar {
    width: calc(100% - 16px);
    bottom: max(10px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
    gap: 2px 6px;
    padding: 4px 8px 8px;
    border-radius: var(--radius-lg);
  }
  .steps { order: -1; flex: 1 1 100%; gap: 3px; padding: 0 4px; }
  .step { min-width: 0; height: 30px; }
  .round-btn { width: 40px; height: 40px; }
  .step-nav { margin-left: auto; }
  .btn-secondary { height: 40px; padding: 0 14px 0 12px; font-size: 15px; }
  .btn-primary { height: 40px; padding: 0 12px 0 16px; font-size: 15px; }
}
