/* ---------------------------------------------------------------------------
   Correspondence — letterpress stationery aesthetic.
   Cream paper + ink wash + wax-seal red. Numbered fields, deckle edges,
   italic hand for accents.
   ------------------------------------------------------------------------ */

:root {
    --paper:        #f4ecdc;
    --paper-warm:   #ede2cc;
    --paper-edge:   #d8c9a4;
    --ink:          #1d1810;
    --ink-soft:     #4d4030;
    --ink-faint:    #8c7a5d;
    --rule:         #b8a684;
    --wax:          #a52a2a;
    --wax-d:        #7a1f1f;
    --ink-wash:     #243c5a;
    --moss:         #4f6232;
    --good:         #4f6232;
    --bad:          #8a2418;

    --display: "Bodoni 72", "Bodoni MT", Didot, "Hoefler Text", "Big Caslon", "Times New Roman", serif;
    --body:    "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --hand:    "Snell Roundhand", "Brush Script MT", "Apple Chancery", "Lucida Handwriting", cursive;
    --label:   "Optima", "Avenir Next", "Avenir", "Futura", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { background: #2a2218; }
body {
    margin: 0;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(ellipse at 50% 0%, #38301f 0%, #2a2218 60%, #1d1810 100%);
    min-height: 100vh;
    padding: 24px 16px;
}

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

.page {
    max-width: 640px;
    margin: 0 auto;
}

/* --- Card (the letter) ------------------------------------------------- */

.card {
    position: relative;
    padding: 56px clamp(28px, 6vw, 64px) 48px;
    background:
        /* subtle horizontal rules to evoke ruled paper */
        repeating-linear-gradient(
            transparent 0,
            transparent 31px,
            rgba(184, 166, 132, 0.18) 31px,
            rgba(184, 166, 132, 0.18) 32px
        ),
        radial-gradient(ellipse at 0% 0%, rgba(184, 166, 132, 0.18), transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(165, 42, 42, 0.05), transparent 60%),
        var(--paper);
    border: 1px solid var(--paper-edge);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 24px 40px rgba(0, 0, 0, 0.45),
        0 8px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Deckle edges — top and bottom torn-paper effect via SVG */
.card__deckle {
    position: absolute;
    left: 0;
    right: 0;
    height: 14px;
    pointer-events: none;
    background-repeat: repeat-x;
    background-position: center;
    background-size: 90px 14px;
}
.card__deckle--top {
    top: -1px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 14' preserveAspectRatio='none'><path d='M0 14 L0 6 Q5 4 10 7 Q15 10 22 5 Q30 1 38 6 Q46 11 54 4 Q62 0 70 5 Q78 9 86 4 L90 4 L90 14 Z' fill='%23f4ecdc'/></svg>");
}
.card__deckle--bottom {
    bottom: -1px;
    transform: scaleY(-1);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 14' preserveAspectRatio='none'><path d='M0 14 L0 6 Q5 4 10 7 Q15 10 22 5 Q30 1 38 6 Q46 11 54 4 Q62 0 70 5 Q78 9 86 4 L90 4 L90 14 Z' fill='%23f4ecdc'/></svg>");
}

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

.hero { text-align: center; margin-bottom: 36px; }
.hero__eyebrow {
    margin: 0 0 18px;
    font-family: var(--label);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--wax);
    font-weight: 600;
}
.hero__display {
    margin: 0 0 16px;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(36px, 7vw, 56px);
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.005em;
}
.hero__line { display: block; }
.hero__script {
    display: block;
    font-family: var(--hand);
    font-style: italic;
    font-weight: 400;
    font-size: 1.5em;
    color: var(--wax);
    margin: 6px 0;
    transform: rotate(-2deg);
    line-height: 0.9;
}
.hero__lede {
    margin: 18px auto 0;
    max-width: 420px;
    font-family: var(--body);
    font-style: italic;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink-soft);
}
.hero__rule {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.hero__rule span {
    width: 64px;
    height: 1px;
    background: var(--ink);
}
.hero__rule em {
    color: var(--wax);
    font-style: normal;
    font-family: var(--display);
    font-size: 14px;
}

/* --- Form -------------------------------------------------------------- */

.form { display: grid; gap: 22px; }
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.field { display: grid; gap: 10px; }
.field--half { min-width: 0; }
.field label {
    font-family: var(--label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 10px;
}
.field__num {
    font-family: var(--display);
    font-style: italic;
    font-size: 16px;
    color: var(--wax);
    letter-spacing: 0;
    text-transform: none;
    font-weight: 400;
}
.field input, .field textarea {
    width: 100%;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid var(--ink);
    background: transparent;
    font-family: var(--body);
    font-size: 17px;
    color: var(--ink);
    line-height: 1.5;
    transition: border-color 0.25s ease;
}
.field input::placeholder, .field textarea::placeholder {
    color: var(--ink-faint);
    font-style: italic;
    opacity: 0.7;
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-bottom-color: var(--wax);
}
.field textarea {
    resize: vertical;
    min-height: 7rem;
    padding: 6px 0;
    border: 1px solid var(--ink);
    border-left: 0;
    border-right: 0;
    background:
        repeating-linear-gradient(
            transparent 0,
            transparent 27px,
            rgba(184, 166, 132, 0.3) 27px,
            rgba(184, 166, 132, 0.3) 28px
        );
    line-height: 28px;
}
.field textarea:focus {
    border-color: var(--wax);
    background:
        repeating-linear-gradient(
            transparent 0,
            transparent 27px,
            rgba(165, 42, 42, 0.18) 27px,
            rgba(165, 42, 42, 0.18) 28px
        );
}

/* --- Sign-off divider -------------------------------------------------- */

.signoff {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 0 4px;
}
.signoff__line {
    width: 80px;
    height: 1px;
    background: var(--rule);
}
.signoff__text {
    font-family: var(--hand);
    font-size: 22px;
    color: var(--ink-soft);
    transform: rotate(-3deg);
    font-style: italic;
}

/* --- Actions ----------------------------------------------------------- */

.actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-top: 8px;
}
.btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: var(--label);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px 14px 14px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 999px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 8px 18px rgba(0, 0, 0, 0.35);
    position: relative;
}
.btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 12px 24px rgba(0, 0, 0, 0.4);
}
.btn__seal {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, #c83232 0%, var(--wax) 50%, var(--wax-d) 100%);
    color: var(--paper);
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-style: italic;
    font-size: 18px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 4px 10px rgba(122, 31, 31, 0.6);
    border: 1px solid var(--wax-d);
    flex-shrink: 0;
    transform: rotate(-6deg);
    transition: transform 0.4s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.btn--primary:hover:not(:disabled) .btn__seal { transform: rotate(0deg); }
.btn__arrow {
    font-family: var(--display);
    font-size: 16px;
    letter-spacing: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.btn--primary:hover:not(:disabled) .btn__arrow { transform: translateX(4px); }

/* --- Status ------------------------------------------------------------ */

.status {
    margin: 0;
    font-family: var(--body);
    font-style: italic;
    font-size: 15px;
    min-height: 1.4em;
    text-align: center;
    color: var(--ink-soft);
}
.status--good { color: var(--good); }
.status--bad  { color: var(--bad); }
.status--good::before { content: "✓ "; font-style: normal; font-family: var(--label); }
.status--bad::before  { content: "⚠ "; font-style: normal; font-family: var(--label); }

/* --- Endmark ----------------------------------------------------------- */

.endmark {
    margin-top: 28px;
    text-align: center;
    color: var(--paper-warm);
    opacity: 0.55;
    font-family: var(--display);
    font-style: italic;
    font-size: 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    letter-spacing: 0.05em;
}

/* --- Responsive -------------------------------------------------------- */

@media (max-width: 540px) {
    .grid { grid-template-columns: 1fr; }
    .card { padding: 44px 24px 36px; }
    .hero__display { font-size: clamp(28px, 9vw, 40px); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
