/* ═══════════════════════════════════════════════════════════════
   Camper Guide - VW T5 Interactive Webapp
   All styles in one file for simplicity
   ═══════════════════════════════════════════════════════════════ */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

ol, ul {
  list-style: none;
}

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Brand */
  --color-orange: #E8731A;
  --color-orange-light: #F5A623;
  --color-orange-dark: #C95F10;
  --color-white: #F5F5F0;
  --color-bg: #FAFAF8;
  --color-text: #1A1A1A;
  --color-text-muted: #666;
  --color-text-light: #999;
  --color-border: #E5E5E0;
  --color-surface: #FFFFFF;
  --color-warning-bg: #FFF3E0;
  --color-warning-border: #FFB74D;
  --color-tip-bg: #E3F2FD;
  --color-tip-border: #64B5F6;
  --color-danger-bg: #FFEBEE;
  --color-danger-border: #EF5350;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Layout */
  --header-height: 56px;
  --nav-height: 72px;
  --modal-radius: 20px;
  --hotspot-size: 44px;

  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* Safe areas for notched phones */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Layout ─────────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(var(--space-sm) + var(--safe-top));
  height: calc(var(--header-height) + var(--safe-top));
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header__brand {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.header__title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.header__subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ── Language Toggle ────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.lang-toggle__btn {
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 6px;
  color: var(--color-text-muted);
  transition: all var(--duration-fast) var(--ease-out);
}

.lang-toggle__btn--active {
  background: var(--color-orange);
  color: white;
  box-shadow: 0 1px 3px rgba(232, 115, 26, 0.3);
}

/* ── Main Content ───────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  overflow: hidden;
  background: var(--color-bg);
}

.view-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 8 / 5;
  max-height: calc(100dvh - var(--header-height) - var(--nav-height) - var(--safe-top) - var(--safe-bottom) - var(--space-xl));
}

.svg-wrapper {
  width: 100%;
  height: 100%;
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.svg-wrapper svg {
  width: 100%;
  height: 100%;
}

/* View transition states */
.view-container.transitioning .svg-wrapper {
  opacity: 0;
  transform: scale(0.95);
}

.view-container.transitioning .hotspot-layer {
  opacity: 0;
}

/* ── Hotspot Layer ──────────────────────────────────────────── */
.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.hotspot {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  transform: translate(-50%, -50%);
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.hotspot:focus-visible .hotspot__icon {
  outline: 3px solid var(--color-orange);
  outline-offset: 2px;
}

.hotspot__pulse {
  position: absolute;
  width: var(--hotspot-size);
  height: var(--hotspot-size);
  border-radius: 50%;
  background: var(--color-orange);
  opacity: 0;
  animation: pulse 2.5s var(--ease-out) infinite;
}

.hotspot__icon {
  position: relative;
  width: var(--hotspot-size);
  height: var(--hotspot-size);
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-out);
}

.hotspot__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-orange);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hotspot:hover .hotspot__icon,
.hotspot:active .hotspot__icon {
  transform: scale(1.1);
  background: var(--color-orange);
}

.hotspot:hover .hotspot__icon svg,
.hotspot:active .hotspot__icon svg {
  stroke: white;
}

.hotspot__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: all var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.hotspot:hover .hotspot__label,
.hotspot:focus .hotspot__label {
  opacity: 1;
  transform: translateY(0);
}

/* Always show labels on touch devices */
@media (hover: none) {
  .hotspot__label {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Bottom Navigation ──────────────────────────────────────── */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-xs);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 32px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--color-orange);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.nav-tab--active {
  color: var(--color-orange);
}

.nav-tab--active::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-tab__icon {
  width: 24px;
  height: 24px;
}

.nav-tab__icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-tab__label {
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Modal Overlay ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility 0s linear var(--duration-normal);
}

.modal-overlay--open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility 0s linear 0s;
}

.modal {
  width: 100%;
  max-height: 90dvh;
  background: var(--color-surface);
  border-radius: var(--modal-radius) var(--modal-radius) 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-spring);
  overflow: hidden;
}

.modal-overlay--open .modal {
  transform: translateY(0);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal__header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
}

.modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-right: var(--space-md);
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease-out);
}

.modal__close:hover {
  background: var(--color-border);
}

.modal__body {
  padding: var(--space-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal__description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}

/* Steps */
.modal__steps {
  margin-bottom: var(--space-lg);
}

.modal__steps h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.modal__steps ol {
  list-style: none;
  counter-reset: step;
}

.modal__steps li {
  counter-increment: step;
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.modal__steps li:last-child {
  border-bottom: none;
}

.modal__steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-orange);
  color: white;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Warnings & Tips */
.modal__callout {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: 12px;
  margin-bottom: var(--space-md);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.modal__callout--warning {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning-border);
}

.modal__callout--tip {
  background: var(--color-tip-bg);
  border-left: 3px solid var(--color-tip-border);
}

.modal__callout--danger {
  background: var(--color-danger-bg);
  border-left: 3px solid var(--color-danger-border);
}

.modal__callout-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.4;
}

/* Media */
.modal__media {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal__media img {
  border-radius: 12px;
  background: var(--color-bg);
}

.modal__media video {
  border-radius: 12px;
  background: #000;
  width: 100%;
}

.modal__media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--color-bg);
  border-radius: 12px;
  border: 2px dashed var(--color-border);
  color: var(--color-text-light);
  font-size: 0.875rem;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0);
  }
}

.hotspot {
  animation: fadeInUp var(--duration-normal) var(--ease-out) backwards;
}

.hotspot:nth-child(1) { animation-delay: 0.1s; }
.hotspot:nth-child(2) { animation-delay: 0.2s; }
.hotspot:nth-child(3) { animation-delay: 0.3s; }
.hotspot:nth-child(4) { animation-delay: 0.4s; }
.hotspot:nth-child(5) { animation-delay: 0.5s; }
.hotspot:nth-child(6) { animation-delay: 0.6s; }

/* Body scroll lock when modal is open */
body.modal-open {
  overflow: hidden;
}

/* ── Desktop Responsive ─────────────────────────────────────── */
@media (min-width: 640px) {
  .header {
    padding: var(--space-md) var(--space-lg);
  }

  .header__title {
    font-size: 1.25rem;
  }

  .main {
    padding: var(--space-lg);
  }

  .hotspot__label {
    font-size: 0.75rem;
  }

  .nav-tab__label {
    font-size: 0.6875rem;
  }
}

@media (min-width: 1024px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
  }

  .modal {
    max-width: 640px;
    max-height: 80dvh;
    border-radius: var(--modal-radius);
    transform: translateY(30px);
    opacity: 0;
  }

  .modal-overlay--open .modal {
    transform: translateY(0);
    opacity: 1;
  }

  .modal__header::before {
    display: none;
  }

  .view-container {
    max-width: 1000px;
  }
}
