/* mobile.css — auto-split from styles.css */
/* ===== MOBILE POLISH ===== */
@media (max-width: 700px) {
  :root { --space: 18px; }
  .chapter {
    padding: 72px var(--space) 64px;
    min-height: auto;
  }
  h2 { font-size: clamp(1.55rem, 7vw, 2rem); }
  .chapter-lead { font-size: 0.95rem; }
  .envelope-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .envelope {
    padding: 16px 14px;
    font-size: 0.95rem;
  }
  .lock-card {
    padding: 32px 18px 28px;
  }
  .message-composer {
    padding: 14px;
  }
  .composer-who {
    gap: 8px;
  }
  .who-btn {
    padding: 10px 8px;
    font-size: 0.82rem;
  }
  .msg { max-width: 100%; }
  .back-top {
    right: 14px;
    bottom: 18px;
    width: 44px;
    height: 44px;
  }
  .site-footer {
    padding: 36px 16px 90px;
  }
  .footer-stats {
    font-size: 0.82rem;
    flex-direction: column;
    gap: 4px;
  }
  .footer-dot { display: none; }
  .mood-grid {
    gap: 8px;
  }
  .polaroid-stack {
    height: auto !important;
    min-height: 0 !important;
    width: min(300px, 86vw);
    margin: 0 auto;
    aspect-ratio: 3 / 4;
    overflow: hidden;
  }
  .polaroid {
    width: 100% !important;
    height: 100% !important;
    margin: 0 auto;
    padding: 10px 10px 36px;
  }
  .polaroid img {
    height: 100%;
    max-height: none !important;
    object-fit: cover;
  }
  .gallery-controls {
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
  }
  .album-button {
    padding: 12px 18px;
    font-size: 0.85rem;
  }
  .letter-paper, #modalContent {
    margin: 12px;
    max-height: 85svh;
    overflow-y: auto;
  }
  .hearts-reward-card {
    padding: 28px 18px 24px;
  }
  .return-card {
    margin: 16px;
    padding: 28px 18px;
  }
}

@media (max-width: 380px) {
  .mood-label { font-size: 0.75rem; }
  .lock-title { font-size: 1.7rem; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 108, 0.25);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(201, 168, 108, 0.4); }

