/* ========================================
   drift v0.2 — Layout 3-zone
   ======================================== */

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease, color 0.6s ease;
}

/* --- Focus visible (a11y) --- */
:focus-visible {
  outline: 2px solid #c79a3e;
  outline-offset: 2px;
}
[data-theme="interactive"] :focus-visible { outline-color: #38b2ac; }

/* --- Canvas --- */
#drift-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ========================================
   ZONA 1 — Top bar
   ======================================== */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(139, 115, 85, 0.15);
  transition: background 0.6s ease, border-color 0.6s ease;
}

#top-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#logo {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: color 0.6s ease;
}

#social-proof {
  font-size: 0.65rem;
  letter-spacing: 0.3px;
  transition: color 0.6s ease;
}

.top-badge {
  font-size: 0.75rem;
  font-weight: 400;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(200, 185, 160, 0.15);
  white-space: nowrap;
  transition: all 0.6s ease;
}

/* ========================================
   ZONA 2 — Main area
   ======================================== */
#main-area {
  position: absolute;
  inset: 72px 0 56px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 24px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#mode-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  padding-bottom: 24px;
}

#mode-title {
  font-size: 1.3rem;
  font-weight: 500;
  transition: color 0.6s ease;
}

#mode-subtitle {
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.5;
  transition: color 0.6s ease;
}

#canvas-container {
  width: 100%;
  height: 60vh;
  max-height: 400px;
  /* il canvas vero è fisso dietro, questo è solo spazio riservato */
}

#breathe-label {
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  min-height: 1.5rem;
  transition: opacity 0.5s ease;
}

#blue-light-warning {
  font-size: 0.75rem;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: 8px;
  max-width: 280px;
  line-height: 1.4;
  transition: all 0.6s ease;
}

/* --- Audio bar --- */
#audio-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: all 0.3s ease;
  background: transparent;
}

#play-icon {
  font-size: 0.8rem;
  line-height: 1;
}

#play-label {
  font-size: 0.55rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

#play-btn.playing #play-icon::before { content: '⏸'; }
#play-btn:not(.playing) #play-icon::before { content: '▶'; }

#volume-slider {
  width: 100px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* --- Extra controls --- */
#extra-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.text-btn {
  font-size: 0.75rem;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  font-family: inherit;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
}

/* ========================================
   ZONA 3 — Bottom bar
   ======================================== */
#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(139, 115, 85, 0.15);
  transition: background 0.6s ease, border-color 0.6s ease;
}

#mode-toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-label {
  font-size: 0.7rem;
  font-weight: 400;
  transition: color 0.4s ease;
  white-space: nowrap;
}

.mode-label.active { font-weight: 500; }

#bottom-spacer { flex: 1; }

/* --- Pill toggle --- */
.pill-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  padding: 2px;
  transition: background 0.4s ease;
}
.pill-toggle .toggle-thumb {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transition: transform 0.4s ease, background 0.4s ease;
}

/* --- Unlock button --- */
.unlock-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  white-space: nowrap;
  animation: gentlePulse 3s ease-in-out 5s infinite;
}
@keyframes gentlePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(199, 154, 62, 0.25); }
  50% { box-shadow: 0 0 35px rgba(199, 154, 62, 0.45); }
}
.unlock-btn[hidden] { display: none; }

/* ========================================
   OVERLAY (shared)
   ======================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.overlay[hidden] { display: none; }

.overlay-card {
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 30px rgba(199, 154, 62, 0.08);
}
.overlay-card h2 { font-size: 1.2rem; font-weight: 500; }
.overlay-card p { font-size: 0.9rem; font-weight: 300; opacity: 0.8; }
.price { font-size: 2rem !important; font-weight: 600 !important; opacity: 1 !important; }
.error-text { font-size: 0.8rem; color: #e53e3e; }

/* Thank-you */
.thank-you-card { gap: 12px !important; }
.thank-you-icon { font-size: 2.5rem; display: block; }
.thank-you-card p { opacity: 0.6; font-size: 0.85rem; }

/* ========================================
   JOURNALING
   ======================================== */
.journaling-card {
  max-width: 380px;
  text-align: left;
  gap: 12px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}
.close-btn:hover { opacity: 1; }

.journaling-note {
  font-size: 0.7rem !important;
  opacity: 0.45 !important;
  text-align: center;
}

.journaling-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.journaling-field label {
  font-size: 0.8rem;
  font-weight: 400;
}
.journaling-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 300;
  resize: vertical;
  background: transparent;
  transition: border-color 0.3s ease;
}
.journaling-field textarea:focus {
  outline: none;
  border-color: #c79a3e;
}

/* ========================================
   ONBOARDING
   ======================================== */
#onboarding-overlay { z-index: 300; }

