/* ── Picture-Book Design System — Remember the Perrito ─────────── */
/* Tokens from DESIGN.md — watercolor, hand-drawn, warm & cozy    */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&family=Patrick+Hand&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Colors */
  --paper: #FDF8F0;
  --paper-deep: #F6EFE3;
  --wash-yellow: rgba(255, 214, 140, 0.40);
  --wash-coral: rgba(255, 176, 148, 0.32);
  --wash-blue: rgba(178, 208, 228, 0.28);
  --ink: #5C3D2E;
  --ink-soft: #8A6B5B;
  --crayon: #E89B4C;
  --crayon-deep: #D4823A;
  --cream: #FFFBF2;

  /* Typography */
  --font-display: 'Patrick Hand', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Comic Sans MS', cursive;
  --font-body: 'Nunito', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;

  /* Spacing */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  /* Shadows (soft, multi-layer for depth) */
  --shadow-soft: 0 8px 32px rgba(92, 61, 46, 0.08);
  --shadow-medium: 0 12px 40px rgba(92, 61, 46, 0.12);
  --shadow-dog: 0 16px 48px rgba(92, 61, 46, 0.15), 0 4px 12px rgba(92, 61, 46, 0.08);

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow: 0.5s ease;
}

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

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Paper Texture Background ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"),
    var(--paper);
  background-size: 128px 128px, auto;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.3;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.5rem); }

p {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.8;
}

/* ── Snap Sections ─────────────────────────────────────────────── */
.snap-section {
  min-height: 100dvh;
  min-height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

/* ── Watercolor Blobs ────────────────────────────────────────── */
.watercolor-blob {
  position: absolute;
  border-radius: 60% 40% 50% 50% / 50% 60% 40% 50%;
  filter: blur(40px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.watercolor-blob.yellow {
  background: var(--wash-yellow);
  width: 300px;
  height: 300px;
}

.watercolor-blob.coral {
  background: var(--wash-coral);
  width: 250px;
  height: 250px;
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
}

.watercolor-blob.blue {
  background: var(--wash-blue);
  width: 280px;
  height: 280px;
  border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%;
}

/* ── Dog Actor ───────────────────────────────────────────────── */
.dog-actor {
  width: 240px;
  height: 240px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 16px 48px rgba(92, 61, 46, 0.15)) drop-shadow(0 4px 12px rgba(92, 61, 46, 0.08));
  transition: transform var(--transition-medium);
  will-change: transform;
}

.dog-actor img,
.dog-actor picture {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.dog-actor:hover {
  transform: scale(1.04) translateY(-8px);
}

/* Dog selection thumbnails */
.dog-thumb {
  width: 120px;
  height: 120px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-medium), filter var(--transition-fast);
  filter: drop-shadow(0 4px 12px rgba(92, 61, 46, 0.1));
}

.dog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.dog-thumb:hover {
  transform: scale(1.04) translateY(-6px);
  filter: drop-shadow(0 8px 20px rgba(92, 61, 46, 0.15));
}

.dog-thumb.active {
  transform: scale(1.08) translateY(-8px);
  filter: drop-shadow(0 12px 28px rgba(92, 61, 46, 0.2));
}

/* ── Speech Bubble ─────────────────────────────────────────────── */
.speech-bubble {
  position: relative;
  background: var(--cream);
  border: 2px solid var(--crayon);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  max-width: 400px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--ink);
  line-height: 1.6;
  box-shadow: var(--shadow-soft);
  z-index: 2;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 40px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--crayon);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 42px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--cream);
  z-index: 1;
}

/* ── Crayon Button ─────────────────────────────────────────────── */
.crayon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  background: var(--crayon);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  text-decoration: none;
  border: none;
  border-radius: 50px 30px 50px 35px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(232, 155, 76, 0.3), inset 0 -2px 0 rgba(0,0,0,0.05);
  transition: background var(--transition-fast), transform var(--transition-medium), box-shadow var(--transition-fast);
  will-change: transform;
}

.crayon-btn:hover {
  background: var(--crayon-deep);
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(232, 155, 76, 0.4), inset 0 -2px 0 rgba(0,0,0,0.05);
}

.crayon-btn:active {
  transform: scale(0.98);
}

.crayon-btn.secondary {
  background: transparent;
  color: var(--crayon);
  border: 2px solid var(--crayon);
  box-shadow: none;
}

