/* PF Jizerka 2026 - Premium Envelope Styles v5.0 (Clean Rewrite) */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Poppins:wght@400;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --pf-env-bg: #f9f4ec;
    --pf-env-bg-dark: #eee5d5;
    --pf-env-border: #e0d5c0;
    --pf-accent: #704E29;
    --pf-accent-light: #A07B4E;
    --pf-gold: #C6AA79;
    --pf-gold-dark: #A07B4E;
    --pf-red-wax: #8b2942;
    --pf-blue-cta: #6386AB;
    --pf-shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    --pf-shadow-deep: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --pf-font-main: "Poppins", "Outfit", system-ui, -apple-system, sans-serif !important;
    --pf-font-display: "Playfair Display", Georgia, serif !important;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.pf-container-2026 {
    width: 100%;
    margin: 40px 0 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 1500px;
    /* Enhanced perspective for 3D flip */
    font-family: var(--pf-font-main);
    min-height: 600px;
    /* Ensure enough space */
    position: relative;
    border-radius: 20px;
    overflow: visible;
    /* Changed from hidden to allow card slide out */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* BACKGROUND LAYERS */
.pf-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition: opacity 2.5s ease;
    z-index: 1;
}

.pf-bg-autumn {
    z-index: 1;
}

.pf-bg-winter {
    z-index: 2;
    opacity: 0;
    /* Adjusted: 90% 70% (Up 10% from 80%) */
    background-position: center 70%;
    /* Zoom out: 134% -> 120% */
    background-size: 110% auto;
}

/* Show winter bg when opened */
.pf-container-2026.pf-opened .pf-bg-winter {
    opacity: 1;
}

/* SCENE WRAPPER */
.pf-scene {
    position: relative;
    width: 100%;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    padding: 60px 20px;
}

/* HIDDEN CHECKBOX */
.pf-toggle,
#pf-toggle-2026 {
    display: none !important;
}

.pf-envelope-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================
   ENVELOPE BASE (3D Container)
   ============================================ */
.pf-envelope {
    display: block;
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1.5;
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    /* Key for 3D flip */
    z-index: 10;
}

/* FLIP ANIMATION */
.pf-toggle:checked+.pf-envelope {
    transform: rotateY(180deg);
    /* Flip only, no drop */
    cursor: default;
    pointer-events: none;
    /* Disable clicking again immediately */
}

/* Hover effect */
.pf-envelope:hover {
    transform: translateY(-5px);
}

/* ============================================
   ENVELOPE FRONT FACE
   ============================================ */
