/* ===== CSS Variables ===== */
:root {
    --cream-50: #FDFCF8;
    --cream-100: #FAF8F3;
    
    --warm-gray-400: #9C9589;
    --warm-gray-500: #78746A;
    --warm-gray-600: #5C584F;
    --warm-gray-700: #433F38;
    --warm-gray-800: #2D2A24;
    
    --rose-50: #FFF5F7;
    --rose-100: #FFE4E8;
    --rose-200: #FECDD3;
    --rose-300: #FDA4AF;
    --rose-400: #FB7185;
    --rose-500: #F43F5E;
    --rose-600: #E11D48;
    
    --amber-100: #FEF3C7;
    --amber-200: #FDE68A;
    --amber-300: #FCD34D;
    --amber-400: #FBBF24;
    
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--cream-50);
    color: var(--warm-gray-700);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ===== Background Decorations ===== */
.bg-decorations {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.blob-1 {
    top: 5rem;
    left: 2rem;
    width: 16rem;
    height: 16rem;
    background: rgba(253, 164, 175, 0.15);
}

.blob-2 {
    top: 10rem;
    right: 5rem;
    width: 20rem;
    height: 20rem;
    background: rgba(253, 230, 138, 0.12);
}

.blob-3 {
    bottom: 5rem;
    left: 33%;
    width: 24rem;
    height: 24rem;
    background: rgba(254, 205, 211, 0.1);
}

/* ===== Header ===== */
.header {
    position: relative;
    padding: 3rem 1rem 2rem;
    z-index: 1;
}

.header-content {
    max-width: 56rem;
    margin: 0 auto;
    text-align: center;
}

.header-hearts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.heart-icon {
    font-size: 1.25rem;
    display: inline-block;
}

.sparkle-icon {
    font-size: 1.5rem;
}

.pulse-1 {
    animation: pulse 3s ease-in-out infinite;
}

.pulse-2 {
    animation: pulse 3s ease-in-out infinite 0.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(5deg); }
}

.title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    color: var(--warm-gray-800);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.subtitle {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--warm-gray-500);
    max-width: 32rem;
    margin: 0 auto;
    line-height: 1.6;
}

.title-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.divider-line {
    width: 4rem;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--rose-200));
}

.divider-line:last-child {
    background: linear-gradient(to left, transparent, var(--rose-200));
}

.divider-heart {
    font-size: 1rem;
}

/* ===== Filter Bar ===== */
.filter-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem;
    background: rgba(253, 252, 248, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(254, 205, 211, 0.3);
}

.filter-container {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warm-gray-500);
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

.filter-icon {
    width: 1rem;
    height: 1rem;
}

.filter-dropdown select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--warm-gray-700);
    background-color: rgba(255, 255, 255, 0.8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239C9589' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    border: 1px solid var(--rose-100);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.filter-dropdown select:hover {
    border-color: var(--rose-200);
    background-color: white;
    box-shadow: var(--shadow-md);
}

.filter-dropdown select:focus {
    outline: none;
    border-color: var(--rose-300);
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.1);
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rose-500);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: var(--rose-50);
    color: var(--rose-600);
}

.clear-btn svg {
    width: 1rem;
    height: 1rem;
}

.hidden {
    display: none !important;
}

/* ===== Memory Count ===== */
.memory-count {
    padding: 1rem;
    text-align: center;
}

.memory-count p {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--warm-gray-400);
}

.memory-count .highlight {
    color: var(--rose-400);
    font-weight: 500;
}

