/* ============================================================
   84th Birthday Website for Mam
   Aesthetic: Vintage Warmth / Heirloom Elegance
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --color-bg: #F5EDE3;
    --color-bg-warm: #EDE0D0;
    --color-text: #2C1810;
    --color-text-muted: #5C4A3A;
    --color-gold: #B8860B;
    --color-gold-light: #D4A843;
    --color-rose: #C17B6E;
    --color-letter-paper: #FAF0E1;
    --color-letter-border: #E8D5B8;
    --color-seal: #922B21;
    --color-seal-light: #C0392B;
    --color-cream: #FFF8F0;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-handwritten: 'Dancing Script', cursive;
    --font-body: 'Crimson Text', 'Georgia', serif;

    --shadow-soft: 0 2px 8px rgba(44, 24, 16, 0.08);
    --shadow-medium: 0 4px 16px rgba(44, 24, 16, 0.12);
    --shadow-photo:
        0 1px 2px rgba(44, 24, 16, 0.06),
        0 4px 12px rgba(44, 24, 16, 0.10),
        0 12px 32px rgba(44, 24, 16, 0.08);

    --max-content: 740px;
    --section-spacing: 5rem;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(212, 168, 67, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(193, 123, 110, 0.05) 0%, transparent 60%);
    min-height: 100vh;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- Grain Texture Overlay --- */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* --- Ornaments --- */
.ornament {
    font-size: 1.5rem;
    color: var(--color-gold);
    line-height: 1;
    user-select: none;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    position: relative;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(184, 134, 11, 0.04) 0%, transparent 70%);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    animation: heroFadeIn 1.8s ease-out both;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.hero-line {
    display: block;
}

.hero-line--1 {
    font-size: clamp(1.6rem, 5vw, 3rem);
    letter-spacing: 0.02em;
    animation: heroLineIn 1s ease-out 0.3s both;
}

.hero-line--2 {
    font-size: clamp(2.2rem, 7vw, 4.2rem);
    font-style: italic;
    color: var(--color-gold);
    animation: heroLineIn 1s ease-out 0.6s both;
}

.hero-line--3 {
    font-size: clamp(1.4rem, 4.5vw, 2.6rem);
    letter-spacing: 0.03em;
    animation: heroLineIn 1s ease-out 0.9s both;
}

.hero-subtitle {
    font-family: var(--font-handwritten);
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    animation: heroLineIn 1s ease-out 1.2s both;
}

.ornament--top {
    animation: heroLineIn 1s ease-out 0.1s both;
}

.ornament--bottom {
    animation: heroLineIn 1s ease-out 1.4s both;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: heroLineIn 1s ease-out 2s both;
    text-decoration: none;
    cursor: pointer;
}

.scroll-hint-arrow {
    display: block;
    font-size: 1.5rem;
    color: var(--color-gold-light);
    opacity: 0.6;
    animation: bounce 2.5s ease-in-out 2.5s infinite;
}

/* ============================================================
   SECTIONS — Common
   ============================================================ */
.section {
    padding: var(--section-spacing) 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================================
   PHOTO FRAMES
   ============================================================ */
.photo-frame {
    position: relative;
    max-width: 480px;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-photo);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.photo-frame img {
    width: 100%;
    transition: transform 0.6s ease;
}

/* Featured (start photo) */
.photo-frame--featured {
    max-width: 520px;
    background: var(--color-cream);
    padding: 10px;
    border: 1px solid var(--color-letter-border);
    border-radius: 2px;
}

/* Vintage (black & white bank photo) */
.photo-frame--vintage {
    max-width: 420px;
    background: var(--color-cream);
    padding: 12px 12px 28px;
    border: 1px solid var(--color-letter-border);
    cursor: pointer;
    transform: rotate(-1.5deg);
}

.photo-frame--vintage img {
    filter: sepia(0.08) contrast(1.05);
}

.photo-frame--vintage:hover,
.photo-frame--vintage:focus-visible {
    transform: rotate(0deg) scale(1.02);
    box-shadow:
        var(--shadow-photo),
        0 0 0 3px rgba(184, 134, 11, 0.15);
}

.photo-frame--vintage:hover img,
.photo-frame--vintage:focus-visible img {
    transform: scale(1.03);
}

/* Warm (glückwunsch photo) */
.photo-frame--warm {
    max-width: 440px;
    background: var(--color-cream);
    padding: 10px;
    border: 1px solid var(--color-letter-border);
    cursor: pointer;
    transform: rotate(1deg);
}

.photo-frame--warm:hover,
.photo-frame--warm:focus-visible {
    transform: rotate(0deg) scale(1.02);
    box-shadow:
        var(--shadow-photo),
        0 0 0 3px rgba(193, 123, 110, 0.15);
}

.photo-frame--warm:hover img,
.photo-frame--warm:focus-visible img {
    transform: scale(1.03);
}

/* ============================================================
   CLICK HINTS
   ============================================================ */
.click-hint {
    margin-top: 1.25rem;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    animation: hintPulse 3s ease-in-out infinite;
}

.click-hint-icon {
    display: inline-block;
    margin-right: 0.35em;
    color: var(--color-gold);
    animation: hintBounce 2s ease-in-out infinite;
}

/* ============================================================
   SECTION DIVIDERS
   ============================================================ */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    user-select: none;
}

