* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    height: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Cormorant Garamond', serif;
    background-color: var(--cream);
    color: var(--text-dark);
    overflow-x: hidden;
    height: 100%;
    scroll-snap-type: y proximity;
    overflow-y: scroll;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sections */
section {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

/* ======================= */
/* PAGE TRANSITION ANIMATIONS */
/* ======================= */
.fade-in-section {
    opacity: 0;
    transform: translateY(80px);
    transition: opacity 1.2s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.35s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.45s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.55s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.65s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.75s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(8) { transition-delay: 0.85s; opacity: 1; transform: translateY(0); }

/* ======================= */
/* CHESS BOARD BACKGROUND PATTERN */
/* ======================= */
/*
 * Diamond chess board pattern - ties into King & Queen theme
 * Rotated 45° to create diamond shapes, centered to align with flower
 * Applied to: Quote Section, Parents Section, RSVP Section
 *
 * TO CUSTOMIZE THE PATTERN, edit the properties below:
 * - opacity='0.03' inside the SVG (currently very subtle)
 * - --chess-size custom property (square size, default 30px)
 * - fill='%231a5f5a' (color - currently teal, use URL-encoded hex)
 */
.chess-pattern {
    --chess-size: 30px;
    /* Isolate rendering to prevent reflows */
    contain: layout style paint;
}

.chess-pattern::before {
    content: '';
    position: absolute;
    /* Expand to cover all corners after 45° rotation on any aspect ratio */
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* Simple 2x2 checkerboard: squares at (0,0) and (1,1) positions */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect width='1' height='1' fill='%231a5f5a' opacity='0.03'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%231a5f5a' opacity='0.03'/%3E%3C/svg%3E");
    background-size: calc(var(--chess-size) * 2) calc(var(--chess-size) * 2);
    background-position: center center;
    background-repeat: repeat;
    pointer-events: none;
    z-index: 1;
    /* 45° rotation for diamond pattern, centered on the section */
    transform: rotate(45deg) translateZ(0);
    transform-origin: center center;
    /* Performance optimizations */
    backface-visibility: hidden;
    will-change: auto;
    /* Hint browser to cache this layer */
    content-visibility: auto;
    /* Start invisible, fade in when loaded */
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

/* Show pattern once initialized */
.chess-pattern.pattern-loaded::before {
    opacity: 1;
}
