/* ==========================================================================
   Dave Website Stylesheet - Clean White, Minimalist, Single Viewport (No Scroll)
   ========================================================================== */

:root {
  --bg-page: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-stage: #ffffff;
  --border-light: #e5e7eb;
  --border-subtle: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent-black: #000000;
  --accent-blue: #0071e3;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* Strict requirement: no scrolling */
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Crisp Pixel Art Rendering */
.pixel-img {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* ==========================================================================
   Full Viewport Container (Centered & Clean)
   ========================================================================== */

.app-viewport {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.5rem, 1.4vh, 0.9rem) clamp(1rem, 3vw, 2rem);
  box-sizing: border-box;
  background: var(--bg-page);
}

/* ==========================================================================
   Minimalist Header
   ========================================================================== */

.app-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding-bottom: 0.5rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  width: 28px;
  height: 28px;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #d1d5db;
}

/* ==========================================================================
   Center Stage Demo
   ========================================================================== */

.demo-main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0;
}

.stage-wrapper {
  width: 100%;
  height: 100%;
  max-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.stage-header {
  text-align: center;
  margin-bottom: clamp(0.6rem, 1.4vh, 1rem);
  flex-shrink: 0;
}

.stage-title {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.stage-subtitle {
  font-size: clamp(0.78rem, 1vw, 0.86rem);
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.45;
}

.stage-card {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-stage);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.stage-container {
  flex: 1;
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
  outline: none;
}

/* Minimalist Speech Bubble */
.speech-bubble {
  position: absolute;
  top: 14%;
  max-width: 85%;
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: clamp(0.8rem, 1.1vw, 0.88rem);
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  z-index: 10;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateY(0);
}

.speech-bubble.pop {
  transform: translateY(-3px) scale(1.02);
}

.bubble-tail {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--border-light);
}

/* Dave Sprite Character */
.dave-character {
  position: absolute;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 5;
  transition: transform 0.25s ease-out, left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.35s ease-out;
  touch-action: none;
}

.dave-character:active {
  cursor: grabbing;
}

.dave-character img {
  width: 128px;
  height: 128px;
  user-select: none;
  -webkit-user-drag: none;
}

.character-shadow {
  position: absolute;
  bottom: 8px;
  width: 64px;
  height: 10px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  transition: all 0.2s ease;
}

/* Peeking state: tightly tucked into the left border of the simulation frame */
.dave-character.is-peeking {
  left: -12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  cursor: pointer;
}

/* Hover expansion: Dave peeks further out from the edge */
.dave-character.is-peeking:hover {
  transform: translate(28px, -50%) !important;
}

.dave-character.is-peeking .character-shadow {
  left: 12px;
  bottom: 22px;
  width: 36px;
  height: 8px;
  opacity: 0.2;
}

/* Speech bubble layout in peeking mode */
.peeking-mode .speech-bubble {
  left: 100px !important;
  top: 20% !important;
  transform: none !important;
}

.peeking-mode .bubble-tail {
  left: 20px !important;
  transform: none !important;
}

.dave-character.jumping {
  animation: pet-jump 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes pet-jump {
  0% { transform: translateY(0); }
  40% { transform: translateY(-24px); }
  100% { transform: translateY(0); }
}

.dave-character.is-dragging {
  cursor: grabbing;
  transition: none !important;
}

.dave-character.is-dragging .character-shadow {
  transform: scale(0.6);
  opacity: 0.3;
}

/* Minimalist State Switcher Toolbar */
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.stage-toolbar::-webkit-scrollbar {
  display: none;
}

.state-btn {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.state-btn:hover {
  background: #f3f4f6;
  color: var(--text-primary);
}

.state-btn.active {
  background: var(--accent-black);
  color: #ffffff;
  border-color: var(--accent-black);
}

/* ==========================================================================
   Download Section (Minimalist CTA)
   ========================================================================== */

.download-section {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  margin-top: clamp(0.75rem, 1.6vh, 1.25rem);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem 1.6rem;
  background: var(--accent-black);
  color: #ffffff;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.18s ease;
}

.download-btn:hover {
  background: #27272a;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.download-btn:active {
  transform: translateY(1px);
}

.apple-icon {
  flex-shrink: 0;
}

/* ==========================================================================
   Minimalist Footer
   ========================================================================== */

.app-footer {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-shrink: 0;
  padding: clamp(0.35rem, 1vh, 0.75rem) 0 0.2rem;
}

.footer-link {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-dot {
  font-size: 0.72rem;
  color: #d1d5db;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-height: 700px) {
  .app-viewport {
    padding: 0.4rem 1rem;
  }
  .stage-header {
    margin-bottom: 0.25rem;
  }
  .stage-title {
    font-size: 1.05rem;
    margin-bottom: 0.1rem;
  }
  .stage-subtitle {
    font-size: 0.72rem;
  }
  .stage-card {
    max-height: 380px;
  }
  .dave-character {
    width: 110px;
    height: 110px;
  }
  .dave-character img {
    width: 100px;
    height: 100px;
  }
  .speech-bubble {
    top: 8%;
    padding: 0.35rem 0.7rem;
  }
}