@media (max-width: 700px) {
  .chapter {
    padding: 72px 14px;
    min-height: auto;
  }
  .chapter:first-of-type { min-height: 88svh; }
  .card { padding: 18px 14px; border-radius: 18px; }
  p { font-size: 0.95rem; line-height: 1.7; }
  .polaroid-stack {
    height: auto;
    min-height: 0;
    width: min(300px, 86vw);
    margin: 0 auto;
    aspect-ratio: 3 / 4;
    overflow: hidden;
  }
  .polaroid {
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    padding: 10px 10px 36px;
  }
  .polaroid img {
    height: 100%;
    max-height: none;
    object-fit: cover;
  }
  .question-btn { width: 100%; padding: 14px; }
  .divider { margin: 2px 0; letter-spacing: 8px; }
  .love-title { margin-top: 40px; }
  .envelope-grid { grid-template-columns: 1fr; }
  .envelope { min-height: 115px; }
  .letter-paper { padding: 24px 18px; }
  .lock-card { padding: 36px 22px 30px; }
  .lock-field { width: min(220px, 100%); }
  .update-card, .daily-card, .memory-card, .future-card { padding: 20px 16px; }
  .intro-title { font-size: clamp(1.8rem, 7.5vw, 2.7rem); }
  .intro-kicker { letter-spacing: 0.36em; margin-bottom: 24px; }
  .intro-glow-ring { width: min(360px, 85vw); height: min(360px, 85vw); }

  .messages-shell { gap: 14px; }
  .msg { max-width: 95%; }
  .msg-bubble { padding: 12px 15px; font-size: 0.98rem; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  .bg-item, .intro-particle { display: none; }
  .intro-kicker,
  .intro-title span,
  .intro-sub,
  .intro-spotlight,
  .intro-vignette,
  .intro-glow-ring {
    opacity: 1;
    transform: none;
  }
  .intro-rule span { width: 72px; }
  .intro-content { animation: none; }
}


/* ===== MOBILE PERFORMANCE ===== */
@media (max-width: 900px) {
  body {
    background-attachment: scroll !important;
  }
  body::before {
    animation: none !important;
    opacity: 0.85;
  }
  .bg-particle,
  .bg-item {
    display: none !important;
  }
  .chapter-kicker,
  .divider,
  .heart,
  .secret-heart,
  .lock-icon-heart,
  .lock-icon-ring,
  .lock-icon-ring--outer,
  .lock-ambient,
  .intro-content {
    animation: none !important;
  }
  .vinyl {
    animation: spin 14s linear infinite !important;
  }
  .lock-btn::after,
  .composer-send::after,
  .album-button::after,
  .hearts-reward-btn::after {
    animation: none !important;
    display: none !important;
  }
  .lock-card,
  .return-card,
  .letter-paper,
  #modalContent,
  .hearts-reward,
  .secret-toast {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .update-card:hover,
  .daily-card:hover,
  .memory-card:hover,
  .future-card:hover,
  .card:hover {
    transform: none;
  }
  .reveal {
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .bg-particle,
  .intro-particle {
    will-change: auto !important;
  }
}

@media (max-width: 700px) {
  .intro-spotlight {
    filter: none !important;
  }
  .eq-bar {
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}



/* ===== MOBILE UX + PERF 2026 ===== */
@media (max-width: 900px) {
  html {
    scroll-behavior: auto; /* smoother native scroll on iOS */
  }
  body {
    background-attachment: scroll !important;
  }
  body::before,
  body::after {
    animation: none !important;
  }
  /* lighter ambient — keep soft look, drop cost */
  body::after {
    opacity: 0.5 !important;
  }

  .bg-item,
  .bg-particle {
    display: none !important;
  }

  /* kill continuous CPU animations */
  .chapter-kicker,
  .divider,
  .heart,
  .secret-heart,
  .lock-icon-heart,
  .lock-icon-ring,
  .lock-icon-ring--outer,
  .lock-ambient,
  .intro-content,
  .intro-kicker,
  .contentBreathe,
  #scrollProgress {
    animation: none !important;
  }
  #scrollProgress {
    transition: none !important;
    height: 2px;
  }

  .vinyl {
    animation: spin 16s linear infinite !important;
  }
  .equalizer i,
  .eq-bar {
    animation: none !important;
  }

  .lock-btn::after,
  .composer-send::after,
  .album-button::after,
  .hearts-reward-btn::after,
  .finds-reward-btn::after {
    display: none !important;
    animation: none !important;
  }

  /* no expensive blur on overlays */
  .lock-card,
  .return-card,
  .letter-paper,
  #modalContent,
  .hearts-reward,
  .finds-reward-bg,
  .secret-toast,
  .find-toast {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .reveal {
    transition: opacity 0.45s ease, transform 0.45s ease !important;
  }
  .reveal:not(.show) {
    transform: translateY(16px);
  }

  .bg-item,
  .intro-particle {
    will-change: auto !important;
  }

  /* intro — simpler on mobile */
  .intro-spotlight {
    filter: none !important;
    opacity: 0.85 !important;
    animation-duration: 1.2s !important;
  }
  .intro-glow-ring {
    animation: none !important;
    opacity: 0.25 !important;
    transform: translate(-50%, -50%) scale(1) !important;
  }
  .intro-vignette {
    animation: none !important;
    opacity: 1 !important;
  }
}

@media (max-width: 700px) {
  :root {
    --space: 16px;
  }

  /* safer notches / home bar */
  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .back-top {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    width: 44px;
    height: 44px;
  }
  .site-footer {
    padding: 36px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  /* chapters — less empty vertical space */
  .chapter {
    min-height: auto;
    padding: 56px var(--space) 48px;
    justify-content: flex-start;
  }
  .chapter + .divider {
    margin: 0;
  }

  h1 {
    font-size: clamp(1.75rem, 7vw, 2.3rem);
  }
  h2 {
    font-size: clamp(1.5rem, 6.2vw, 2rem);
  }
  p {
    font-size: 0.98rem;
    line-height: 1.7;
    margin: 0.7rem auto;
  }
  .chapter-lead {
    font-size: 0.95rem;
    line-height: 1.65;
    padding: 0 4px;
  }
  .chapter-kicker {
    letter-spacing: 0.18em;
    font-size: 0.68rem;
    margin-bottom: 10px;
  }

  /* cards */
  .update-card,
  .daily-card,
  .memory-card,
  .future-card,
  .card,
  .game-block,
  .message-composer,
  .q-draw {
    padding: 18px 14px;
    border-radius: 18px;
    width: 100%;
  }
  .game-block {
    margin-top: 22px;
  }

  /* lock */
  #lock {
    padding: 24px 14px;
    padding-top: max(24px, env(safe-area-inset-top, 24px));
  }
  .lock-card {
    padding: 28px 18px 24px;
    border-radius: 22px;
  }
  .lock-title {
    font-size: clamp(1.65rem, 7vw, 2rem);
  }
  .lock-text {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }
  #password {
    font-size: 1.15rem;
    padding: 14px 12px;
    letter-spacing: 0.28em;
  }
  #lock button.lock-btn,
  #lock .lock-btn {
    width: 100% !important;
    max-width: 280px !important;
    padding: 14px 24px !important;
    min-height: 48px !important;
  }

  /* gallery */
  .polaroid-stack {
    width: min(280px, 78vw);
    height: min(340px, 95vw);
    min-height: 0;
  }
  .gallery-controls {
    gap: 10px;
  }
  .album-button {
    padding: 12px 16px;
    font-size: 0.85rem;
    min-height: 44px;
  }

  /* envelopes — full width touch targets */
  .envelope-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }
  .envelope {
    min-height: 72px;
    padding: 14px 14px;
    font-size: 0.95rem;
  }

  /* mood */
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }
  .mood-btn {
    min-height: 88px;
    padding: 12px 6px;
    border-radius: 14px;
  }
  .mood-label {
    font-size: 0.78rem;
  }

  /* messages */
  .messages-shell {
    gap: 12px;
    width: 100%;
  }
  .msg {
    max-width: 100%;
  }
  .msg-bubble {
    padding: 12px 14px;
    font-size: 0.98rem;
  }
  .composer-who {
    gap: 8px;
  }
  .who-btn {
    padding: 12px 8px;
    min-height: 44px;
    font-size: 0.85rem;
  }
  .composer-input {
    font-size: 16px; /* prevent iOS zoom */
    min-height: 72px;
  }
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .composer-send {
    width: 100%;
    min-height: 46px;
    padding: 12px 18px;
  }

  /* questions */
  .q-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .q-actions .game-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 0;
  }
  .q-card {
    padding: 14px;
  }

  /* games */
  .game-btn {
    width: 100%;
    max-width: 280px;
    min-height: 46px;
  }
  .safe-pad {
    max-width: 100%;
    gap: 8px;
  }
  .safe-key {
    padding: 16px 0;
    min-height: 48px;
    font-size: 1.15rem;
  }
  .wheel-wrap {
    width: min(280px, 82vw);
  }
  .puzzle-board {
    width: min(280px, 84vw);
  }

  /* overlays */
  .letter-paper,
  #modalContent,
  .return-card,
  .hearts-reward-card,
  .finds-reward-card {
    margin: 12px;
    max-height: 82svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 16px 20px;
  }

  /* toasts higher above home indicator */
  .secret-toast,
  .find-toast {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    font-size: 0.9rem;
    padding: 12px 16px;
  }

  /* findables a bit more visible on small screens */
  .findable {
    color: rgba(232, 204, 150, 0.32);
    padding: 14px;
  }

  /* footer */
  .footer-stats {
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
  }
  .footer-dot {
    display: none;
  }

  /* reduce hover-only transforms that feel laggy on touch */
  .update-card:hover,
  .daily-card:hover,
  .memory-card:hover,
  .future-card:hover,
  .card:hover,
  .envelope:hover {
    transform: none;
  }
}

