/* ============================================================================
   ELLISON'S CHRISTMAS CARDS - ENHANCED STYLING
   Starry night theme with snow drifts and festive design
   ============================================================================ */

:root {
    --color-midnight: #0a0e27;
    --color-midnight-dark: #050710;
    --color-pine-green: #143628;
    --color-green-bright: #22C55E;
    --color-cream: #FAF7F0;
    --color-crimson: #B91C1C;
    --color-red-bright: #EF4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-midnight);
    color: var(--color-cream);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.site-credits {
    position: relative;
    padding: 0.75rem 1rem;
    text-align: center;
}

.credits-link {
    color: #b6bbc9;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}

.credits-dialog {
    position: fixed;
    inset: 0;
    width: min(90vw, 26rem);
    max-height: 90vh;
    margin: auto;
    padding: 1.5rem;
    overflow-y: auto;
    border: 1px solid rgba(250, 247, 240, 0.3);
    border-radius: 0.75rem;
    background: var(--color-midnight);
    color: var(--color-cream);
}

.credits-dialog::backdrop {
    background: rgba(0, 0, 0, 0.75);
}

.credits-dialog h2 {
    font-size: 1.25rem;
    font-weight: bold;
}

.credits-dialog p {
    margin-top: 1rem;
}

.credits-dialog a {
    color: #a7f3d0;
    text-decoration: underline;
}

.credits-dialog form {
    margin-top: 1.25rem;
}

/* ============================================================================
   STARFIELD BACKGROUND
   ============================================================================ */

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#stars-container {
    background: radial-gradient(circle at center, transparent 0%, var(--color-midnight-dark) 100%);
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
}

.star-small { 
    width: 1px; 
    height: 1px; 
    opacity: 0.6;
    animation: twinkle 3s infinite;
}

.star-medium { 
    width: 2px; 
    height: 2px; 
    opacity: 0.8;
    animation: twinkle 4s infinite;
}

.star-large { 
    width: 3px; 
    height: 3px; 
    opacity: 1;
    animation: shimmer 5s infinite;
}

/* ============================================================================
   SNOW EFFECTS & DRIFTS
   ============================================================================ */

@keyframes snowfall {
    0% {
        transform: translateY(-100vh) translateX(0);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) translateX(30px);
        opacity: 0;
    }
}

@keyframes sway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(20px); }
}

.snowflake {
    position: fixed;
    top: -10px;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.8;
    animation: snowfall 10s linear infinite;
}

.snowflake:nth-child(odd) {
    animation: snowfall 12s linear infinite, sway 4s ease-in-out infinite;
}

/* Snow Drifts on Elements */
.drift-container {
    position: relative;
    overflow: hidden;
}

.drift-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: linear-gradient(to top, rgba(250, 247, 240, 0.4), transparent);
    pointer-events: none;
    animation: drift-accumulate 20s ease-in-out infinite;
}

@keyframes drift-accumulate {
    0%, 90% { height: 0; }
    100% { height: 15px; }
}

/* ============================================================================
   COLOR SCHEME & UTILITIES
   ============================================================================ */

.bg-midnight {
    background-color: var(--color-midnight);
}

.bg-midnight-dark {
    background-color: var(--color-midnight-dark);
}

.bg-pine-green {
    background-color: var(--color-pine-green);
}

.bg-cream {
    background-color: var(--color-cream);
}

.bg-crimson {
    background-color: var(--color-crimson);
}

.bg-red {
    background-color: var(--color-red-bright);
}

.bg-green {
    background-color: var(--color-green-bright);
}

.text-red {
    color: var(--color-red-bright);
}

.text-green {
    color: var(--color-green-bright);
}

/* ============================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ============================================================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-red-bright);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    background-color: var(--color-crimson);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--color-crimson);
    color: white;
    box-shadow: 0 4px 15px rgba(185, 28, 28, 0.3);
}

.btn-secondary:hover {
    background-color: #A81717;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(185, 28, 28, 0.4);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-cream);
    border: 2px solid var(--color-cream);
}

.btn-outline:hover {
    background-color: rgba(250, 247, 240, 0.1);
    transform: translateY(-2px);
}

/* ============================================================================
   CARDS & CONTAINERS
   ============================================================================ */

.card {
    background: linear-gradient(135deg, rgba(20, 54, 40, 0.8), rgba(20, 54, 40, 0.5));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.1);
    transform: translateY(-4px);
}

.card-thumbnail {
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 2px solid var(--color-green-bright);
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
}

