/**
 * ============================================================================
 * MOBILE-FIRST RESPONSIVE STYLESHEET: responsive-mobile.css
 * Project: Jonathan & Julene's Wedding Platform
 * Mobile Architecture: Native App-Like Experience, Samsung Galaxy Focus & iOS Precision
 * Base Target: 320px Mobile-First with Progressive Breakpoints to 768px Tablet Handoff
 * ============================================================================
 *
 * TABLE OF CONTENTS:
 *  1. VARIABLES & MOBILE DESIGN TOKENS (:root Custom Properties, Safe Areas)
 *  2. MOBILE BASE & RESET (Touch-action, tap highlight, 100dvh, iOS auto-zoom prevention)
 *  3. APP-LIKE BEHAVIOURS (Safe areas, gesture bars, overscroll, keyboard adaptation)
 *  4. MOBILE LAYOUT & CONTAINERS (Fluid padding, centered wrappers, flexible heights)
 *  5. MOBILE COMPONENT ADAPTATIONS (Header, Monogram, Hero, Countdown, Story, Timeline,
 *     Venue Card, RSVP Form, Photo Upload Card, Admin Metrics, Gallery Projector)
 *  6. SAMSUNG GALAXY & FOLDABLE OPTIMIZATIONS (Z Fold Cover & Inner, Z Flip Flex Mode,
 *     Forced Dark Mode Protection, 130%-200% Font Scaling Resilience, Edge Panels)
 *  7. PROGRESSIVE MOBILE BREAKPOINTS:
 *     - Base : 320px (Smallest Android, iPhone SE 1st Gen)
 *     - 360px : Samsung Galaxy S22/S23/S24, Galaxy A14/A13/A03, Galaxy S10e
 *     - 375px : iPhone SE 2/3, iPhone 12/13 Mini
 *     - 384px : Galaxy S23 Ultra / S24+ Class
 *     - 390px : iPhone 12/13/14, iPhone 15/16/15 Pro (393px)
 *     - 412px : Galaxy S20/S21/S24 Ultra, Galaxy A54/A53, Galaxy Z Flip, Pixel 7/8
 *     - 430px : iPhone 14/15 Plus, 15/16 Pro Max (440px)
 *     - 480px : Large Phablets & Compact Handhelds
 *     - 600px : Foldable Inner Displays (Galaxy Z Fold 673px), Small Tablets
 *     - 768px : Tablet Handoff & Desktop Join
 *  8. MOBILE LANDSCAPE RULES (@media orientation: landscape and max-height: 500px)
 *  9. PWA & STANDALONE DISPLAY MODE (@media display-mode: standalone)
 * 10. ACCESSIBILITY, CONTRAST & MOTION (Reduced motion, color schemes, high contrast)
 * ============================================================================
 */

/* ============================================================================
   1. VARIABLES & MOBILE DESIGN TOKENS
   ============================================================================ */
:root {
  /* Safe Area Insets with Safe Hardware Fallbacks */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);

  /* Dynamic Viewport Units for Mobile Browsers (Chrome, Safari, Samsung Internet) */
  --vh-100: 100vh;
  --dvh-100: 100dvh;
  --svh-100: 100svh;

  /* Touch Target Standards (Android Material 48px, Apple HIG 44px) */
  --min-touch-target: 44px;
  --samsung-touch-target: 48px;

  /* Fluid Spacing Scale for Small Screens */
  --mob-space-3xs: clamp(0.2rem, 1vw, 0.35rem);
  --mob-space-2xs: clamp(0.35rem, 1.5vw, 0.5rem);
  --mob-space-xs:  clamp(0.5rem, 2vw, 0.75rem);
  --mob-space-sm:  clamp(0.75rem, 2.5vw, 1rem);
  --mob-space-md:  clamp(1rem, 3.5vw, 1.5rem);
  --mob-space-lg:  clamp(1.5rem, 5vw, 2rem);
  --mob-space-xl:  clamp(2rem, 7vw, 3rem);

  /* Fluid Mobile Typography Scale */
  --mob-font-hero-names: clamp(2.1rem, 8.5vw, 3.4rem);
  --mob-font-hero-sub:   clamp(1.05rem, 4vw, 1.35rem);
  --mob-font-section-h2: clamp(1.6rem, 6vw, 2.25rem);
  --mob-font-card-h3:    clamp(1.2rem, 4.5vw, 1.5rem);
  --mob-font-body:       clamp(0.925rem, 3.2vw, 1.05rem);
  --mob-font-meta:       clamp(0.75rem, 2.6vw, 0.875rem);
  --mob-font-input:      16px; /* Strict 16px minimum prevents iOS viewport auto-zoom */

  /* Explicit UI Palette for Samsung Forced-Dark Protection */
  --mob-gold-savannah: #d4a359;
  --mob-gold-light: #f7edd8;
  --mob-copper-earth: #c87d55;
  --mob-bush-green: #243d2c;
  --mob-bush-green-dark: #16261b;
  --mob-sandstone-bg: #f9f5ef;
  --mob-sandstone-card: #ffffff;
  --mob-charcoal: #1c211e;
  --mob-text-muted: #5e6660;

  /* App Card Radius & Shadow */
  --mob-radius: 16px;
  --mob-radius-sm: 12px;
  --mob-radius-pill: 9999px;
  --mob-sheet-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}