.pf-front {
    position: absolute;
    inset: 0;
    background-color: var(--pf-env-bg);
    border: 1px solid var(--pf-env-border);
    border-radius: 12px;
    z-index: 2;
    backface-visibility: hidden;
    /* Hide when flipped */
    transform-style: preserve-3d;
    box-shadow: var(--pf-shadow-soft);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* FRONT CONTENT */
.pf-stamp {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 90px;
    height: auto;
    opacity: 0.9;
    mix-blend-mode: multiply;
}

.pf-stamp-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pf-address-box {
    position: absolute;
    top: 25px;
    left: 25px;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    transform: rotate(-2deg);
}

.pf-address-to {
    font-family: "Caveat", "Brush Script MT", cursive !important;
    font-size: 24px;
    font-weight: 700;
    color: var(--pf-accent);
}

.pf-address-location {
    font-family: "Caveat", "Brush Script MT", cursive !important;
    font-size: 20px;
    color: #444;
}

.pf-teaser {
    text-align: center;
    padding: 20px;
}

.pf-teaser p {
    font-family: var(--pf-font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--pf-accent);
    margin: 0 0 8px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.pf-teaser small {
    display: block;
    font-size: 13px;
    color: #888;
    animation: pf-pulse 2s ease-in-out infinite;
}

@keyframes pf-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Wax Seal */
.pf-wax-seal {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    background: radial-gradient(circle at 30% 30%, #c93a55, var(--pf-red-wax) 60%, #6b1a2a);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(139, 41, 66, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2), inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    box-shadow: var(--pf-shadow-soft);
}

.pf-wax-seal::before {
    content: '❄';
    font-size: 28px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ============================================
   ENVELOPE BACK FACE
   ============================================ */
.pf-back {
    position: absolute;
    inset: 0;
    background-color: var(--pf-env-bg);
    border-radius: 12px;
    border: 1px solid var(--pf-env-border);
    z-index: 1;
    transform: rotateY(180deg);
    /* Pre-rotated back face */
    backface-visibility: hidden;
    overflow: visible;
    /* CRITICAL for card sliding out */
    box-shadow: var(--pf-shadow-soft);
}

/* Back Decoration (Flaps) */
.pf-back::before {
    content: '';
    position: absolute;
    bottom: 0;
    top: 0;
    left: 0;
    width: 50%;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    background: linear-gradient(135deg, #fdfbf7, #ece5d6);
    z-index: 5;
}

.pf-back::after {
    content: '';
    position: absolute;
    bottom: 0;
    top: 0;
    right: 0;
    width: 50%;
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    background: linear-gradient(-135deg, #fdfbf7, #ece5d6);
    z-index: 5;
}

/* Pocket */
.pf-pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #f2eadb, var(--pf-env-bg));
    clip-path: polygon(0% 100%, 50% 50%, 100% 100%);
    z-index: 6;
    filter: drop-shadow(0 -3px 8px rgba(0, 0, 0, 0.06));
}

/* Top Flap */
.pf-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #fffcf5, #e6decb);
    clip-path: polygon(0 0, 100% 0, 50% 50%);
    transform-origin: top center;
    z-index: 20;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s;
    /* Delay for flip */
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.08));
    backface-visibility: hidden;
}

/* Open Flap */
.pf-toggle:checked+.pf-envelope .pf-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

/* ============================================
   CARD ANIMATION AND STYLE
   ============================================ */
.pf-card {
    position: absolute;
    left: 5%;
    right: 5%;
    /* Initially inside the pocket */
    top: 5px;
    height: auto;

    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
    border-radius: 12px;

    /* Rotate because it sits in the rotated back face */
    transform: rotateY(180deg);

    z-index: 5;
    /* Below pocket/flap initially */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);

    pointer-events: none;
    backface-visibility: hidden;

    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s;
    /* Late delay */
}

/* CARD SLIDE OUT */
.pf-toggle:checked+.pf-envelope .pf-card {
    /* Slide UP relative to envelope (negative Y) and Scale UP */
    /* Note: Since we are in 3D preserve-3d, z-index helps layer it above */
    /* Reduced slide-up drastically to minimize 'jump' (-80px) */
    transform: rotateY(180deg) translateY(20px) scale(0.8);
    z-index: 100;
    /* Bring to very front */
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
}

/* Card Content Styles */
.pf-card-content {
    padding: 25px;
    opacity: 0;
    transition: opacity 0.5s ease 1.5s;
    /* Delay content appearance */
}

/* Show content when opened */
.pf-toggle:checked+.pf-envelope .pf-card .pf-card-content {
    opacity: 1;
}

.pf-card-header {
    position: relative;
    margin: -25px -25px 20px;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

.pf-card-header img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.pf-card-header h2 {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    font-family: var(--pf-font-display);
    font-size: 32px;
    color: var(--pf-accent);
    margin: 0;
    text-align: center;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.8);
    z-index: 2;
}

.pf-card-body {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    text-align: center;
}

.pf-card-body p {
    margin: 0 0 12px;
}

.pf-signature strong {
    color: var(--pf-accent);
    display: block;
    margin-top: 5px;
}

/* Close Button */
.pf-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    z-index: 20;
    transition: background 0.2s;
}

.pf-close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Snow & Confetti */
.pf-snow-container,
.pf-confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.pf-snow-container {
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.pf-container-2026.pf-opened .pf-snow-container {
    opacity: 1;
}

.pf-flake {
    position: absolute;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: pf-snow-fall linear infinite;
}

@keyframes pf-snow-fall {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(500px);
        opacity: 0;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .pf-container-2026 {
        margin: 20px 0;
        min-height: 550px;
    }

    .pf-toggle:checked+.pf-envelope {
        /* Mobile adjustment if needed, but keep rotateY(180deg) consistent */
        /* transform: rotateY(180deg) translateY(0); */
    }

    /* Adjust slide distance for mobile */
    .pf-toggle:checked+.pf-envelope .pf-card {
        /* Keep consistent with desktop or slightly tweaked, but avoid conflicting translateY jumps */
        transform: rotateY(180deg) translateY(-140px) scale(1.05);
        /* Slightly less slide on mobile */
    }

    /* Adjust grid for mobile */
    .pf-hours-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Stamp and address adjustments for mobile */
    .pf-stamp {
        top: 10px;
        right: 10px;
        width: 60px;
    }

    .pf-address-box {
        top: 12px;
        left: 12px;
    }

    .pf-address-to {
        font-size: 18px;
    }

    .pf-address-location {
        font-size: 14px;
    }

    .pf-teaser p {
        font-size: 20px;
    }

    .pf-teaser small {
        font-size: 11px;
    }

    /* Close button - larger touch target on mobile */
    .pf-close-btn {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        font-size: 20px;
        z-index: 100;
        pointer-events: auto !important;
    }

    /* Ensure card allows button overflow */
    .pf-card {
        overflow: visible !important;
    }
}

/* ============================================
   INTRO MODAL STYLES
   ============================================ */
.pf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Dark overlay */
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    /* Hidden by default via inline style */
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.pf-modal-container {
    width: 100%;
    max-width: 600px;
    position: relative;
    /* Scale down slightly on small screens to fit */
    transform-origin: center center;
}

/* Compact Card Content */
.pf-wish-compact {
    text-align: center;
    margin-bottom: 12px;
}

.pf-wish-compact p {
    font-size: 14px;
    margin: 0;
    color: #444;
}

.pf-signature-row {
    margin-top: 4px;
    color: var(--pf-accent);
    font-size: 14px;
}

.pf-divider-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0d5c0, transparent);
    margin: 10px 0 15px;
}