/* very small phones */
@media (max-width: 380px) {
  .lock-title { font-size: 1.55rem; }
  .mood-label { font-size: 0.72rem; }
  .chapter { padding: 44px 12px 40px; }
  .game-title { font-size: 1.25rem; }
}

/* prefer reduced motion — mobile friendly */
@media (prefers-reduced-motion: reduce) {
  #scrollProgress { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}


/* ===== GALLERY MOBILE FIX ===== */
@media (max-width: 700px) {
  #gallerySection {
    overflow: hidden;
  }
  #gallerySection .chapter-kicker,
  #gallerySection h2,
  #gallerySection .chapter-lead {
    position: relative;
    z-index: 3;
  }
  .gallery-shell {
    width: 100%;
    margin-top: 12px;
    position: relative;
    z-index: 1;
  }
  .polaroid-stack {
    position: relative !important;
    width: min(300px, 86vw) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 3 / 4;
    margin: 0 auto !important;
    overflow: hidden !important;
    perspective: none;
  }
  .polaroid {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 10px 10px 38px !important;
    box-sizing: border-box;
  }
  .polaroid img {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    display: block;
  }
  .gallery-controls {
    position: relative;
    z-index: 4;
    margin-top: 14px !important;
    gap: 12px;
  }
  .round-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
}