/* ============================================================================
   2. MOBILE BASE & RESET
   ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  font-size: var(--mob-font-body);
  line-height: 1.55;
  touch-action: manipulation;
  color: var(--mob-charcoal);
  background-color: var(--mob-sandstone-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent auto-zoom on iOS when tapping inputs */
input,
textarea,
select,
button {
  font-size: var(--mob-font-input) !important;
  font-family: inherit;
  max-width: 100%;
  touch-action: manipulation;
}

/* Replaced Media Elements Resilience */
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* UI Chrome selection isolation (allows content selection, protects UI buttons) */
.nav-brand,
.nav-links,
.nav-rsvp-btn,
.hero-btn,
.countdown-box,
.timeline-time,
.btn-map,
.submit-rsvp-btn,
.submit-btn,
.action-btn,
.mode-tab-btn,
.tab-btn,
.star-badge,
.badge,
.ctrl-btn {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ============================================================================
   3. APP-LIKE BEHAVIOURS
   ============================================================================ */
/* Top Header with Safe Area Notch & Punch-hole Handling */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding-top: max(12px, var(--sat));
  padding-bottom: 12px;
  padding-left: max(16px, var(--sal));
  padding-right: max(16px, var(--sar));
  background: rgba(249, 245, 239, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212, 163, 89, 0.3);
}

/* Bottom Safe Area Inset Padding on Body and Modals */
.footer {
  padding-bottom: max(32px, calc(var(--sab) + 20px));
  padding-left: max(16px, var(--sal));
  padding-right: max(16px, var(--sar));
}

/* Modal and Bottom Sheet Scroll Containment */
.lightbox,
.slideshow-modal,
.pin-modal {
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  padding: max(16px, var(--sat)) max(16px, var(--sar)) max(24px, var(--sab)) max(16px, var(--sal));
}

/* ============================================================================
   4. MOBILE LAYOUT & CONTAINERS
   ============================================================================ */
.section-wrap {
  width: 100%;
  max-width: 100vw;
  padding-top: var(--mob-space-lg);
  padding-bottom: var(--mob-space-lg);
  padding-left: max(16px, calc(var(--sal) + 12px));
  padding-right: max(16px, calc(var(--sar) + 12px));
}

.container {
  width: 100%;
  max-width: 100vw;
  padding-left: max(14px, var(--sal));
  padding-right: max(14px, var(--sar));
}

/* ============================================================================
   5. MOBILE COMPONENT ADAPTATIONS
   ============================================================================ */

/* Navigation Links on Mobile */
.nav-links {
  display: flex;
  gap: var(--mob-space-xs);
  align-items: center;
}

.nav-links a {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 8px;
  min-height: var(--min-touch-target);
  display: inline-flex;
  align-items: center;
}

.nav-rsvp-btn {
  padding: 8px 14px !important;
  font-size: 13px !important;
  min-height: var(--min-touch-target);
}

/* Hero Section on Tall Modern Phones (19.5:9 / 20:9 Aspect Ratios) */
.hero {
  min-height: 92vh;
  min-height: 92svh;
  min-height: 92dvh;
  padding-top: calc(var(--sat) + 76px);
  padding-bottom: max(36px, calc(var(--sab) + 24px));
  padding-left: max(16px, var(--sal));
  padding-right: max(16px, var(--sar));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  text-align: center;
}

.hero-names {
  font-size: var(--mob-font-hero-names);
  line-height: 1.08;
  margin-bottom: var(--mob-space-2xs);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.hero-subtitle {
  font-size: var(--mob-font-hero-sub);
  margin-bottom: var(--mob-space-sm);
  padding: 0 8px;
}

.hero-date-badge {
  font-size: 12.5px;
  padding: 8px 14px;
  margin-bottom: var(--mob-space-md);
  line-height: 1.4;
  max-width: 95vw;
}

/* Countdown Grid on Small Screens */
.countdown-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin-bottom: var(--mob-space-md);
}

