/* ==========================================================
   AVARA — Walkthrough tour system
   Shared module. Pages opt in by:
     1. Including this stylesheet
     2. Including /js/tour.js
     3. Adding data-tour-step="1", data-tour-title="…", data-tour-body="…"
        attributes to elements you want to highlight
     4. Adding <body class="has-tour"> to surface the toggle button
   ========================================================== */

/* ----- Floating toggle button (bottom-right) ----- */

.tour-toggle {
  position: fixed;
  bottom: clamp(16px, 3vw, 32px);
  right: clamp(16px, 3vw, 32px);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: rgba(15, 15, 16, 0.92);
  color: #F2EAD3;
  border: 1px solid rgba(242, 234, 211, 0.22);
  border-radius: 100px;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.6);
  transition: all 220ms cubic-bezier(.22,1,.36,1);
}
.tour-toggle:hover {
  border-color: #F2EAD3;
  transform: translateY(-2px);
  box-shadow: 0 18px 48px -10px rgba(0, 0, 0, 0.7);
}
.tour-toggle-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #F2EAD3;
  box-shadow: 0 0 0 0 rgba(242, 234, 211, 0.7);
  animation: tourPulse 1.8s cubic-bezier(.22,1,.36,1) infinite;
}
@keyframes tourPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 234, 211, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(242, 234, 211, 0); }
}
.has-tour-active .tour-toggle { display: none; }
@media (prefers-reduced-motion: reduce) { .tour-toggle-dot { animation: none; } }

/* ----- Tour mode: page state when active ----- */

.has-tour-active {
  /* Subtle dim of the page when tour is active so markers stand out */
}
.has-tour-active::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.30);
  z-index: 70;
  pointer-events: none;
  animation: tourDimIn 360ms ease forwards;
}
@keyframes tourDimIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ----- Markers (one per data-tour-step) ----- */

.tour-marker {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 15, 16, 0.95);
  border: 1px solid rgba(242, 234, 211, 0.35);
  color: #F2EAD3;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 75;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: transform 200ms cubic-bezier(.22,1,.36,1), background 200ms ease, border-color 200ms ease;
  opacity: 0;
  transform: scale(0.6);
  animation: tourMarkerIn 380ms cubic-bezier(.22,1,.36,1) forwards;
}
.tour-marker:hover {
  background: #F2EAD3;
  color: #0B0B0B;
  border-color: #F2EAD3;
  transform: scale(1.1);
}
.tour-marker.is-current {
  background: #F2EAD3;
  color: #0B0B0B;
  border-color: #F2EAD3;
}
.tour-marker.is-current::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(242, 234, 211, 0.5);
  animation: tourMarkerHalo 1.6s cubic-bezier(.22,1,.36,1) infinite;
}
.tour-marker.is-done {
  background: rgba(242, 234, 211, 0.15);
  color: rgba(242, 234, 211, 0.6);
}
@keyframes tourMarkerIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes tourMarkerHalo {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-marker { animation: none; opacity: 1; transform: scale(1); }
  .tour-marker.is-current::before { animation: none; opacity: 0.5; }
}

/* ----- Tour panel (bottom sheet) ----- */

.tour-panel {
  position: fixed;
  bottom: clamp(16px, 3vw, 32px);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  z-index: 85;
  width: min(560px, calc(100% - 32px));
  background: rgba(15, 15, 16, 0.96);
  border: 1px solid rgba(242, 234, 211, 0.22);
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 22px 24px;
  color: #F2EAD3;
  transition: transform 380ms cubic-bezier(.22,1,.36,1);
}
.has-tour-active .tour-panel {
  transform: translateX(-50%) translateY(0);
}

.tour-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.tour-panel-step {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242, 234, 211, 0.6);
  font-weight: 600;
}
.tour-panel-exit {
  background: transparent;
  border: none;
  color: rgba(242, 234, 211, 0.6);
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: color 180ms ease, background 180ms ease;
}
.tour-panel-exit:hover { color: #F2EAD3; background: rgba(242, 234, 211, 0.06); }

.tour-panel-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #F2EAD3;
  margin-bottom: 8px;
  line-height: 1.25;
}
.tour-panel-body {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(242, 234, 211, 0.78);
  margin-bottom: 18px;
}

.tour-panel-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(242, 234, 211, 0.12);
}
.tour-panel-pages {
  display: flex;
  gap: 6px;
}
.tour-panel-pages span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(242, 234, 211, 0.2);
  transition: background 180ms ease, transform 180ms ease;
}
.tour-panel-pages span.is-current { background: #F2EAD3; transform: scale(1.3); }
.tour-panel-pages span.is-done { background: rgba(242, 234, 211, 0.5); }

.tour-panel-btns { display: flex; gap: 8px; }
.tour-panel-btn {
  background: transparent;
  border: 1px solid rgba(242, 234, 211, 0.22);
  color: #F2EAD3;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}
.tour-panel-btn:hover { background: rgba(242, 234, 211, 0.06); border-color: rgba(242, 234, 211, 0.5); }
.tour-panel-btn-primary {
  background: #F2EAD3;
  color: #0B0B0B;
  border-color: #F2EAD3;
}
.tour-panel-btn-primary:hover { background: #fff; border-color: #fff; }
.tour-panel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
  .tour-panel { padding: 18px 18px; }
  .tour-panel-head { margin-bottom: 12px; }
  .tour-panel-title { font-size: 16px; }
  .tour-panel-body { font-size: 13px; }
}