/* ===== MOBILE LAYOUT STABILITY ===== */
@media (max-width: 700px) {
  html {
    overflow-x: clip;
    overflow-y: auto;
  }
  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-width: 100%;
    position: relative;
    height: auto !important;
    min-height: 100%;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  #content,
  .chapter,
  .gallery-shell,
  .game-block,
  .message-composer,
  .messages-shell,
  .q-actions,
  .q-draw,
  .q-grid,
  .mood-grid,
  .envelope-grid,
  .update-card,
  .daily-card,
  .memory-card,
  .future-card,
  .card {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chapter {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 64px !important;
    padding-bottom: 56px !important;
    align-items: center !important;
    text-align: center !important;
    overflow-x: hidden;
  }

  .chapter-lead,
  .site-promise,
  p {
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 4px;
    padding-right: 4px;
    max-width: 100% !important;
  }

  /* buttons always centered */
  .q-actions,
  .puzzle-actions,
  .gallery-controls,
  .composer-actions {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box;
  }

  .q-actions {
    flex-direction: column !important;
    gap: 12px !important;
    margin-top: 28px !important;
    padding: 0 4px;
  }

  .q-actions .game-btn,
  .game-btn,
  .album-button,
  .question-btn,
  .memory-btn,
  .composer-send,
  #lock .lock-btn,
  #lock button.lock-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  .game-btn--ghost {
    width: 100% !important;
    max-width: 320px !important;
  }

  /* more vertical breathing room between blocks */
  .divider {
    margin: 12px 0 !important;
    padding: 16px 0 !important;
  }
  .game-block {
    margin-top: 28px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .mood-grid {
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 2px;
  }
  .envelope-grid {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* prevent absolute findables from causing horizontal scroll */
  .findable,
  .hidden-heart {
    max-width: 40px;
  }

  /* vinyl / music section */
  .vinyl-wrap {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* safe pad full width centered */
  .safe-pad {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* messages */
  .messages-shell,
  .message-composer {
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .composer-who {
    width: 100%;
  }
  .who-btn {
    text-align: center;
  }
}




/* ===== MOBILE PERF PASS 2026-08 ===== */
@media (max-width: 900px) {
  body::before {
    opacity: 0.22 !important;
    mix-blend-mode: normal !important;
    animation: none !important;
  }
  body::after {
    animation: none !important;
    filter: none !important;
    opacity: 0.45 !important;
    transform: none !important;
  }
  .background {
    transform: none !important;
    opacity: 0.7 !important;
  }
  .bg-item {
    box-shadow: none !important;
    filter: none !important;
  }
  .reveal {
    filter: none !important;
    transition: opacity 0.45s ease, transform 0.45s ease !important;
  }
  .reveal.show {
    filter: none !important;
  }
  /* kill expensive glass blurs on long pages */
  .lock-card,
  .card,
  .future-card,
  .mood-card,
  .letter-paper,
  .composer,
  .date-lock,
  .date-ready,
  .date-letter {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* simpler shadows */
  .card,
  .polaroid,
  .envelope,
  .mood-btn,
  .composer-send,
  .lock-btn {
    box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
  }
  /* less continuous animation */
  .intro-glow-ring,
  .intro-spotlight,
  .intro-speedlines,
  .date-ready-glow,
  .date-lock-seal {
    animation: none !important;
  }
  .date-ready-btn,
  .date-cinema-continue {
    animation: none !important;
  }
}