.card-thumbnail.selected {
    border-color: var(--color-green-bright);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */

input, textarea, select {
    background-color: rgba(250, 247, 240, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--color-cream);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

input::placeholder,
textarea::placeholder {
    color: rgba(250, 247, 240, 0.6);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-green-bright);
    background-color: rgba(250, 247, 240, 0.15);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

/* ============================================================================
   PAGE LAYOUTS
   ============================================================================ */

.page-container {
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

.splash-hero {
    text-align: center;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(180deg, rgba(20, 54, 40, 0.3), transparent);
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.splash-hero h1 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    color: var(--color-green-bright);
}

.splash-hero h1.heading-glow {
    color: var(--color-green-bright);
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(34, 197, 94, 0.5),
        0 0 40px rgba(34, 197, 94, 0.3);
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        text-shadow: 
            0 2px 10px rgba(0, 0, 0, 0.5),
            0 0 20px rgba(34, 197, 94, 0.5),
            0 0 40px rgba(34, 197, 94, 0.3);
    }
    50% {
        text-shadow: 
            0 2px 10px rgba(0, 0, 0, 0.5),
            0 0 30px rgba(34, 197, 94, 0.7),
            0 0 60px rgba(34, 197, 94, 0.5);
    }
}

.splash-hero p {
    font-size: 0.875rem;
    color: var(--color-green-bright);
    margin-bottom: 1rem;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.splash-info {
    max-width: 100%;
    margin: 0 auto 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(20, 54, 40, 0.5), rgba(10, 14, 39, 0.5));
    border-left: 4px solid var(--color-red-bright);
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.buy-page-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

@media (max-width: 1024px) {
    .buy-page-container {
        grid-template-columns: 1fr;
    }
}

.card-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .card-grid-compact {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.5s ease-out;
}

/* ============================================================================
   3D CARD FLIP (RECIPIENT VIEW)
   ============================================================================ */

.recipient-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}

.envelope-scene {
    width: min(100%, 560px);
    margin: 0 auto 1.5rem;
}

.envelope-front {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1.6;
    border: 1px solid #d5c7ac;
    border-radius: 0.35rem;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.72), transparent 70%),
        linear-gradient(145deg, #fffdf7, #f1e7d5);
    box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.3), 0 0.2rem 0.4rem rgba(0, 0, 0, 0.12);
}

.envelope-front::after {
    position: absolute;
    z-index: 3;
    inset: 0.45rem;
    border: 1px solid rgba(151, 123, 82, 0.18);
    border-radius: 0.15rem;
    content: "";
    pointer-events: none;
}

.envelope-address {
    position: absolute;
    z-index: 2;
    top: 27%;
    left: 10%;
    width: 65%;
    text-align: left;
}

.envelope-address-label {
    display: block;
    margin-bottom: 0.2rem;
    color: #806b4e;
    font-size: clamp(0.55rem, 1.5vw, 0.7rem);
    font-weight: 700;
    letter-spacing: 0.22em;
}

.envelope-recipient {
    display: block;
    color: #283d32;
    font-family: "Segoe Script", "Bradley Hand", "Apple Chancery", "Comic Sans MS", cursive;
    font-size: clamp(1.35rem, 4.2vw, 2.1rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.envelope-address-rule {
    display: block;
    width: 78%;
    height: 1px;
    margin-top: 0.35rem;
    background: rgba(91, 77, 59, 0.38);
}

.envelope-stamp {
    position: absolute;
    z-index: 2;
    top: 6%;
    right: 7%;
    width: clamp(3rem, 11vw, 4.5rem);
    transform: rotate(1deg);
    filter: drop-shadow(0 0.2rem 0.18rem rgba(45, 31, 20, 0.28));
}

.envelope-stamp img {
    display: block;
    width: 100%;
    height: auto;
}

.recipient-cta {
    margin-top: clamp(0.75rem, 4vh, 2.5rem);
    text-align: center;
    color: var(--color-cream);
}

@media (max-width: 480px) {
    .envelope-address {
        top: 29%;
        width: 68%;
    }

    .envelope-recipient {
        font-size: clamp(1.15rem, 6vw, 1.65rem);
    }
}

.recipient-cta p {
    margin-bottom: 0.75rem;
}

.card-flip-container {
    perspective: 1000px;
    margin: 0 auto;
}

.card-flip-landscape {
    width: min(100%, 680px, calc(70vh * 1.42));
    aspect-ratio: 1.42;
}

.card-flip-portrait {
    width: min(100%, 400px, calc(70vh * 0.698));
    aspect-ratio: 0.698;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip-inner.flipped {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.25rem;
    text-align: center;
}

.card-flip-front {
    background: var(--color-cream);
    color: var(--color-midnight);
    padding: 0.5rem;
}

.card-flip-back {
    background: linear-gradient(135deg, var(--color-cream), #FFF8E1);
    color: var(--color-midnight);
    padding: 0.5rem;
    transform: rotateY(180deg);
}

.recipient-message {
    width: 100%;
    height: 100%;
    padding: 1em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1em;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 1.125rem;
    line-height: 1.3;
}

.recipient-message > div {
    flex-shrink: 0;
}

.recipient-greeting {
    font-weight: bold;
    margin-bottom: 0.5em;
}

.recipient-message-text {
    white-space: pre-wrap;
}

.recipient-signoff p:first-child {
    font-weight: bold;
}

.card-flip-front img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================================================================
   ENVELOPE ANIMATION
   ============================================================================ */

@keyframes envelopeOpen {
    0% {
        transform: scaleY(1);
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: scaleY(0.95) translateY(-20px);
        opacity: 0;
    }
}

.envelope-flap {
    animation: envelopeOpen 0.8s ease-out forwards;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .splash-hero h1 {
        font-size: 2.5rem;
    }

    .splash-hero p {
        font-size: 1.25rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .buy-page-container {
        gap: 1.5rem;
    }

    .btn {
        width: 100%;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.glassmorphism {
    background: linear-gradient(135deg, rgba(20, 54, 40, 0.1), rgba(10, 14, 39, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(10px);
}

.glow-gold {
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.frost-effect {
    background: linear-gradient(135deg, rgba(250, 247, 240, 0.05), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(250, 247, 240, 0.1);
    backdrop-filter: blur(20px);
}
