/* ══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════ */

/* ── Tablet ── */
@media (max-width: 1024px) {
  #hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 100px 8vw 60px;
    min-height: auto;
  }

  .hero-ornament {
    display: none;
  }

  .hero-left {
    max-width: 100%;
    text-align: center;
  }

  .hero-desc {
    max-width: 100%;
    margin: 0 auto;
  }

  .hero-right {
    max-width: 420px;
    width: 70%;
    margin: 0 auto;
    margin-bottom: 30px;
  }

  .event-badge {
    bottom: -16px;
    right: -10px;
    padding: 18px 16px;
  }

  /* Story section */
  .story-container {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .story-photos {
    max-width: 500px;
    margin: 0 auto;
  }

  /* Countdown */
  .countdown-unit {
    min-width: 80px;
  }

  #details {
    grid-template-columns: 1fr;
    margin: 0 6vw;
  }

  #rsvp {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 80px 6vw;
  }

  .rsvp-header {
    position: static;
    text-align: center;
  }

  .section-desc {
    max-width: 100%;
    margin: 0 auto;
  }

  .rsvp-steps {
    display: none;
  }

  .rsvp-form-container {
    padding: 40px 32px;
  }

  .rsvp-deadline-nudge {
    margin: -40px -32px 40px;
    padding: 18px 24px;
  }

  footer {
    flex-direction: column;
    gap: 24px;
    text-align: center;
  }

  .footer-left {
    align-items: center;
  }

  .footer-note {
    text-align: center;
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  /* Disable GPU-heavy grain overlay on mobile */
  .grain {
    display: none;
  }

  #hero {
    padding: 80px 0 0;
    gap: 0;
    min-height: auto;
  }

  .hero-left {
    padding: 0 6vw 40px;
    max-width: 100%;
  }

  .hero-title {
    font-size: clamp(2.2rem, 9vw, 3.5rem);
  }

  .hero-desc.personalized {
    font-size: clamp(1rem, 4vw, 1.2rem);
  }

  .invite-family {
    font-size: clamp(1.7rem, 6.5vw, 2.6rem);
    animation-name: inviteFamilyGlowMobile;
  }

  @keyframes inviteFamilyGlowMobile {
    0%, 100% { text-shadow: none; }
    50% {
      text-shadow:
        0 0 10px rgba(196, 164, 114, 0.85),
        0 0 24px rgba(196, 164, 114, 0.5),
        0 0 44px rgba(196, 164, 114, 0.22);
    }
  }

  .invite-tagline {
    font-size: 1rem;
    color: var(--gold-light);
    margin-bottom: 8px;
  }

  .hero-right {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .hero-right::before {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: var(--gold);
    opacity: 0.45;
    margin: 0 auto 0;
  }

  .hero-photo {
    width: 100%;
    margin-left: 0;
    aspect-ratio: 4 / 5;
  }

  .event-badge {
    bottom: 24px;
    right: 6vw;
    left: auto;
    padding: 20px 18px;
    font-size: 0.6rem;
    min-width: 110px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  }

  /* Story section mobile */
  #story {
    padding: 80px 6vw;
  }

  .story-container {
    gap: 40px;
  }

  .story-photos {
    gap: 10px;
  }

  .story-quote {
    font-size: clamp(1rem, 4vw, 1.3rem);
  }

  /* Countdown mobile */
  #countdown {
    padding: 60px 6vw;
  }

  .countdown-timer {
    gap: 12px;
  }

  .countdown-unit {
    min-width: 60px;
  }

  .countdown-value {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .countdown-sep {
    font-size: 1.5rem;
  }

  #details {
    margin: 0 4vw;
    gap: 0;
  }

  .detail-card {
    padding: 40px 24px;
  }

  #rsvp {
    padding: 60px 4vw;
  }

  .rsvp-form-container {
    padding: 32px 20px;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .rsvp-deadline-nudge {
    margin: -32px -20px 36px;
    padding: 16px 20px;
  }

  .rsvp-deadline-nudge .nudge-label {
    font-size: 0.65rem;
    color: var(--deep);
    opacity: 0.7;
  }

  .rsvp-deadline-nudge .nudge-date {
    font-size: clamp(1.2rem, 4.5vw, 1.5rem);
  }

  .event-card {
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 16px;
  }

  .event-card-main {
    flex-wrap: wrap;
    gap: 12px;
  }

  .event-card-info {
    min-width: 0;
    flex: 1 1 0;
  }

  .event-card-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .event-card-name {
    font-size: 1.1rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .event-card-detail {
    font-size: 0.65rem;
    white-space: normal;
    word-break: break-word;
  }

  .event-card-toggle {
    width: 100%;
    justify-content: stretch;
    flex-shrink: 0;
  }

  .event-accept,
  .event-decline {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
  }

  .gallery-item {
    width: 260px;
    height: 340px;
  }

  /* Hide custom cursor on touch devices */
  #cursor,
  #cursor-ring {
    display: none !important;
  }

  body {
    cursor: auto;
  }

  .form-input,
  .btn-primary,
  .btn-secondary,
  .back-btn,
  .event-accept,
  .event-decline,
  .family-card,
  .view-all-item,
  .toggle-switch,
  .view-all-filter {
    cursor: auto;
  }

  /* Fix form inputs on mobile */
  .form-input {
    font-size: 1.2rem;
  }

  /* Fix family card overflow */
  .family-card {
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 18px;
  }

  .family-card .family-name {
    font-size: 1.1rem;
  }

  /* View all panel fixes */
  .view-all-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .view-all-filter {
    width: 100%;
  }

  .view-all-item {
    padding: 12px 16px;
  }

  .view-all-item .item-name {
    font-size: 1rem;
  }

  /* Guest header */
  .guest-header .family-title {
    font-size: 1.6rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Guest toggles */
  .guest-toggle {
    padding: 14px 0;
  }

  .guest-toggle-name {
    font-size: 0.85rem;
  }

  /* Success screen */
  .success-title {
    font-size: 2rem;
  }

  .success-icon {
    width: 64px;
    height: 64px;
    font-size: 1.6rem;
  }

  /* Button padding fix */
  .btn-secondary {
    padding: 14px 20px;
  }

  .btn-secondary-label {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
  }

  /* Search results mobile */
  .search-results {
    margin-top: 20px;
  }

  .no-results {
    font-size: 0.8rem;
    padding: 24px 16px;
  }
}

/* ── Small mobile ── */
@media (max-width: 480px) {
  #nav {
    padding: 16px 5vw;
  }

  .nav-logo {
    font-size: 0.7rem;
    letter-spacing: 0.25em;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.55rem;
    letter-spacing: 0.15em;
  }

  #hero {
    padding: 75px 0 0;
  }

  .hero-left {
    padding: 0 5vw 36px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 10vw, 2.8rem);
  }

  .hero-label {
    font-size: 0.55rem;
    margin-bottom: 20px;
  }

  .hero-desc {
    font-size: 0.82rem;
  }

  .invite-family {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
    animation-name: inviteFamilyGlowMobile;
  }

  .invite-tagline {
    font-size: 0.95rem;
    color: var(--gold-light);
  }

  .event-badge {
    bottom: 20px;
    right: 5vw;
    padding: 16px 14px;
    font-size: 0.55rem;
    min-width: 95px;
  }

  /* Story small mobile */
  #story {
    padding: 60px 5vw;
  }

  .story-photos {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .story-quote {
    font-size: 1rem;
  }

  .story-note {
    font-size: 0.82rem;
  }

  /* Countdown small mobile */
  #countdown {
    padding: 50px 5vw;
  }

  .countdown-timer {
    gap: 8px;
  }

  .countdown-unit {
    min-width: 50px;
  }

  .countdown-value {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
  }

  .countdown-label {
    font-size: 0.45rem;
    letter-spacing: 0.25em;
  }

  .countdown-sep {
    font-size: 1.2rem;
  }

  .rsvp-form-container {
    padding: 24px 14px;
  }

  .rsvp-deadline-nudge {
    margin: -24px -14px 28px;
    padding: 14px 16px;
  }

  .btn-primary {
    padding: 16px 20px;
    font-size: 0.6rem;
    letter-spacing: 0.25em;
  }

  .btn-secondary {
    padding: 12px 16px;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
  }

  .event-card {
    padding: 16px 12px;
    gap: 10px;
  }

  .event-card-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .event-card-name {
    font-size: 1rem;
  }

  .event-accept,
  .event-decline {
    padding: 10px 8px;
    font-size: 0.55rem;
  }

  .gallery-item {
    width: 200px;
    height: 260px;
  }

  .detail-card {
    padding: 32px 16px;
  }

  .detail-value {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
  }

  .section-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .guest-header .family-title {
    font-size: 1.35rem;
  }

  .form-input {
    font-size: 1.1rem;
  }

  .form-label {
    font-size: 0.6rem;
  }

  /* Fix for iOS double-tap zoom */
  .btn-primary,
  .btn-secondary,
  .event-accept,
  .event-decline,
  .back-btn,
  .family-card,
  .view-all-item {
    touch-action: manipulation;
  }
}

