/* The page of one public letter (/letters/{code}): the letter on a sheet of paper, the letters around it, and the form to write one's own. */

.letter-page {
    --sheet-line: 1.9rem;
    max-width: 44rem;
    margin: 0 auto;
    padding: 8px 0 28px;
}

.letter-page__crumbs {
    margin: 10px 0 2px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.letter-page__crumbs a {
    color: var(--teal);
    text-decoration: none;
}

.letter-page__crumbs a::before {
    content: "\2190\00a0";
}

.letter-page__crumbs a:hover,
.letter-page__crumbs a:focus-visible {
    text-decoration: underline;
}

.letter-page__title {
    margin: 0 0 18px;
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
    font-weight: 600;
    color: var(--ink);
}

/* The sheet: warm paper, faint ruled lines, a soft shadow, the red seal in the corner. */
.letter-page__sheet {
    position: relative;
    padding: calc(var(--sheet-line) * 1.2) clamp(20px, 5vw, 52px) calc(var(--sheet-line) * 0.8);
    border-radius: 4px;
    background-color: var(--letter);
    background-image:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) calc(var(--sheet-line) - 1px), rgba(110, 76, 36, 0.08) calc(var(--sheet-line) - 1px), rgba(110, 76, 36, 0.08) var(--sheet-line)),
        radial-gradient(120% 70% at 18% 0%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 62%),
        radial-gradient(90% 60% at 100% 100%, rgba(196, 150, 84, 0.14), rgba(196, 150, 84, 0) 70%);
    background-position: 0 calc(var(--sheet-line) * 1.2 - 0.35rem), 0 0, 0 0;
    box-shadow: 0 1px 2px rgba(91, 60, 30, 0.1), 0 24px 48px -28px rgba(91, 60, 30, 0.55);
    transform: rotate(-0.35deg);
}

.letter-page__seal {
    float: inline-end;
    width: 46px;
    height: 46px;
    margin-block: 0 8px;
    margin-inline: 14px 0;
    shape-outside: circle(50%);
    border-radius: 49% 52% 47% 51% / 52% 48% 53% 47%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.4) 0, rgba(255, 255, 255, 0) 26%),
        radial-gradient(circle at 50% 56%, #c9623a 0, var(--terracotta) 58%, #8c3a1b 100%);
    box-shadow: 0 2px 3px rgba(70, 20, 4, 0.3);
}

.letter-page__text {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: var(--sheet-line);
}

.letter-page__text p {
    margin: 0 0 var(--sheet-line);
    white-space: pre-line;
    overflow-wrap: anywhere;
    hyphens: auto;
    text-wrap: pretty;
}

.letter-page__text p:first-child {
    font-size: 1.05em;
}

.letter-page__sign {
    margin: 0 0 calc(var(--sheet-line) * 0.6);
    text-align: end;
    font-family: var(--font-hand);
    font-size: 1.7rem;
    line-height: var(--sheet-line);
    color: var(--ink-soft);
}

.letter-page__sign--anonymous {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
}

.letter-page__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding-top: 12px;
    border-top: 1px solid var(--hairline);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.letter-page__dates {
    margin: 0;
}

.letter-page__to {
    margin: 0 0.35em;
}

.letter-page__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.letter-page__lang {
    padding: 1px 7px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.letter-page__tool {
    padding: 4px 10px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    cursor: pointer;
}

.letter-page__tool:hover,
.letter-page__tool:focus-visible {
    border-color: var(--teal);
    color: var(--teal);
}

.letter-page__status {
    font-size: 0.85rem;
}

.letter-page__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.letter-page__note {
    margin: 22px 0 0;
    text-align: center;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.letter-page__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 22px 0 0;
}

.letter-page__step {
    padding: 8px 4px;
    color: var(--teal);
    font-family: var(--font-sans);
    font-weight: 600;
    text-decoration: none;
}

.letter-page__step:hover,
.letter-page__step:focus-visible {
    text-decoration: underline;
}

.letter-page__deck {
    order: 0;
}

.letter-page__cta {
    margin: 36px 0 0;
    padding: 26px clamp(18px, 4vw, 34px);
    border-radius: var(--radius-lg);
    background: var(--tint-warm);
    text-align: center;
}

.letter-page__cta-title {
    margin: 0 0 8px;
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--ink);
}

.letter-page__cta-text {
    margin: 0 0 16px;
    color: var(--ink-soft);
}

.letter-page--empty {
    padding: 40px 0 60px;
    text-align: center;
}

.letter-page__lede {
    margin: 0 auto 22px;
    max-width: 32rem;
    color: var(--ink-soft);
}

.letter-page__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

@media (max-width: 560px) {
    .letter-page__sheet {
        transform: none;
    }

    .letter-page__nav {
        justify-content: center;
    }

    .letter-page__deck {
        order: 3;
        width: 100%;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .letter-page__sheet {
        transform: none;
    }
}

/* The button "Write the author a warm word" under a letter somebody shared. */
.letter-page__warm {
    margin: 18px 0 0;
    text-align: center;
}