.crayon-btn.secondary:hover {
  background: var(--crayon);
  color: #fff;
}

/* Ripple effect container */
.crayon-btn {
  position: relative;
  overflow: hidden;
}

/* ── Floating Decorations ──────────────────────────────────────── */
.floating-decor {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

.floating-decor.paw {
  width: 24px;
  height: 24px;
}

.floating-decor.bone {
  width: 28px;
  height: 28px;
}

.floating-decor.heart {
  width: 20px;
  height: 20px;
}

.floating-decor.star {
  width: 16px;
  height: 16px;
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}

@keyframes float-medium {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-3deg); }
}

/* ── Section Layouts ───────────────────────────────────────────── */
.section-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  gap: 3rem;
}

.section-content.reverse {
  flex-direction: row-reverse;
}

.section-dog {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Dog Selector Grid ───────────────────────────────────────── */
.dog-selector {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
}

.dog-selector-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform var(--transition-medium);
}

.dog-selector-item:hover {
  transform: translateY(-4px);
}

.dog-selector-item .dog-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink-soft);
  transition: color var(--transition-fast);
}

.dog-selector-item:hover .dog-label,
.dog-selector-item.active .dog-label {
  color: var(--crayon);
}

.dog-selector-item .premium-badge {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--crayon);
  background: var(--wash-yellow);
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Scroll Hint ─────────────────────────────────────────────── */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: bounce-down 2s ease-in-out infinite;
  z-index: 3;
}

.scroll-hint span {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

@keyframes bounce-down {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ── Navigation ──────────────────────────────────────────────── */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(253, 248, 240, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--transition-fast);
}

.nav-bar.scrolled {
  box-shadow: 0 2px 16px rgba(92, 61, 46, 0.08);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.nav-brand img {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.lang-switcher .lang-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.lang-switcher .lang-btn:hover {
  color: var(--crayon);
}

.lang-switcher .lang-btn.active {
  color: var(--crayon);
  background: var(--wash-yellow);
  font-weight: 600;
}

.lang-switcher .lang-sep {
  color: var(--ink-soft);
  opacity: 0.4;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--crayon);
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
  padding: 2rem;
  text-align: center;
  background: var(--paper-deep);
  border-top: 1px solid rgba(92, 61, 46, 0.08);
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-footer .footer-links a:hover {
  color: var(--crayon);
}

.site-footer .footer-copy {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* ── Entrance Animations ───────────────────────────────────────── */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
}

/* Stagger delays for children */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }

/* ── Privacy Link Small ──────────────────────────────────────── */
.privacy-link {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.privacy-link:hover {
  color: var(--crayon);
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-snap-type: none;
    scroll-behavior: auto;
  }

  .snap-section {
    scroll-snap-align: none;
  }

  .dog-actor,
  .dog-thumb,
  .crayon-btn,
  .floating-decor,
  .scroll-hint,
  .fade-in-up,
  .fade-in {
    transition: none !important;
    animation: none !important;
  }

  .dog-actor:hover,
  .dog-thumb:hover {
    transform: none !important;
  }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .snap-section {
    padding: 1.5rem;
    min-height: 100dvh;
  }

  .section-content,
  .section-content.reverse {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .section-dog {
    order: -1;
  }

  .dog-actor {
    width: 200px;
    height: 200px;
  }

  .dog-thumb {
    width: 100px;
    height: 100px;
  }

  .dog-selector {
    gap: 1.5rem;
  }

  .speech-bubble {
    max-width: 100%;
    margin: 0 auto;
  }

  .speech-bubble::after,
  .speech-bubble::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .speech-bubble::after {
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--crayon);
  }

  .speech-bubble::before {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--cream);
  }

  .nav-bar {
    padding: 0.75rem 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .lang-switcher {
    font-size: 0.8rem;
  }

  .watercolor-blob {
    width: 200px !important;
    height: 200px !important;
  }

  .scroll-hint {
    bottom: 1rem;
  }
}

@media (max-width: 480px) {
  .dog-actor {
    width: 180px;
    height: 180px;
  }

  .dog-thumb {
    width: 80px;
    height: 80px;
  }

  .dog-selector {
    gap: 1rem;
  }

  .crayon-btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
  }
}