.pf-hours-compact {
    text-align: left;
    margin-bottom: 15px;
}

.pf-hours-title {
    font-family: var(--pf-font-display);
    font-size: 18px;
    color: var(--pf-accent);
    text-align: center;
    margin: 0 0 12px;
}

.pf-hours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    font-size: 12px;
}

.pf-hours-col h4 {
    font-size: 13px;
    color: var(--pf-accent-light);
    margin: 0 0 6px;
    border-bottom: 1px solid #eee;
    padding-bottom: 3px;
}

.pf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 3px;
    color: #555;
    line-height: 1.4;
}

.pf-row b {
    color: #222;
}

.pf-highlight-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px dashed #e0d5c0;
    color: var(--pf-gold-dark);
    white-space: nowrap;
}

.pf-btn-cta {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 10px auto 0;
    padding: 8px 0;
    background: var(--pf-accent);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-family: var(--pf-font-main);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.pf-btn-cta:hover {
    background: var(--pf-accent-light);
}

/* ============================================
   MODAL-SPECIFIC OVERRIDES
   Keep envelope but adjust sizing for modal context
   ============================================ */
#pf-intro-modal .pf-container-2026 {
    margin: 0;
    min-height: auto;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    background: none;
}

#pf-intro-modal .pf-scene {
    padding: 30px 15px;
    max-width: 100%;
}

#pf-intro-modal .pf-envelope-wrapper,
#pf-intro-modal .pf-envelope {
    width: 100%;
}

/* Hide only backgrounds in modal (not the envelope itself) */
#pf-intro-modal .pf-bg-layer {
    display: none !important;
}

/* Ensure hours grid works in modal */
#pf-intro-modal .pf-hours-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 15px !important;
}

#pf-intro-modal .pf-card-header {
    position: relative;
}

#pf-intro-modal .pf-card-header img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

#pf-intro-modal .pf-card-header h2 {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 32px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin: 0;
}

#pf-intro-modal .pf-card-body {
    padding: 18px;
}

#pf-intro-modal .pf-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    line-height: 28px;
    text-align: center;
}

/* Force grid layout for hours in modal */
#pf-intro-modal .pf-hours-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 15px !important;
    font-size: 12px;
}

#pf-intro-modal .pf-hours-col h4 {
    font-size: 13px;
    color: var(--pf-accent-light);
    margin: 0 0 6px;
    border-bottom: 1px solid #eee;
    padding-bottom: 3px;
}

#pf-intro-modal .pf-btn-cta {
    display: block;
    width: 100%;
    max-width: 180px;
    margin: 15px auto 0;
    padding: 10px 0;
    background: var(--pf-accent);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

@media (max-width: 480px) {
    #pf-intro-modal .pf-hours-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        font-size: 11px;
    }

    #pf-intro-modal .pf-hours-col h4 {
        font-size: 12px;
        margin: 0 0 4px;
    }

    #pf-intro-modal .pf-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 2px;
        white-space: nowrap;
    }

    #pf-intro-modal .pf-row span,
    #pf-intro-modal .pf-row b,
    #pf-intro-modal .pf-row i {
        flex-shrink: 0;
    }

    #pf-intro-modal .pf-highlight-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
    }

    #pf-intro-modal .pf-hours-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    #pf-intro-modal .pf-wish-compact p {
        font-size: 13px;
    }

    #pf-intro-modal .pf-btn-cta {
        padding: 8px 0;
        font-size: 12px;
        margin-top: 10px;
    }

    #pf-intro-modal .pf-card-body {
        padding: 12px;
    }
}