:root {
    --color-bg: #FFFAFA;
    --color-cream: #FFF2F2;
    --color-pink-light: #FADADA;
    --color-pink: #E8A0A0;
    --color-pink-medium: #C85052;
    --color-pink-dark: #820001;
    --color-primary: #620001;
    --color-text: #320809;
    --color-text-light: #6E2D2F;
    --color-white: #FFFFFF;
    --color-shadow: rgba(98, 0, 1, 0.12);
    --shadow-soft: 0 4px 20px var(--color-shadow);
    --shadow-medium: 0 8px 32px var(--color-shadow);
    --shadow-hover: 0 16px 48px rgba(98, 0, 1, 0.2);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Montserrat', -apple-system, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 4rem 1rem 3rem;
    background: linear-gradient(180deg, var(--color-pink-light) 0%, transparent 100%);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    animation: fadeInDown 0.8s ease-out;
}

.subtitle {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 400;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.heart-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    animation: fadeIn 1s ease-out 0.4s both;
}

.heart-divider span {
    display: block;
    height: 1px;
    width: 60px;
    background: linear-gradient(90deg, transparent, var(--color-pink-medium), transparent);
}

.heart-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
    animation: pulse 2s ease-in-out infinite;
}

.main-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0;
}

.polaroid-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    animation: cardAppear 0.5s ease-out both;
}

.polaroid-card:hover {
    transform: translateY(-8px) rotate(1deg);
    box-shadow: var(--shadow-hover);
}

.polaroid-card:nth-child(even):hover {
    transform: translateY(-8px) rotate(-1deg);
}

.polaroid-image-wrapper {
    position: relative;
    overflow: hidden;
    background: var(--color-cream);
}

.polaroid-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.polaroid-card:hover .polaroid-image {
    transform: scale(1.05);
}

.polaroid-content {
    padding: 1.25rem;
    background: var(--color-white);
    position: relative;
}

.polaroid-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-pink-light), transparent);
}

.polaroid-message {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    text-align: center;
    word-break: break-word;
}

.polaroid-date {
    font-size: 0.85rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.polaroid-date svg {
    width: 14px;
    height: 14px;
    color: var(--color-pink-medium);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1rem;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(92, 74, 74, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--color-pink-light);
    transform: rotate(90deg);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--color-text);
}

.modal-image-container {
    width: 100%;
    background: var(--color-cream);
    display: flex;
    justify-content: center;
    align-items: center;
}

#modal-image {
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    display: block;
}

.modal-info {
    padding: 1.5rem;
    text-align: center;
}

.modal-message {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.modal-date {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(0deg, var(--color-pink-light) 0%, transparent 100%);
}

.footer p {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-text-light);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 2.5rem 1rem 2rem;
    }

    .title {
        font-size: clamp(2rem, 10vw, 3rem);
        margin-bottom: 0.25rem;
    }

    .subtitle {
        font-size: clamp(0.95rem, 4vw, 1.2rem);
        margin-bottom: 1rem;
    }

    .heart-divider span {
        width: 40px;
    }

    .heart-icon {
        width: 20px;
        height: 20px;
    }

    .main-content {
        padding: 0 1rem 3rem;
    }

    .timeline {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }

    .polaroid-image {
        height: 220px;
    }

    .polaroid-content {
        padding: 1rem;
    }

    .polaroid-date {
        font-size: 0.8rem;
    }

    .modal {
        padding: 0.75rem;
    }

    .modal-content {
        max-height: 85vh;
        border-radius: var(--radius-md);
    }

    .modal-close {
        width: 36px;
        height: 36px;
        top: 0.75rem;
        right: 0.75rem;
    }

    #modal-image {
        max-height: 65vh;
    }

    .modal-info {
        padding: 1.25rem;
    }

    .modal-message {
        font-size: 1.05rem;
    }

    .modal-date {
        font-size: 0.85rem;
    }

    .footer {
        padding: 1.5rem;
    }

    .footer p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 2rem 1rem 1.5rem;
        padding-top: max(2rem, env(safe-area-inset-top));
    }

    .footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    .heart-divider {
        gap: 0.75rem;
    }

    .heart-divider span {
        width: 30px;
    }

    .main-content {
        padding: 0 0.75rem 2.5rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .timeline {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .polaroid-card {
        max-width: 340px;
        margin: 0 auto;
    }

    .polaroid-image {
        height: 260px;
    }

    .polaroid-content {
        padding: 0.875rem;
    }

    .polaroid-message {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .modal {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .modal-content {
        max-height: 90vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-bottom: 0;
        transform: translateY(100%);
    }

    .modal.active .modal-content {
        transform: translateY(0);
    }

    .modal-close {
        width: 32px;
        height: 32px;
        top: 0.5rem;
        right: 0.5rem;
    }

    #modal-image {
        max-height: 70vh;
    }

    .modal-info {
        padding: 1rem 1.25rem 1.5rem;
    }

    .modal-message {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .footer p {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .header {
        padding: 1.5rem 0.75rem 1.25rem;
    }

    .title {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .polaroid-image {
        height: 240px;
    }
}

@media (min-width: 1024px) {
    .main-content {
        padding: 0 2rem 5rem;
    }

    .timeline {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    .polaroid-image {
        height: 300px;
    }
}

@media (min-width: 1400px) {
    .main-content {
        max-width: 1400px;
    }

    .timeline {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }

    .polaroid-image {
        height: 320px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .polaroid-card:hover {
        transform: none;
        box-shadow: var(--shadow-soft);
    }

    .polaroid-card:nth-child(even):hover {
        transform: none;
        box-shadow: var(--shadow-soft);
    }

    .polaroid-card:hover .polaroid-image {
        transform: none;
    }

    .polaroid-card:active {
        transform: scale(0.98);
        box-shadow: var(--shadow-medium);
    }
}