.onboarding-card {
  border-radius: 12px;
  padding: 40px 28px 28px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 0 40px rgba(199, 154, 62, 0.06);
  transition: opacity 0.3s ease;
}
.onboarding-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}
.onboarding-slide[hidden] { display: none; }
.onboarding-title { font-size: 1.3rem; font-weight: 500; line-height: 1.3; }
.onboarding-subtitle {
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.5;
  max-width: 280px;
}
.onboarding-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.empathy-toggle {
  background: transparent;
  border: 1px solid;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.onboarding-cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.onboarding-btn {
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
}
.onboarding-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.onboarding-dots { display: flex; gap: 8px; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(139, 115, 85, 0.3);
  transition: background 0.3s ease;
}
.dot.active { background: #c79a3e; }

/* ========================================
   PRINT (journaling export)
   ======================================== */
@media print {
  body * { visibility: hidden; }
  .journaling-card, .journaling-card * { visibility: visible; }
  .journaling-card {
    position: absolute;
    top: 0;
    left: 0;
    max-width: 100%;
    width: 100%;
    box-shadow: none;
    border: none;
  }
  .close-btn { display: none; }
  .journaling-note { display: none; }
  .journaling-field textarea {
    border: none;
    background: none;
    resize: none;
    font-size: 12pt;
  }
  .journaling-field label { font-size: 11pt; font-weight: 600; }
}

/* ========================================
   TEMA RELAX — "Candlelight"
   ======================================== */
[data-theme="relax"] body { background: #0d0a07; color: #e8d5b0; }
[data-theme="relax"] #top-bar { background: rgba(13, 10, 7, 0.92); }
[data-theme="relax"] #bottom-bar { background: rgba(13, 10, 7, 0.92); }
[data-theme="relax"] #logo { color: #c79a3e; }
[data-theme="relax"] #social-proof { color: rgba(232, 213, 176, 0.3); }
[data-theme="relax"] .top-badge { background: rgba(13, 10, 7, 0.85); color: rgba(232, 213, 176, 0.6); }
[data-theme="relax"] #mode-title { color: #e8d5b0; }
[data-theme="relax"] #mode-subtitle { color: #8b7355; }
[data-theme="relax"] #blue-light-warning { background: rgba(233, 196, 106, 0.1); color: #e9c46a; }

[data-theme="relax"] #play-btn { border-color: rgba(139, 115, 85, 0.4); color: #8b7355; }
[data-theme="relax"] #play-btn:hover { border-color: #c79a3e; color: #c79a3e; }
[data-theme="relax"] #volume-slider { background: rgba(139, 115, 85, 0.3); }
[data-theme="relax"] #volume-slider::-webkit-slider-thumb { background: #c79a3e; }
[data-theme="relax"] .text-btn { color: #8b7355; border-color: rgba(139, 115, 85, 0.3); }
[data-theme="relax"] .text-btn:hover { color: #c79a3e; border-color: #c79a3e; }

[data-theme="relax"] .pill-toggle { background: rgba(139, 115, 85, 0.3); }
[data-theme="relax"] .pill-toggle .toggle-thumb { background: #c79a3e; transform: translateX(0); }
[data-theme="relax"] .mode-label { color: #8b7355; }
[data-theme="relax"] .mode-label.active { color: #c79a3e; }
[data-theme="relax"] .unlock-btn { background: #c79a3e; color: #0d0a07; box-shadow: 0 0 20px rgba(199, 154, 62, 0.25); }
[data-theme="relax"] .unlock-btn:hover { background: #d4a84b; }

[data-theme="relax"] .overlay { background: rgba(13, 10, 7, 0.9); }
[data-theme="relax"] .overlay-card { background: #1a1410; border: 1px solid rgba(139, 115, 85, 0.4); color: #e8d5b0; }
[data-theme="relax"] .onboarding-card { background: #1a1410; border: 1px solid rgba(139, 115, 85, 0.3); }
[data-theme="relax"] .onboarding-title { color: #e8d5b0; }
[data-theme="relax"] .onboarding-subtitle { color: #8b7355; }
[data-theme="relax"] .empathy-toggle { border-color: rgba(139, 115, 85, 0.3); color: #8b7355; background: rgba(139, 115, 85, 0.08); }
[data-theme="relax"] .empathy-toggle:hover, [data-theme="relax"] .empathy-toggle.active { border-color: #c79a3e; color: #c79a3e; background: rgba(199, 154, 62, 0.1); }
[data-theme="relax"] .onboarding-btn.primary { background: #c79a3e; color: #0d0a07; }
[data-theme="relax"] .onboarding-btn.primary:hover { background: #d4a84b; }
[data-theme="relax"] .onboarding-btn.secondary { background: transparent; color: #c79a3e; border: 1px solid rgba(199, 154, 62, 0.4); }
[data-theme="relax"] .ot.active { background: #c79a3e; }
[data-theme="relax"] .journaling-card { background: #1a1410; border-color: rgba(139, 115, 85, 0.3); }
[data-theme="relax"] .journaling-card label { color: #e8d5b0; }
[data-theme="relax"] .journaling-field textarea { border-color: rgba(139, 115, 85, 0.3); color: #e8d5b0; }
[data-theme="relax"] .close-btn { color: #e8d5b0; }
[data-theme="relax"] .thank-you-icon { color: #c79a3e; }

/* ========================================
   TEMA INTERATTIVO — "Deep Night"
   ======================================== */
[data-theme="interactive"] body { background: #070c14; color: #dce6f0; }
[data-theme="interactive"] #top-bar { background: rgba(7, 12, 20, 0.92); }
[data-theme="interactive"] #bottom-bar { background: rgba(7, 12, 20, 0.92); }
[data-theme="interactive"] #logo { color: #38b2ac; }
[data-theme="interactive"] #social-proof { color: rgba(220, 230, 240, 0.25); }
[data-theme="interactive"] .top-badge { background: rgba(7, 12, 20, 0.85); color: rgba(220, 230, 240, 0.55); }
[data-theme="interactive"] #mode-title { color: #dce6f0; }
[data-theme="interactive"] #mode-subtitle { color: #6b7d99; }
[data-theme="interactive"] #blue-light-warning { background: rgba(233, 196, 106, 0.1); color: #e9c46a; }

[data-theme="interactive"] #play-btn { border-color: rgba(107, 125, 153, 0.3); color: #6b7d99; }
[data-theme="interactive"] #play-btn:hover { border-color: #38b2ac; color: #38b2ac; }
[data-theme="interactive"] #volume-slider { background: rgba(107, 125, 153, 0.3); }
[data-theme="interactive"] #volume-slider::-webkit-slider-thumb { background: #38b2ac; }
[data-theme="interactive"] .text-btn { color: #6b7d99; border-color: rgba(107, 125, 153, 0.3); }
[data-theme="interactive"] .text-btn:hover { color: #38b2ac; border-color: #38b2ac; }

[data-theme="interactive"] .pill-toggle { background: rgba(107, 125, 153, 0.3); }
[data-theme="interactive"] .pill-toggle .toggle-thumb { background: #38b2ac; transform: translateX(20px); }
[data-theme="interactive"] .mode-label { color: #6b7d99; }
[data-theme="interactive"] .mode-label.active { color: #38b2ac; }
[data-theme="interactive"] .unlock-btn { background: #38b2ac; color: #070c14; box-shadow: 0 0 20px rgba(56, 178, 172, 0.25); }
[data-theme="interactive"] .unlock-btn:hover { background: #4cc4be; }

[data-theme="interactive"] .overlay { background: rgba(7, 12, 20, 0.92); }
[data-theme="interactive"] .overlay-card { background: #0f1a2e; border: 1px solid rgba(107, 125, 153, 0.3); color: #dce6f0; }
[data-theme="interactive"] .onboarding-card { background: #0f1a2e; border-color: rgba(107, 125, 153, 0.3); }
[data-theme="interactive"] .onboarding-title { color: #dce6f0; }
[data-theme="interactive"] .onboarding-subtitle { color: #6b7d99; }
[data-theme="interactive"] .empathy-toggle { border-color: rgba(107, 125, 153, 0.3); color: #6b7d99; background: rgba(107, 125, 153, 0.06); }
[data-theme="interactive"] .empathy-toggle:hover, [data-theme="interactive"] .empathy-toggle.active { border-color: #38b2ac; color: #38b2ac; background: rgba(56, 178, 172, 0.08); }
[data-theme="interactive"] .onboarding-btn.primary { background: #38b2ac; color: #070c14; }
[data-theme="interactive"] .onboarding-btn.primary:hover { background: #4cc4be; }
[data-theme="interactive"] .onboarding-btn.secondary { background: transparent; color: #38b2ac; border: 1px solid rgba(56, 178, 172, 0.4); }
[data-theme="interactive"] .dot.active { background: #38b2ac; }
[data-theme="interactive"] .journaling-card { background: #0f1a2e; border-color: rgba(107, 125, 153, 0.3); }
[data-theme="interactive"] .journaling-card label { color: #dce6f0; }
[data-theme="interactive"] .journaling-field textarea { border-color: rgba(107, 125, 153, 0.3); color: #dce6f0; }
[data-theme="interactive"] .close-btn { color: #dce6f0; }
[data-theme="interactive"] .thank-you-icon { color: #38b2ac; }

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 400px) {
  #top-bar { padding: 0 16px; }
  #bottom-bar { padding: 0 12px; }
  #logo { font-size: 1rem; }
  .mode-label { font-size: 0.65rem; }
  #canvas-container { height: 50vh; }
}