.divider-line {
    display: block;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-gold-light), transparent);
}

.divider-ornament {
    font-size: 1.1rem;
    color: var(--color-gold);
    opacity: 0.7;
    line-height: 1;
}

/* ============================================================
   POEM / LETTER SECTION
   ============================================================ */
.poem-section {
    position: relative;
    padding-top: 3rem;
    padding-bottom: 6rem;
}

/* Paper stack behind the letter */
.letter-stack {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92%, 720px);
    height: 100%;
    pointer-events: none;
}

.letter-stack-sheet {
    position: absolute;
    inset: 0;
    background: var(--color-letter-paper);
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(44, 24, 16, 0.06);
}

.letter-stack-sheet--1 {
    transform: rotate(2.5deg) translate(4px, 6px);
    opacity: 0.5;
}

.letter-stack-sheet--2 {
    transform: rotate(-1.8deg) translate(-3px, 3px);
    opacity: 0.35;
}

/* The letter itself */
.letter {
    position: relative;
    z-index: 1;
    background: var(--color-letter-paper);
    padding: 2.5rem 2rem 3.5rem;
    max-width: 700px;
    width: 100%;
    transform: rotate(-0.8deg);
    border: 1px solid var(--color-letter-border);
    border-radius: 2px;
    box-shadow:
        0 1px 1px rgba(44, 24, 16, 0.04),
        0 2px 4px rgba(44, 24, 16, 0.04),
        0 4px 8px rgba(44, 24, 16, 0.04),
        0 8px 16px rgba(44, 24, 16, 0.05),
        0 16px 32px rgba(44, 24, 16, 0.05);
    font-family: var(--font-handwritten);
    font-size: clamp(1.15rem, 2.8vw, 1.35rem);
    line-height: 1.9;
    color: var(--color-text);
}

/* Fold line */
.letter::before {
    content: '';
    position: absolute;
    top: 33%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 5%,
        rgba(44, 24, 16, 0.04) 20%,
        rgba(44, 24, 16, 0.06) 50%,
        rgba(44, 24, 16, 0.04) 80%,
        transparent 95%
    );
}

.letter-header {
    font-family: var(--font-handwritten);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-gold);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.3;
}

.letter p {
    margin-bottom: 1.4rem;
    text-indent: 0;
}

.letter p:last-of-type {
    margin-bottom: 2rem;
}

.letter-signature {
    font-family: var(--font-handwritten);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-align: right;
    margin-right: 4rem;
}

/* Wax seal */
.wax-seal {
    position: absolute;
    bottom: 24px;
    right: 28px;
    width: 52px;
    height: 52px;
    background: radial-gradient(
        circle at 38% 35%,
        var(--color-seal-light) 0%,
        var(--color-seal) 70%,
        #6B1A13 100%
    );
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-letter-paper);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    font-style: italic;
    box-shadow:
        0 2px 6px rgba(44, 24, 16, 0.25),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
    transform: rotate(8deg);
    user-select: none;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    padding: 3rem 1.5rem 4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-text {
    font-family: var(--font-handwritten);
    font-size: 1.5rem;
    color: var(--color-text-muted);
}

.footer-heart {
    font-size: 1.8rem;
    color: var(--color-rose);
    animation: heartbeat 2s ease-in-out infinite;
    line-height: 1;
}

.footer-year {
    font-family: var(--font-display);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    color: var(--color-text-muted);
    opacity: 0.5;
    margin-top: 0.5rem;
}

/* ============================================================
   VIDEO MODAL
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal.active {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 10, 5, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    width: 100%;
    max-width: 800px;
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.modal-close:hover,
.modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.1);
}

.modal-video {
    width: 100%;
    max-height: 80vh;
    border-radius: 6px;
    background: #000;
    outline: none;
}

/* ============================================================
   SCROLL FADE-IN ANIMATIONS
   ============================================================ */
.fade-in-section {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

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

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes heroFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.3;
    }
}

@keyframes hintPulse {
    0%, 100% {
        opacity: 0.75;
    }
    50% {
        opacity: 1;
    }
}

@keyframes hintBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.15);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    56% {
        transform: scale(1);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet & up */
@media (min-width: 640px) {
    :root {
        --section-spacing: 6rem;
    }

    .letter {
        padding: 3rem 3.5rem 4rem;
    }

    .divider-line {
        width: 90px;
    }

    .photo-frame--featured {
        max-width: 560px;
        padding: 14px;
    }

    .photo-frame--vintage {
        max-width: 460px;
        padding: 14px 14px 32px;
    }

    .photo-frame--warm {
        max-width: 480px;
        padding: 14px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    :root {
        --section-spacing: 7rem;
    }

    .letter {
        padding: 3.5rem 4.5rem 4.5rem;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in-section {
        opacity: 1;
        transform: none;
    }
}
