/* ==========================================================================
   addrenvoy.com — Styles
   Colors: #F4EDE4, #C4A882, #2C2418, #A8432A, #5B7B8A, #8B7355, #D4A853
   Fonts: Lora (display), Source Sans 3 (body), Special Elite (accent)
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.72;
    color: #2C2418;
    background-color: #F4EDE4;
    overflow-x: hidden;
    position: relative;
}

/* --- Paper Grain Texture Overlay --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    filter: url(#grain);
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Lora', serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #2C2418;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.15;
}

h2 {
    font-size: clamp(1.6rem, 4vw, 3rem);
    line-height: 1.25;
}

p {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    line-height: 1.72;
}

/* --- Postmark Home Anchor --- */
.postmark-home {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 72px;
    height: 72px;
    border: 2px solid #5B7B8A;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 0.3s ease;
}

.postmark-home::before {
    content: '';
    position: absolute;
    width: 58px;
    height: 58px;
    border: 1px dashed #5B7B8A;
    border-radius: 50%;
    opacity: 0.5;
}

.postmark-home:hover {
    border-color: #A8432A;
    transform: scale(1.08);
}

.postmark-home:hover .postmark-text,
.postmark-home:hover .postmark-date {
    color: #A8432A;
}

.postmark-text {
    font-family: 'Special Elite', monospace;
    font-size: 8px;
    color: #5B7B8A;
    letter-spacing: 0.1em;
    transition: color 0.3s ease;
}

.postmark-date {
    font-family: 'Special Elite', monospace;
    font-size: 7px;
    color: #5B7B8A;
    opacity: 0.7;
    transition: color 0.3s ease;
}

/* --- Background Envelope Silhouettes --- */
.bg-envelopes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

.bg-envelope {
    position: absolute;
    color: #C4A882;
    opacity: 0.08;
}

.env-1 { width: 180px; top: 8%; left: 5%; transform: rotate(-8deg); }
.env-2 { width: 120px; top: 25%; right: 10%; transform: rotate(12deg); opacity: 0.05; }
.env-3 { width: 250px; bottom: 20%; left: 60%; transform: rotate(-3deg); opacity: 0.06; }
.env-4 { width: 80px; top: 55%; left: 15%; transform: rotate(18deg); opacity: 0.04; }
.env-5 { width: 150px; bottom: 10%; right: 5%; transform: rotate(-15deg); opacity: 0.07; }

/* --- Botanical Line Drawings --- */
.botanical {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
}

.botanical-1 {
    width: 80px;
    top: 15%;
    right: -15px;
}

.botanical-2 {
    width: 60px;
    bottom: 10%;
    left: -10px;
}

.botanical-3 {
    width: 50px;
    top: 55%;
    right: 3%;
    opacity: 0.25;
}

/* --- Route Lines --- */
.route-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

.route-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.route-line.drawn {
    stroke-dashoffset: 0;
}

/* --- Postmark Circles --- */
.postmark-circle {
    width: 90px;
    height: 90px;
    border: 2px solid #5B7B8A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0.5;
}

.postmark-circle::before {
    content: '';
    position: absolute;
    width: 74px;
    height: 74px;
    border: 1px dashed #5B7B8A;
    border-radius: 50%;
    opacity: 0.6;
}

.postmark-inner-text {
    font-family: 'Special Elite', monospace;
    font-size: 11px;
    color: #5B7B8A;
    letter-spacing: 0.05em;
}

/* --- Sections (General) --- */
.section {
    position: relative;
    z-index: 2;
    width: 100%;
}

/* --- Section 1: The Envelope (Hero) --- */
.section-envelope {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    padding: 40px 20px;
}

.envelope-hero {
    width: clamp(280px, 50vw, 500px);
    margin-bottom: 3rem;
    transform: rotate(-1.5deg);
    transition: transform 0.15s ease-out;
}

.envelope-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(4px 6px 0px #8B7355);
}

.address-lines rect {
    transition: filter 2s ease;
}

.address-lines.blurred rect {
    filter: blur(4px);
}

.hero-question {
    text-align: center;
    max-width: 700px;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.2s 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

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

.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeInUp 1s 1.5s ease forwards;
}

.scroll-hint-line {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, #8B7355);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.8); }
    50% { opacity: 0.8; transform: scaleY(1); }
}

/* --- Section 2: The Route --- */
.section-route {
    padding: 80px 20px 120px;
    position: relative;
    min-height: 100vh;
}

.postmark-section-2 {
    position: absolute;
    top: 30px;
    right: 10%;
}

.route-block {
    max-width: 540px;
    margin-bottom: 80px;
    opacity: 0;
    transform: translateY(30px) rotate(2deg);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.route-block.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* S-curve positioning: left, right, left */
.route-block-1 {
    margin-left: 8%;
    transition-delay: 0s;
}

.route-block-2 {
    margin-left: auto;
    margin-right: 8%;
    transition-delay: 0.08s;
}

.route-block-3 {
    margin-left: 12%;
    transition-delay: 0.16s;
}

.route-card {
    background-color: #C4A882;
    padding: 40px 36px;
    border-radius: 4px;
    box-shadow: 4px 6px 0px #8B7355;
    transform: rotate(-0.5deg);
    position: relative;
}

.route-block-2 .route-card {
    transform: rotate(1deg);
}

.route-block-3 .route-card {
    transform: rotate(-1deg);
}

.route-label {
    font-family: 'Special Elite', monospace;
    font-size: 14px;
    color: #5B7B8A;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 12px;
}

.route-card h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 16px;
    color: #2C2418;
}

