@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400;1,6..72,500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-canvas: #F5F3EC;
  --bg-phone: #FAF8F2;
  --ink-primary: #1F1E1B;
  --ink-secondary: #65625B;
  --ink-muted: #9E9A90;
  --border-subtle: rgba(31, 30, 27, 0.08);
  --border-focus: rgba(31, 30, 27, 0.22);
  --seal-red: #A33B2E;
  --seal-red-bright: #E56857;
  --sage-green: #2F5943;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* ABSOLUTE BAN ON PAGE-LEVEL SCROLLING */
  overscroll-behavior: none;
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  touch-action: pan-y;
}

.font-editorial {
  font-family: 'Newsreader', Georgia, serif;
}

.font-mono-subtle {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Breathing animation for gesture arrows */
@keyframes breathUp {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(-5px); opacity: 1.0; }
}

@keyframes breathDown {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(5px); opacity: 1.0; }
}

.animate-breath-up {
  animation: breathUp 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.animate-breath-down {
  animation: breathDown 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Scrollbar clean */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

::selection {
  background: rgba(163, 59, 46, 0.12);
  color: var(--seal-red);
}

/* Washi paper subtle fiber feel */
.washi-paper {
  background-color: var(--bg-phone);
  background-image: radial-gradient(rgba(31, 30, 27, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Animations for card transitions */
@keyframes swipeUpAnim {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-120px) scale(0.96); opacity: 0; }
}

@keyframes swipeDownAnim {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(120px) scale(0.96); opacity: 0; }
}

@keyframes cardEnterAnim {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.anim-swipe-up {
  animation: swipeUpAnim 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.anim-swipe-down {
  animation: swipeDownAnim 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.anim-card-enter {
  animation: cardEnterAnim 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================= RESPONSIVE VIEWPORT ARCHITECTURE ================= */

/* MOBILE PHONES (Edge-to-edge 100dvh zero scroll app) */
@media (max-width: 640px) {
  html, body {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    background-color: var(--bg-phone) !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .desktop-header {
    display: none !important;
  }

  main {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .phone-frame {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    aspect-ratio: auto !important;
    min-height: 0 !important;
    padding-top: max(env(safe-area-inset-top), 0.5rem) !important;
    padding-bottom: max(env(safe-area-inset-bottom), 0.5rem) !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    overflow: hidden !important;
  }

  .speaker-slot {
    display: none !important;
  }
}

/* DESKTOP / TABLET (Centered Phone Stage) */
@media (min-width: 641px) {
  html, body {
    min-height: 100dvh;
    height: 100dvh;
    background-color: var(--bg-canvas);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.75rem;
    overflow: hidden !important;
  }

  .desktop-header {
    display: flex;
    width: 100%;
    max-width: 390px;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
  }

  main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
  }

  .phone-frame {
    width: 100%;
    max-width: 390px;
    height: min(844px, calc(100dvh - 4.5rem));
    max-height: calc(100dvh - 4.5rem);
    border-radius: 44px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 25px 60px -15px rgba(31, 30, 27, 0.14), 0 0 0 1px rgba(31, 30, 27, 0.08);
    padding: 1.25rem 1.5rem;
    overflow: hidden;
  }

  .speaker-slot {
    display: block;
    width: 4.5rem;
    height: 0.85rem;
    background-color: rgba(0, 0, 0, 0.06);
    border-radius: 9999px;
    margin: 0 auto 0.5rem auto;
    border: 1px solid rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
  }
}
