/* ===== 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 (Düzeltilmiş 3D Yapı) ===== */
.memory-card {
    perspective: 1000px;
    cursor: pointer;
    background-color: transparent;
    /* Kart giriş animasyonları */
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

/* Giriş Animasyonu Gecikmeleri */
.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;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}

/* Kart Çevrildiğinde (.flipped class'ı JS ile eklenir) */
.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

/* Ön ve Arka Yüz Ortak Özellikler */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    /* Arka yüzün görünmemesi için kritik kod (Safari + Diğerleri) */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Titreme önleyici */
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
}

/* --- ÖN YÜZ --- */
.card-front {
    background: white;
    padding: 0.75rem;
    padding-bottom: 3.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 2;
    /* Ön yüz varsayılan olarak 0 derecedir */
    transform: rotateY(0deg); 
}

/* --- ARKA YÜZ --- */
.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);
    z-index: 1;
    /* İŞTE ÇÖZÜM: Arka yüzü baştan 180 derece çeviriyoruz. 
       Böylece kart dönünce burası düz (360/0) dereceye geliyor. */
    transform: rotateY(180deg); 
}

/* Hover Efekti (Sadece mouse kullanan cihazlarda) */
@media (hover: hover) {
    .memory-card:hover .card-inner {
        transform: scale(1.02);
    }
    
    .memory-card.flipped:hover .card-inner {
        transform: rotateY(180deg) scale(1.02);
    }
}

/* İçerik Stilleri (Eski koddan korundu) */
.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-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;
    }
}

/* ===== Sözleşme (Contract) Sayfası Özel Stilleri ===== */

/* Sözleşme kapsayıcısı: Cam efekti ve zarif bir çerçeve */
.contract-container {
    max-width: 800px;
    margin: 4rem auto;
    padding: 4rem 3rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--rose-100);
    border-radius: 2.5rem;
    box-shadow: var(--shadow-2xl);
    position: relative;
    z-index: 10;
}

.contract-header {
    text-align: center;
    margin-bottom: 4rem;
}

.contract-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.contract-title {
    font-family: var(--font-serif);
    color: var(--warm-gray-800);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* Maddeler (Articles) Stili */
.contract-body {
    counter-reset: article-counter;
}

.article {
    margin-bottom: 2.5rem;
    padding-left: 2rem;
    position: relative;
    border-left: 3px solid var(--rose-200);
    transition: all 0.3s ease;
}

.article:hover {
    border-left-color: var(--rose-400);
    transform: translateX(5px);
}

.article-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--rose-600);
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: 0.02em;
}

.article p {
    font-family: var(--font-sans);
    line-height: 1.8;
    color: var(--warm-gray-700);
    font-size: 1.05rem;
}

/* İmza Bölümü */
.signature-section {
    display: flex;
    justify-content: space-between;
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--rose-300);
    gap: 2rem;
}

.signature-box {
    text-align: center;
    flex: 1;
}

.signature-label {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--warm-gray-600);
    margin-bottom: 1.5rem;
    display: block;
}

.signature-line {
    border-top: 2px solid var(--warm-gray-400);
    width: 80%;
    margin: 0.5rem auto;
}

.signature-name {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--rose-500);
    font-size: 1.1rem;
}

/* Geri Dönüş Linki */
.back-btn-container {
    text-align: center;
    margin-top: 3rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warm-gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}

.back-link:hover {
    color: var(--rose-600);
    background: var(--rose-50);
}

/* Mobil Uyumluluk */
@media (max-width: 640px) {
    .contract-container {
        margin: 1.5rem;
        padding: 2.5rem 1.5rem;
    }
    
    .signature-section {
        flex-direction: column;
        text-align: center;
    }
    
    .signature-line {
        width: 100%;
    }
}
.contract-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 2rem;
    background: white;
    color: var(--rose-500);
    text-decoration: none;
    font-family: var(--font-sans);
    font-weight: 600;
    border: 1px solid var(--rose-100);
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contract-btn span {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.contract-btn:hover {
    background: var(--rose-50);
    color: var(--rose-600);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: var(--rose-200);
}

.contract-btn:hover span {
    transform: rotate(15deg) scale(1.2);
}

/* Sayfa geçiş animasyonu */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* İmza Kapsayıcısı */
.signature-img {
    width: 180px;            
    height: 80px;            
    object-fit: contain;     
    margin-bottom: -10px;    
    z-index: 2;
    pointer-events: none;
}

.signature-wrapper {
    position: relative;
    width: 250px;           
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}   

/* İmza Çizgisi */
.signature-line {
    width: 100%;
    height: 2px;
    background-color: var(--warm-gray-400);
    z-index: 1;
}

/* İsim Stili */
.signature-name {
    margin-top: 10px;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--rose-500);
    font-size: 1.1rem;
}
