/* ==========================================================================
   TouchTree — Design System & Styles
   A quiet botanical reminder to return to nature.
   Self-contained. No external CDN or framework dependencies.
   ========================================================================== */

:root {
  /* Botanical Palette */
  --forest-deep: #132d1e;
  --forest-primary: #1c422c;
  --forest-soft: #28543a;
  
  --leaf-green: #3d6e4f;
  --leaf-sage: #6b8f74;
  --sage-soft: #9db7a2;
  --mint-soft: #d3e7d6;
  --mint-halo: #e2f0e5;

  --cream-bg: #faf7f0;
  --cream-surface: #f4efe4;
  --cream-card: #f8f5ed;
  --cream-border: rgba(30, 66, 44, 0.12);
  
  --bark-deep: #382d22;
  --bark-line: #7c6853;
  --flower-rose: #d98289;
  --flower-buttercup: #e5b84c;

  /* Typography Stacks (Self-contained, native system fonts) */
  --font-serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Palatino", "Book Antiqua", "Baskerville", "Georgia", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Fluid Spacing & Transitions */
  --transition-gentle: 480ms cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-organic: 0 16px 48px -12px rgba(19, 45, 30, 0.08);
}

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

html {
  font-size: 16px;
  background-color: var(--cream-bg);
  color: var(--forest-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-serif);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    radial-gradient(ellipse at 50% 10%, var(--mint-halo) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 90%, rgba(211, 231, 214, 0.45) 0%, transparent 55%),
    var(--cream-bg);
  position: relative;
  overflow-x: hidden;
  padding: 1.5rem;
}

/* Ambient Botanical Flourishes */
.ambient-garden {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.botanical-corner {
  position: absolute;
  width: clamp(140px, 22vw, 260px);
  height: clamp(140px, 22vw, 260px);
  opacity: 0.7;
}

.corner-top-left {
  top: 0;
  left: 0;
  transform-origin: top left;
  animation: gentle-breeze 16s ease-in-out infinite alternate;
}

.corner-bottom-right {
  bottom: 0;
  right: 0;
  transform-origin: bottom right;
  animation: gentle-breeze-reverse 18s ease-in-out infinite alternate;
}

/* Main Sanctuary Viewport Shell */
.tree-sanctuary {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Garden Stage (Card Container for each state) */
.garden-stage {
  width: 100%;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 5vw, 3rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  background: rgba(254, 253, 249, 0.7);
  border: 1px solid var(--cream-border);
  border-radius: 28px;
  box-shadow: var(--shadow-organic);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity var(--transition-gentle), transform var(--transition-gentle);
}

.garden-stage.stage-active {
  opacity: 1;
  transform: translateY(0);
}

.garden-stage.stage-hidden {
  display: none;
  opacity: 0;
  transform: translateY(14px);
}

.garden-stage.is-fading-out {
  opacity: 0;
  transform: translateY(-12px);
}

/* Botanical Art & SVG Graphics */
.botanical-art {
  display: flex;
  justify-content: center;
  align-items: center;
}

.art-svg {
  width: clamp(110px, 18vw, 150px);
  height: clamp(110px, 18vw, 150px);
  filter: drop-shadow(0 6px 14px rgba(28, 66, 44, 0.07));
  animation: organic-pulse 8s ease-in-out infinite alternate;
  transform-origin: center center;
}

.art-farewell {
  animation: serene-rest 10s ease-in-out infinite alternate;
}

/* Typography Hierarchy */
.message-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: clamp(0.72rem, 1.4vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest-soft);
  opacity: 0.88;
}

.headline {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 4.2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--forest-deep);
  max-width: 24ch;
}

.headline-large {
  font-size: clamp(2.25rem, 5.2vw, 3.4rem);
  letter-spacing: -0.02em;
}

.body-prose {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 48ch;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.68;
  color: #274232;
}

.body-prose p {
  color: #2d4c39;
}

.body-prose .emphasis {
  font-weight: 600;
  color: var(--forest-deep);
}

.body-prose .quiet-verdict {
  font-size: clamp(1.18rem, 2.3vw, 1.38rem);
  font-style: italic;
  color: var(--forest-primary);
  margin-top: 0.25rem;
}

.body-prose .final-words {
  font-size: clamp(1.15rem, 2.3vw, 1.35rem);
  font-weight: 600;
  color: var(--forest-deep);
  margin-top: 0.25rem;
}

/* Botanical Buttons */
.action-footer {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-botanical {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 2rem;
  background-color: var(--forest-primary);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(28, 66, 44, 0.22);
  transition: 
    background-color 260ms ease,
    transform 220ms ease,
    box-shadow 260ms ease;
  user-select: none;
  -webkit-user-select: none;
}

.btn-botanical:hover {
  background-color: var(--forest-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(19, 45, 30, 0.28);
}

.btn-botanical:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(19, 45, 30, 0.2);
}

.btn-botanical:focus-visible {
  outline: 3px solid var(--forest-primary);
  outline-offset: 4px;
}

.btn-leaf-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-block;
  color: var(--mint-soft);
  transition: transform 300ms ease;
}

.btn-botanical:hover .btn-leaf-icon {
  transform: rotate(12deg) scale(1.08);
}

/* Departure Sign (Screen 3) */
.departure-sign {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  background: rgba(235, 245, 237, 0.6);
  border: 1px solid rgba(107, 143, 116, 0.25);
  color: var(--forest-soft);
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.sign-ornament {
  font-size: 1.15rem;
  color: var(--leaf-sage);
}

/* Subtle Ambient Animations */
@keyframes organic-pulse {
  0% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.025) translateY(-3px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

@keyframes serene-rest {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-2px);
  }
}

@keyframes gentle-breeze {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(2.5deg) scale(1.03);
  }
}

@keyframes gentle-breeze-reverse {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(-2.5deg) scale(1.03);
  }
}

/* Accessibility: Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  
  .corner-top-left,
  .corner-bottom-right,
  .art-svg,
  .art-farewell {
    animation: none !important;
  }
  
  .garden-stage {
    transition: none !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 600px) {
  body {
    padding: 1rem;
    align-items: center;
  }

  .garden-stage {
    padding: 2.25rem 1.25rem;
    border-radius: 22px;
    gap: 1.4rem;
  }

  .btn-botanical {
    width: 100%;
    max-width: 320px;
  }

  .departure-sign {
    padding: 0.65rem 1rem;
    font-size: 0.84rem;
  }
}