.countdown-box {
  min-width: 0;
  padding: 10px 4px;
  border-radius: var(--mob-radius-sm);
  text-align: center;
}

.countdown-number {
  font-size: clamp(1.4rem, 6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.1;
}

.countdown-label {
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.hero-btn {
  width: 100%;
  max-width: 320px;
  min-height: var(--samsung-touch-target);
  padding: 14px 20px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Section Headers */
.section-header {
  margin-bottom: var(--mob-space-md);
}

.section-header h2 {
  font-size: var(--mob-font-section-h2);
  line-height: 1.15;
}

/* Story Card */
.story-card {
  padding: var(--mob-space-md) var(--mob-space-sm);
  border-radius: var(--mob-radius);
}

.story-card p {
  font-size: clamp(1.05rem, 4vw, 1.25rem);
  line-height: 1.7;
}

/* Schedule Timeline (Single Column Mobile Stream) */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.timeline-item {
  padding: 20px 16px;
  border-radius: var(--mob-radius);
  text-align: left;
}

.timeline-time {
  font-size: 12px;
  padding: 4px 10px;
  margin-bottom: 6px;
}

.timeline-title {
  font-size: var(--mob-font-card-h3);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 13.5px;
  line-height: 1.5;
}

/* Venue Card Mobile Stack */
.venue-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 18px;
  border-radius: var(--mob-radius);
}

.venue-info h3 {
  font-size: 1.5rem;
}

.venue-info p {
  font-size: 13.5px;
  line-height: 1.6;
}

.btn-map {
  width: 100%;
  min-height: var(--samsung-touch-target);
  justify-content: center;
  padding: 12px 18px;
  font-size: 14px;
}

/* RSVP Form Mobile Card */
.rsvp-section {
  padding: var(--mob-space-lg) max(14px, var(--sal));
}

.rsvp-card {
  padding: 24px 16px;
  border-radius: var(--mob-radius);
}

.attending-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.toggle-label {
  padding: 12px 8px;
  min-height: 52px;
  font-size: 13px;
  border-radius: var(--mob-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: clamp(10px, 3.1vw, 12px);
  margin-bottom: 5px;
}

.form-input,
.form-select,
.form-textarea {
  font-size: clamp(13px, 3.8vw, 16px) !important; /* shrinks with viewport */
  padding: 13px 14px;
  border-radius: var(--mob-radius-sm);
  min-height: 48px;
}

.form-textarea {
  min-height: 80px;
}

.submit-rsvp-btn {
  min-height: 52px;
  padding: 15px;
  font-size: 16px;
  border-radius: var(--mob-radius-pill);
}

/* Info Cards Mobile Stack */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-box {
  padding: 22px 18px;
  border-radius: var(--mob-radius);
  text-align: left;
}

.info-box h3 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.info-box p {
  font-size: 13.5px;
}

/* Photo Upload Mobile Suite (index.html) */
.upload-card {
  padding: 22px 16px;
  border-radius: var(--mob-radius);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.action-btn {
  padding: 14px 10px;
  min-height: 64px;
  border-radius: var(--mob-radius-sm);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.preview-item {
  border-radius: 8px;
}

.preview-remove {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 14px;
}

.submit-btn {
  min-height: 52px;
  font-size: 16px;
  border-radius: var(--mob-radius-pill);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gallery-card {
  border-radius: 12px;
}

/* Admin Command Center on Mobile (admin.html) */
.nav-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn {
  flex: 1 1 auto;
  min-height: var(--min-touch-target);
  justify-content: center;
  font-size: 12.5px;
  padding: 8px 12px;
}

.section-switcher {
  flex-direction: column;
  gap: 8px;
}

.mode-tab-btn {
  min-height: var(--samsung-touch-target);
  font-size: 13.5px;
  padding: 12px;
  justify-content: center;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-card {
  padding: 14px;
  border-radius: var(--mob-radius-sm);
  gap: 10px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.metric-data h3 {
  font-size: 20px;
}

.action-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.action-group-left {
  flex-direction: column;
  width: 100%;
}

.btn-gold,
.btn-outline,
.btn-danger-outline {
  width: 100%;
  min-height: var(--samsung-touch-target);
  justify-content: center;
}

.filter-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.search-input {
  min-width: 100%;
  min-height: 46px;
}

.filter-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.tab-btn {
  min-height: 38px;
  text-align: center;
  padding: 6px 4px;
}

.rsvp-grid,
.photo-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Live Reception Screen on Mobile (gallery.html) */
.top-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.controls {
  flex-wrap: wrap;
  gap: 8px;
}

.controls .badge,
.controls .ctrl-btn {
  flex: 1 1 auto;
  min-height: var(--min-touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

/* ============================================================================
   6. SAMSUNG GALAXY & FOLDABLE OPTIMIZATIONS
   ============================================================================ */

/* Samsung Internet Forced Dark Mode Guard */
@media (forced-colors: active) {
  .hero-names,
  .hero-subtitle,
  .story-card p,
  .timeline-title,
  .form-label {
    forced-color-adjust: auto;
  }
}

/* Samsung Large Display Zoom & Font Scaling (130% to 200% Font Scale) */
@media (min-resolution: 1dppx) {
  /* Prevent fixed height cut-offs on text containers */
  .hero-date-badge,
  .timeline-item,
  .story-card,
  .info-box,
  .rsvp-card,
  .metric-card {
    height: auto !important;
    min-height: auto;
    overflow: visible;
  }

  /* Break long names gracefully */
  .guest-name,
  .rsvp-name,
  .hero-names {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* Galaxy Z Fold Cover Screen (~344px Narrow Outer Screen) */
@media screen and (max-width: 350px) {
  .hero-names {
    font-size: 2.1rem;
    letter-spacing: 1px;
  }

  .countdown-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .attending-toggle {
    grid-template-columns: 1fr;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* Galaxy Z Fold Inner Screen (Unfolded Dual-Pane / Square-ish ~673px) */
@media screen and (min-width: 600px) and (max-width: 767px) {
  .venue-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
  }

  .timeline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .rsvp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Dual-Screen Fold Spanning (CSS Viewport Segments API) */
@media (horizontal-viewport-segments: 2) {
  .venue-card,
  .attending-toggle {
    display: grid;
    grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0);
    gap: env(viewport-segment-gap 0 0, 16px);
  }
}

/* Galaxy Z Flip Half-Open Flex Mode */
@media (vertical-viewport-segments: 2) {
  .hero {
    min-height: env(viewport-segment-height 0 0);
    padding-bottom: 20px;
  }

  .slideshow-modal {
    display: grid;
    grid-template-rows: env(viewport-segment-height 0 0) env(viewport-segment-height 0 1);
  }
}

/* ============================================================================
   7. PROGRESSIVE MOBILE BREAKPOINTS
   ============================================================================ */

/* ----------------------------------------------------------------------------
   BREAKPOINT: 360px
   Devices: Samsung Galaxy S22/S23/S24, Galaxy A14/A13/A03, Galaxy S10e
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 360px) {
  .hero-names {
    font-size: 2.45rem;
  }

  .countdown-container {
    grid-template-columns: repeat(4, 1fr);
  }

  .countdown-box {
    padding: 10px 6px;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 375px
   Devices: iPhone SE 2/3, iPhone 12/13 Mini, iPhone 8/7/6s
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 375px) {
  .hero-names {
    font-size: 2.6rem;
  }

  .section-wrap {
    padding-left: max(18px, var(--sal));
    padding-right: max(18px, var(--sar));
  }

  .countdown-number {
    font-size: 1.65rem;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 384px
   Devices: Samsung Galaxy S23 Ultra / S24+ Class
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 384px) {
  .hero-names {
    font-size: 2.75rem;
  }

  .rsvp-card,
  .upload-card {
    padding: 28px 20px;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 390px
   Devices: iPhone 12/13/14, iPhone 15/16/15 Pro (393px), iPhone 16 Pro (402px)
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 390px) {
  .hero-names {
    font-size: 2.85rem;
  }

  .hero-subtitle {
    font-size: 1.25rem;
  }

  .countdown-box {
    padding: 12px 8px;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 412px
   Devices: Galaxy S20/S21/S24 Ultra, Galaxy A54/A53, Galaxy Z Flip, Google Pixel 7/8
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 412px) {
  .hero-names {
    font-size: 3.1rem;
    letter-spacing: 2px;
  }

  .countdown-box {
    padding: 14px 10px;
  }

  .countdown-number {
    font-size: 1.85rem;
  }

  .story-card {
    padding: 32px 24px;
  }

  .gallery-grid {
    gap: 12px;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 430px
   Devices: iPhone 14 Plus, iPhone 15 Plus, iPhone 15 Pro Max, iPhone 16 Pro Max (440px)
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 430px) {
  .hero-names {
    font-size: 3.25rem;
  }

  .section-wrap {
    padding-left: max(22px, var(--sal));
    padding-right: max(22px, var(--sar));
  }

  .venue-card {
    padding: 28px 24px;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 480px
   Devices: Large Phablets & Compact Handhelds
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 480px) {
  .timeline-item {
    padding: 24px 20px;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .action-group-left {
    flex-direction: row;
  }

  .btn-gold,
  .btn-outline,
  .btn-danger-outline {
    width: auto;
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 600px
   Devices: Galaxy Z Fold Inner Screen (673px), Small Tablets
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 600px) {
  .hero-names {
    font-size: 3.6rem;
  }

  .nav-header {
    padding-left: max(32px, var(--sal));
    padding-right: max(32px, var(--sar));
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ----------------------------------------------------------------------------
   BREAKPOINT: 768px
   Devices: Tablet Handoff (Galaxy Tab S9, iPad Mini/Air/Pro) -> Desktop Bridge
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 768px) {
  .timeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .venue-card {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    padding: 36px 28px;
  }

  .info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .rsvp-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
   8. MOBILE LANDSCAPE RULES
   ============================================================================ */
@media screen and (orientation: landscape) and (max-height: 500px) {
  /* Compact Fixed Header in Landscape */
  .nav-header {
    padding-top: max(6px, var(--sat));
    padding-bottom: 6px;
    padding-left: max(20px, var(--sal));
    padding-right: max(20px, var(--sar));
  }

  .nav-brand {
    font-size: 18px;
  }

  .nav-links a {
    font-size: 12px;
    min-height: 36px;
  }

  .nav-rsvp-btn {
    padding: 4px 12px !important;
    font-size: 12px !important;
  }

  /* Compact Hero in Landscape Mode */
  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(var(--sat) + 56px);
    padding-bottom: max(20px, var(--sab));
    justify-content: center;
    gap: 8px;
  }

  .hero-monogram {
    font-size: 22px !important;
    margin-bottom: 4px !important;
  }

  .hero-tag {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .hero-names {
    font-size: 2.2rem;
    margin-bottom: 4px;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .hero-date-badge {
    font-size: 11px;
    padding: 4px 14px;
    margin-bottom: 10px;
  }

  .countdown-container {
    max-width: 320px;
    gap: 6px;
    margin-bottom: 12px;
  }

  .countdown-box {
    padding: 6px 4px;
  }

  .countdown-number {
    font-size: 1.3rem;
  }

  .countdown-label {
    font-size: 9px;
  }

  .hero-btn {
    padding: 10px 24px;
    font-size: 13.5px;
    min-height: 42px;
  }

  /* Side-by-side venue card in landscape */
  .venue-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    padding: 20px;
    gap: 16px;
  }

  /* Two-column timeline in landscape */
  .timeline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .timeline-item {
    padding: 16px 14px;
  }

  /* Compact Lightbox and Modals */
  .lightbox img,
  .slideshow-img {
    max-height: 72vh;
    max-width: 85vw;
  }

  .lightbox-close {
    top: max(10px, var(--sat));
    right: max(16px, var(--sar));
    font-size: 28px;
  }
}

/* ============================================================================
   9. PWA & STANDALONE DISPLAY MODE
   ============================================================================ */
@media (display-mode: standalone) {
  body {
    user-select: none;
    -webkit-user-select: none;
  }

  .story-card p,
  .timeline-desc,
  .venue-info p,
  .info-box p {
    user-select: text;
    -webkit-user-select: text;
  }

  .nav-header {
    padding-top: max(16px, var(--sat));
  }
}

/* ============================================================================
   10. ACCESSIBILITY, CONTRAST & MOTION
   ============================================================================ */
/* Active Touch Feedback for Touch Screens */
@media (hover: none) and (pointer: coarse) {
  .nav-rsvp-btn:active,
  .hero-btn:active,
  .btn-map:active,
  .submit-rsvp-btn:active,
  .submit-btn:active,
  .btn-gold:active,
  .action-btn:active {
    transform: scale(0.97);
    opacity: 0.92;
    transition: transform 0.1s ease, opacity 0.1s ease;
  }

  .timeline-item:active,
  .info-box:active,
  .gallery-card:active {
    transform: scale(0.985);
    transition: transform 0.12s ease;
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Preference */
@media (prefers-contrast: more) {
  .story-card,
  .timeline-item,
  .venue-card,
  .rsvp-card,
  .info-box,
  .upload-card,
  .metric-card {
    border-width: 2px !important;
    border-color: var(--mob-bush-green) !important;
  }

  .timeline-time,
  .hero-tag,
  .form-label {
    font-weight: 800 !important;
  }
}