/* ── Extra small (below 360px) ── */
@media (max-width: 360px) {
  #hero {
    padding: 75px 4vw 25px;
  }

  .hero-title {
    font-size: clamp(1.6rem, 9vw, 2.4rem);
  }

  .rsvp-form-container {
    padding: 20px 12px;
  }

  .rsvp-deadline-nudge {
    margin: -20px -12px 24px;
    padding: 12px 14px;
  }

  .event-card {
    padding: 14px 10px;
  }

  .btn-primary {
    padding: 14px 16px;
    font-size: 0.55rem;
  }

  .nav-logo {
    font-size: 0.6rem;
    letter-spacing: 0.15em;
  }
}

/* ── Touch device detection ── */
@media (hover: none) and (pointer: coarse) {
  #cursor,
  #cursor-ring {
    display: none !important;
  }

  body {
    cursor: auto;
  }

  /* Make tap targets minimum 44px for accessibility */
  .event-accept,
  .event-decline {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .toggle-switch {
    min-width: 48px;
    min-height: 28px;
  }

  .family-card,
  .view-all-item {
    min-height: 48px;
  }

  .nav-links a {
    padding: 8px 4px;
  }

  /* Remove hover effects on touch */
  .detail-card:hover {
    background: var(--cream);
  }

  .event-card:hover {
    box-shadow: none;
  }
}