/* ===== Memory Grid ===== */
.memory-grid-container {
    padding: 0 1rem 4rem;
    max-width: 84rem;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.memory-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .memory-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== Memory Card ===== */
.memory-card {
    perspective: 1000px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.memory-card:nth-child(1) { animation-delay: 0.1s; }
.memory-card:nth-child(2) { animation-delay: 0.2s; }
.memory-card:nth-child(3) { animation-delay: 0.3s; }
.memory-card:nth-child(4) { animation-delay: 0.4s; }
.memory-card:nth-child(5) { animation-delay: 0.5s; }
.memory-card:nth-child(6) { animation-delay: 0.6s; }
.memory-card:nth-child(7) { animation-delay: 0.7s; }
.memory-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    transform-style: preserve-3d;
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* ===== Default: Fade Animation (Safari-safe) ===== */
.card-front {
    background: white;
    padding: 0.75rem;
    padding-bottom: 3.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.card-back {
    background: linear-gradient(135deg, var(--rose-50), white, var(--amber-100));
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    z-index: 1;
}

.memory-card.flipped .card-front {
    opacity: 0;
    visibility: hidden;
    z-index: 1;
}

.memory-card.flipped .card-back {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* ===== 3D Flip for non-Safari browsers ===== */
@supports not (-webkit-touch-callout: none) {
    .card-inner {
        transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
    }
    
    .card-front,
    .card-back {
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transition: none;
        opacity: 1;
        visibility: visible;
    }
    
    .card-front {
        transform: rotateY(0deg);
        z-index: auto;
    }
    
    .card-back {
        transform: rotateY(180deg);
        z-index: auto;
    }
    
    .memory-card.flipped .card-inner {
        transform: rotateY(180deg);
    }
    
    .memory-card.flipped .card-front,
    .memory-card.flipped .card-back {
        opacity: 1;
        visibility: visible;
        z-index: auto;
    }
    
    .memory-card:hover .card-inner {
        transform: scale(1.02);
    }
    
    .memory-card.flipped:hover .card-inner {
        transform: rotateY(180deg) scale(1.02);
    }
}

/* Mobilde hover efektlerini kapat */
@media (hover: none) and (pointer: coarse) {
    .memory-card:hover .card-inner {
        transform: none;
    }
    
    .memory-card.flipped:hover .card-inner {
        transform: rotateY(180deg);
    }
    
    .memory-card:hover .card-image {
        transform: none !important;
    }
    
    .memory-card:hover .card-front {
        box-shadow: var(--shadow-lg);
    }
    
    .memory-card:hover .card-hover-overlay {
        opacity: 0;
    }
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.memory-card:hover .card-image {
    transform: scale(1.05);
}

.card-image-overlay {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.card-hover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(254, 205, 211, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.memory-card:hover .card-hover-overlay {
    opacity: 1;
}

.card-date-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    text-align: center;
}

.card-date-caption span {
    font-family: var(--font-serif);
    font-size: 0.875rem;
    font-style: italic;
    color: var(--warm-gray-600);
    letter-spacing: 0.025em;
}

.card-heart-hint {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: heartPulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.card-heart-hint span {
    font-size: 0.875rem;
}

.card-back-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.back-blob-1 {
    position: absolute;
    top: 0;
    left: 0;
    width: 8rem;
    height: 8rem;
    background: rgba(254, 205, 211, 0.2);
    border-radius: 50%;
    filter: blur(40px);
}

.back-blob-2 {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10rem;
    height: 10rem;
    background: rgba(253, 230, 138, 0.2);
    border-radius: 50%;
    filter: blur(40px);
}

.back-sparkle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.25rem;
}

.card-back-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-back-title {
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--warm-gray-800);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-back-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--rose-400);
    font-weight: 500;
    margin-bottom: 1rem;
}

.card-back-date svg {
    width: 1rem;
    height: 1rem;
}

.card-back-description {
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--warm-gray-600);
    line-height: 1.7;
    padding-right: 0.5rem;
}

.card-back-description::-webkit-scrollbar {
    width: 4px;
}

.card-back-description::-webkit-scrollbar-track {
    background: transparent;
}

.card-back-description::-webkit-scrollbar-thumb {
    background: var(--rose-200);
    border-radius: 4px;
}

.card-back-description::-webkit-scrollbar-thumb:hover {
    background: var(--rose-300);
}

.card-back-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rose-100);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.card-back-footer span {
    font-size: 0.75rem;
    color: var(--rose-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 5rem 1rem;
}

.empty-heart {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--warm-gray-600);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-family: var(--font-sans);
    color: var(--warm-gray-400);
    margin-bottom: 1.5rem;
}

.show-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--rose-600);
    background: var(--rose-100);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.show-all-btn:hover {
    background: var(--rose-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== Footer ===== */
.footer {
    position: relative;
    padding: 2rem 1rem;
    z-index: 1;
}

.footer-content {
    max-width: 56rem;
    margin: 0 auto;
    text-align: center;
}

.footer-hearts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.footer-text {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--warm-gray-500);
}

.footer-subtitle {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--warm-gray-400);
}

/* ===== Utility Classes ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ===== Print Styles ===== */
@media print {
    .filter-bar,
    .card-heart-hint,
    .bg-decorations {
        display: none;
    }
    
    .memory-card {
        break-inside: avoid;
    }
}