/**
 * Responsive Design - Mobile-First Optimization
 * Touch targets >= 44px, Safe-area insets, Dynamic Type
 */

/* Safe-area insets */
.stage {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.sound-toggle {
    top: max(20px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
    min-height: 44px;
}

/* Mobile Screens (< 480px) */
@media (max-width: 480px) {
    .envelope-wrapper {
        width: 290px;
        height: 200px;
    }

    .envelope-card {
        width: 255px;
        height: 180px;
        left: 17px;
        top: 25px;
        padding: 12px 10px;
    }

    .envelope-card-text {
        font-size: 11.5px;
        line-height: 1.3;
        margin-bottom: 8px;
        max-width: 225px;
    }

    .letter-action-btn {
        padding: 6px 14px;
        font-size: 11.5px;
    }

    .pocket-left {
        border-width: 200px 0 0 145px;
    }

    .pocket-right {
        border-width: 200px 145px 0 0;
    }

    .pocket-bottom {
        border-width: 0 145px 115px 145px;
    }

    .envelope-flap {
        border-width: 120px 145px 0 145px;
    }

    .flap-gold-edge {
        top: -120px;
        left: -145px;
        width: 290px;
        height: 120px;
    }

    .wax-seal {
        top: 90px;
        width: 48px;
        height: 48px;
    }

    .seal-inner {
        width: 32px;
        height: 32px;
    }

    .seal-emblem {
        font-size: 16px;
    }

    .photo-stack {
        width: 270px;
        height: 360px;
    }

    .messages-card-box {
        padding: 28px 20px;
    }

    .btn-primary {
        min-height: 52px;
        width: 100%;
    }

    .gallery-actions {
        width: 100%;
        justify-content: center;
    }

    .climax-award-card {
        padding: 28px 18px 26px 18px;
    }

    .climax-portrait-frame {
        width: 145px;
        height: 145px;
        margin-bottom: 14px;
    }

    .climax-heading {
        font-size: clamp(1.3rem, 5.2vw, 1.8rem) !important;
        letter-spacing: 0.03em !important;
    }

    .climax-name {
        font-size: 1.6rem;
    }

    .climax-countdown-widget {
        max-width: 100%;
        padding: 8px 12px;
        margin: 4px auto 10px auto;
    }

    .climax-countdown-digit {
        font-size: 2.2rem;
    }

    .hero-title-badge {
        margin-bottom: 10px;
    }

    .hero-main-title {
        font-size: clamp(1.5rem, 5.2vw, 2rem);
    }

    .hero-frame-wrapper {
        max-width: 270px;
        margin-bottom: 12px;
    }

    .hero-actions {
        width: 100%;
        max-width: 310px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .hero-replay-prominent {
        min-height: 48px;
        font-size: 13.5px;
        padding: 11px 16px;
        white-space: nowrap;
    }

    .funny-joke-text {
        font-size: 12.5px;
        max-width: 280px;
    }
}

/* Compact Mobile Viewport Height (< 720px) */
@media (max-height: 720px) {
    .stage {
        padding: 12px 14px;
    }

    .photo-stack {
        width: 240px;
        height: 310px;
        margin-bottom: 12px;
    }

    .photo-caption-box {
        min-height: 44px;
        margin-bottom: 8px;
    }

    .timeline-dots-wrapper {
        margin-bottom: 12px;
        padding: 5px 12px;
    }

    .messages-card-box {
        padding: 18px 16px;
    }

    .msg-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .msg-body {
        font-size: 14.5px;
        margin-bottom: 16px;
        min-height: 54px;
    }

    .climax-award-card {
        padding: 22px 16px 20px 16px;
    }

    .climax-cert-header {
        margin-bottom: 14px;
        font-size: 9.5px;
        padding: 3px 14px;
    }

    .climax-portrait-frame {
        width: 120px;
        height: 120px;
        margin-bottom: 10px;
    }

    .climax-heading {
        font-size: clamp(1.2rem, 3.8vw, 1.7rem) !important;
    }

    .climax-subheading {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .climax-name {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .climax-meta-pills {
        gap: 5px;
        margin-bottom: 10px;
    }

    .climax-honor-badge {
        font-size: 11px;
        padding: 4px 16px;
    }

    .climax-degree {
        font-size: 12px;
        padding: 4px 14px;
    }

    .climax-quote-container {
        margin: 8px auto 10px auto;
        padding: 8px 14px;
    }

    .climax-quote {
        font-size: 12px;
    }

    .climax-official-stamp {
        width: 68px;
        height: 68px;
        margin: 2px auto 12px auto;
    }

    .climax-actions {
        gap: 8px;
    }

    .btn-whatsapp {
        min-height: 44px;
        font-size: 13.5px;
    }

    .climax-countdown-widget {
        padding: 5px 10px;
        margin: 2px auto 6px auto;
    }

    .climax-countdown-digit {
        font-size: 1.8rem;
    }

    .hero-title-badge {
        margin-bottom: 6px;
    }

    .hero-main-title {
        font-size: 1.5rem;
    }

    .hero-frame-wrapper {
        max-width: 210px;
        margin-bottom: 8px;
    }

    .hero-info-box {
        margin-bottom: 8px;
    }

    .hero-name {
        font-size: 1.35rem;
    }

    .hero-motto {
        font-size: 11.5px;
    }

    .funny-joke-text {
        font-size: 11.5px;
        line-height: 1.35;
        max-width: 280px;
        margin-top: 4px;
    }

    .hero-degree-meta {
        font-size: 11.5px;
        margin: 2px 0;
    }
}

/* Very Small Devices (< 360px) */
@media (max-width: 360px) {
    .envelope-wrapper {
        transform: scale(0.85);
    }
    
    .photo-stack {
        width: 230px;
        height: 300px;
    }

    .climax-award-card {
        padding: 18px 12px 16px 12px;
    }

    .climax-portrait-frame {
        width: 105px;
        height: 105px;
        margin-bottom: 8px;
    }

    .climax-heading {
        font-size: 1.15rem !important;
    }

    .climax-name {
        font-size: 1.35rem;
    }

    .climax-quote {
        font-size: 11.5px;
    }

    .climax-countdown-digit {
        font-size: 1.7rem;
    }

    .hero-main-title {
        font-size: 1.35rem;
    }

    .hero-frame-wrapper {
        max-width: 190px;
    }
}

/* Tablets and Desktops (>= 768px) */
@media (min-width: 768px) {
    .envelope-wrapper {
        width: 360px;
        height: 250px;
    }

    .envelope-card {
        width: 316px;
        height: 205px;
        left: 22px;
        top: 36px;
        padding: 18px 16px;
    }

    .envelope-card-text {
        font-size: 14px;
        margin-bottom: 12px;
        max-width: 270px;
    }

    .letter-action-btn {
        padding: 8px 20px;
        font-size: 13px;
    }

    .pocket-left {
        border-width: 250px 0 0 180px;
    }

    .pocket-right {
        border-width: 250px 180px 0 0;
    }

    .pocket-bottom {
        border-width: 0 180px 145px 180px;
    }

    .envelope-flap {
        border-width: 150px 180px 0 180px;
    }

    .flap-gold-edge {
        top: -150px;
        left: -180px;
        width: 360px;
        height: 150px;
    }

    .wax-seal {
        top: 112px;
        width: 62px;
        height: 62px;
    }

    .photo-stack {
        width: 330px;
        height: 440px;
    }

    .climax-award-card {
        padding: 44px 36px 40px 36px;
    }

    .climax-portrait-frame {
        width: 185px;
        height: 185px;
        margin-bottom: 22px;
    }

    .hero-frame-wrapper {
        max-width: 380px;
        margin-bottom: 22px;
    }

    .hero-showcase-container {
        max-width: 500px;
    }
}

