/* ---------- Basic reset ---------- */

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

html {
    scroll-behavior: smooth;
}

:root {
    --background: #f8f0e8;
    --paper: #fffaf5;
    --dark-plum: #713f52;
    --rose: #c98291;
    --text: #3d2d34;
    --muted-text: #8d7278;
    --border: #e5d6cd;
}

/* ---------- Page ---------- */

body {
    background-color: var(--background);
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
}

/* Creates a subtle paper texture */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.25;
    background-image: radial-gradient(
        #9f7b6e 0.5px,
        transparent 0.5px
    );
    background-size: 5px 5px;
}

/* ---------- Hero section ---------- */

.hero {
    min-height: 100vh;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* Decorative background circles */

.hero::before,
.hero::after {
    content: "";
    width: 280px;
    height: 280px;
    position: absolute;
    border-radius: 50%;
    opacity: 0.45;
    filter: blur(5px);
}

.hero::before {
    top: -100px;
    left: -120px;
    background-color: #ead0d5;
}

.hero::after {
    right: -130px;
    bottom: -80px;
    background-color: #e8dcc7;
}

.small-heading {
    color: var(--dark-plum);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 4px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    margin: 30px 0;
    color: var(--dark-plum);
    font-size: clamp(70px, 12vw, 150px);
    font-weight: normal;
    letter-spacing: -6px;
    line-height: 0.9;
    position: relative;
    z-index: 1;
}

.introduction {
    max-width: 600px;
    font-size: clamp(18px, 2.1vw, 24px);
    font-style: italic;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.start-link {
    margin-top: 55px;
    color: var(--muted-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 2px;
    position: relative;
    text-decoration: none;
    text-transform: uppercase;
    z-index: 1;
}

.start-link:hover {
    color: var(--dark-plum);
}

/* ---------- Letters section ---------- */

.letters-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 90px 24px 110px;
}

.section-heading {
    margin-bottom: 45px;
    text-align: center;
}

.section-heading p {
    margin-bottom: 8px;
    color: var(--rose);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 3px;
}

.section-heading h2 {
    color: var(--dark-plum);
    font-size: 44px;
    font-weight: normal;
}

/* ---------- Letter grid ---------- */

.letters-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: start;
}

/* ---------- Individual letter ---------- */

.letter {
    position: relative;
    overflow: hidden;
    padding: 0 26px;
    background-color: rgba(255, 250, 245, 0.92);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 12px 35px rgba(87, 52, 59, 0.08);
}

.letter::before {
    content: "";
    height: 3px;
    position: absolute;
    inset: 0 0 auto;
    background-color: var(--rose);
    opacity: 0.7;
}

/* ---------- Letter button ---------- */

.letter-button {
    width: 100%;
    padding: 28px 0 25px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.letter-button:focus-visible {
    outline: 2px solid var(--dark-plum);
    outline-offset: 5px;
}

.heart {
    width: 42px;
    height: 42px;
    display: grid;
    flex-shrink: 0;
    place-items: center;
    color: #b86f7d;
    background-color: #fff6f3;
    border: 1px solid #dbbec4;
    border-radius: 50%;
    font-size: 17px;
}

.letter-title {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
}

.letter-title strong {
    color: #5c3947;
    font-size: 20px;
    font-weight: normal;
}

.letter-title small {
    color: var(--muted-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.5;
}

.arrow {
    color: #a87a84;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 22px;
    transition: transform 0.3s ease;
}

/* ---------- Hidden message ---------- */

.letter-message {
    max-height: 0;
    overflow: hidden;
    color: #57454a;
    font-size: 16px;
    line-height: 1.8;
    opacity: 0;
    transition:
        max-height 0.5s ease,
        opacity 0.3s ease,
        padding 0.3s ease;
}

.letter-message p {
    margin-bottom: 16px;
}

/* Applied by JavaScript when a letter is opened */

.letter.open .letter-message {
    max-height: 900px;
    padding: 25px 2px 15px;
    border-top: 1px solid #eadfd8;
    opacity: 1;
}

.letter.open .arrow {
    transform: rotate(180deg);
}

.signature {
    color: #a65f70;
    font-style: italic;
}

/* ---------- Footer ---------- */

footer {
    padding: 30px 20px;
    color: #916a74;
    border-top: 1px solid #e1d1c7;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
}

/* ---------- Mobile layout ---------- */

@media (max-width: 720px) {
    .hero {
        min-height: 85vh;
        padding: 60px 22px;
    }

    .hero h1 {
        font-size: 70px;
        letter-spacing: -4px;
    }

    .introduction {
        font-size: 18px;
    }

    .letters-section {
        padding: 65px 18px 80px;
    }

    .letters-container {
        grid-template-columns: 1fr;
    }

    .letter {
        padding: 0 20px;
    }

    .letter-title strong {
        font-size: 18px;
    }
}

/* Respect reduced-motion accessibility settings */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .arrow,
    .letter-message {
        transition: none;
    }
}