.route-card p {
    color: #2C2418;
    opacity: 0.85;
    font-size: 17px;
}

/* --- Section 3: The Seal --- */
.section-seal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    padding: 60px 20px;
    position: relative;
}

.wax-seal {
    width: clamp(100px, 18vw, 180px);
    height: clamp(100px, 18vw, 180px);
    background: radial-gradient(circle at 40% 35%, #c4573e, #A8432A 50%, #8a3520);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
    animation: seal-breathe 12s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.15s ease-out;
    box-shadow: 3px 5px 0px #8B7355;
}

.wax-seal-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-emblem {
    width: 60px;
    height: 60px;
}

@keyframes seal-breathe {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    }
    33% {
        transform: scale(1.03) rotate(1deg);
        border-radius: 45% 55% 60% 40% / 55% 45% 50% 55%;
    }
    66% {
        transform: scale(0.98) rotate(-0.5deg);
        border-radius: 50% 50% 45% 55% / 45% 55% 55% 45%;
    }
}

.seal-content {
    max-width: 560px;
    text-align: center;
    padding: 0 20px;
}

.seal-text {
    font-family: 'Lora', serif;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 400;
    line-height: 1.8;
    color: #2C2418;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.seal-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.postmark-section-3 {
    position: absolute;
    bottom: 50px;
    left: 8%;
}

/* --- Section 4: The Relay --- */
.section-relay {
    padding: 100px 20px 120px;
    position: relative;
    min-height: 80vh;
}

.postcard-stack {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.postcard {
    background-color: #F4EDE4;
    border: 1px solid #C4A882;
    border-radius: 3px;
    padding: 36px 32px;
    box-shadow: 4px 6px 0px #8B7355;
    position: relative;
    opacity: 0;
    transform: translateY(30px) rotate(2deg);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: default;
}

.postcard.visible {
    opacity: 1;
}

.postcard-1 {
    transform: translateY(30px) rotate(-1.5deg);
    margin-left: 5%;
}
.postcard-1.visible {
    transform: rotate(-1.5deg);
}

.postcard-2 {
    transform: translateY(30px) rotate(2deg);
    margin-left: auto;
    margin-right: 3%;
}
.postcard-2.visible {
    transform: rotate(2deg);
}

.postcard-3 {
    transform: translateY(30px) rotate(-0.8deg);
    margin-left: 10%;
}
.postcard-3.visible {
    transform: rotate(-0.8deg);
}

.postcard-line {
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #C4A882 0px,
        #C4A882 8px,
        transparent 8px,
        transparent 12px
    );
    margin-bottom: 20px;
}

.postcard-text {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 2vw, 1.15rem);
    font-style: italic;
    line-height: 1.7;
    color: #2C2418;
    margin-bottom: 16px;
}

.postcard-author {
    font-family: 'Special Elite', monospace;
    font-size: 13px;
    color: #8B7355;
    letter-spacing: 0.03em;
}

.postcard-stamp {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 52px;
    border: 1.5px solid #D4A853;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(244, 237, 228, 0.5);
}

.stamp-text {
    font-family: 'Special Elite', monospace;
    font-size: 10px;
    color: #A8432A;
    letter-spacing: 0.05em;
}

/* --- Section 5: The Arrival --- */
.section-arrival {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    padding: 60px 20px;
    position: relative;
}

.arrival-envelope {
    width: clamp(240px, 40vw, 420px);
    margin-bottom: 3rem;
    transition: transform 0.15s ease-out;
}

.arrival-envelope-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(4px 6px 0px #8B7355);
}

.arrival-statement {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.arrival-statement.visible {
    opacity: 1;
    transform: translateY(0);
}

.postmark-section-5 {
    position: absolute;
    bottom: 40px;
    right: 8%;
}

/* --- Hover & Interactive States --- */
a, .postmark-home {
    color: #5B7B8A;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #A8432A;
}

/* Stamp Edge highlight on hover */
.postcard:hover .postcard-stamp {
    border-color: #D4A853;
    box-shadow: 0 0 0 1px #D4A853;
}

.route-card:hover {
    box-shadow: 5px 8px 0px #8B7355;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .postmark-home {
        width: 56px;
        height: 56px;
        top: 16px;
        left: 16px;
    }

    .postmark-text {
        font-size: 6px;
    }

    .postmark-date {
        font-size: 5px;
    }

    .route-block-1,
    .route-block-2,
    .route-block-3 {
        margin-left: 5%;
        margin-right: 5%;
        max-width: 100%;
    }

    .route-card {
        padding: 28px 24px;
    }

    .postcard-1,
    .postcard-2,
    .postcard-3 {
        margin-left: 0;
        margin-right: 0;
    }

    .botanical {
        display: none;
    }

    .postmark-circle {
        width: 70px;
        height: 70px;
    }

    .postmark-circle::before {
        width: 56px;
        height: 56px;
    }

    .postmark-inner-text {
        font-size: 9px;
    }

    .section-route {
        padding: 60px 16px 80px;
    }

    .section-relay {
        padding: 60px 16px 80px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .envelope-hero {
        width: 90vw;
    }

    .arrival-envelope {
        width: 80vw;
    }

    .route-card {
        padding: 24px 20px;
        transform: rotate(0deg) !important;
    }

    .postcard {
        padding: 28px 20px;
    }

    .postmark-section-2,
    .postmark-section-3,
    .postmark-section-5 {
        display: none;
    }
}
