/* The note dialog (quick-note.js).
   Same language as the home page's intro: a sheet of the page's paper, one
   large serif sentence with outlined pills set in it, ruled lines to write
   on. */

/* Every button on the card: the word in the serif, hugged by a thin outline.
   A pill that is switched on is filled. */
.note-pill {
    display: inline-block;
    padding: 0.04em 0.42em 0.1em;
    border: 1px solid var(--color-ink);
    border-radius: 999px;
    background: none;
    color: var(--color-ink);
    font: inherit;
    font-family: var(--font-serif);
    letter-spacing: inherit;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.note-pill:hover:not(:disabled),
.note-pill[aria-pressed="true"] {
    background-color: var(--color-ink);
    color: var(--color-on-dark);
}

.note-dialog button:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 3px;
}

.note-dialog {
    width: min(38rem, calc(100vw - 2 * var(--space-md)));
    max-height: calc(100dvh - 2 * var(--space-md));
    margin: auto;
    padding: var(--space-lg) var(--space-lg) var(--space-xl);
    border: 0;
    border-radius: 0;
    background-color: var(--color-paper);
    background-image: linear-gradient(rgba(248, 247, 247, 0.62), rgba(248, 247, 247, 0.62)), url('public/images/site/paper-241.jpg');
    background-size: cover;
    color: var(--color-ink);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.16);
    overflow-y: auto;
}

@media (min-width: 600px) {
    .note-dialog {
        padding: var(--space-xl) var(--space-xl) var(--space-2xl);
    }
}

.note-dialog::backdrop {
    background-color: rgba(248, 247, 247, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.note-dialog[open] {
    animation: note-in 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes note-in {
    from { opacity: 0; transform: translateY(14px); }
}

.note-form,
.note-done {
    position: relative;
    display: grid;
    gap: var(--space-md);
}

.note-done,
.note-dialog.is-sent .note-form {
    display: none;
}

.note-dialog.is-sent .note-done {
    display: grid;
    justify-items: start;
    outline: none;
}

.note-title {
    font-size: clamp(1.7rem, 5.2vw, 2.6rem);
    line-height: 1.26;
    letter-spacing: -0.025em;
    margin: 0;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-ink);
    text-wrap: balance;
}

.note-address {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5em;
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.3;
    color: var(--color-ink);
    overflow-wrap: anywhere;
}

.note-close {
    justify-self: end;
    font-size: 1.1rem;
}

.note-pair {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 520px) {
    .note-pair {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-lg);
    }
}

.note-field {
    display: grid;
    gap: 0.15rem;
    font-size: var(--type-sm);
    color: var(--color-text-muted);
}

/* Lines to write on, not boxes. */
.note-field input,
.note-field textarea {
    width: 100%;
    padding-block: 0.5rem 0.55rem;
    border: 0;
    border-bottom: 1px solid var(--color-ink);
    border-radius: 0;
    background: none;
    color: var(--color-ink);
    font-family: var(--font-serif);
    font-size: 1.25rem; /* above 16px, so phones do not zoom in on focus */
    line-height: 1.35;
    resize: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Where you are typing: the active line lifts onto a white slip that runs a
   little past the text on both sides, over a heavier rule, and the other
   lines step back. The text itself never moves. */
.note-field {
    --slip: 0.75rem;
}

.note-field input,
.note-field textarea {
    width: calc(100% + 2 * var(--slip));
    margin-inline: calc(-1 * var(--slip));
    padding-inline: var(--slip);
}

.note-field,
.note-field input,
.note-field textarea {
    transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.note-form:focus-within .note-field:not(:focus-within) input,
.note-form:focus-within .note-field:not(:focus-within) textarea {
    border-bottom-color: var(--color-line);
}

.note-field input:focus,
.note-field textarea:focus {
    outline: none;
    background-color: var(--color-field);
    box-shadow: 0 1px 0 0 var(--color-ink);
}

.note-field:focus-within {
    color: var(--color-ink);
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    .note-field,
    .note-field input,
    .note-field textarea { transition: none; }
}

.note-status {
    margin: 0;
    font-size: var(--type-sm);
    color: var(--color-ink);
}

.note-status:empty {
    display: none;
}

.note-send,
.note-done-close {
    justify-self: start;
    margin-top: var(--space-xs);
    padding: 0.14em 0.7em 0.22em;
    font-size: 1.6rem;
}

.note-send:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (prefers-reduced-motion: reduce) {
    .note-dialog[open] { animation: none; }
}

@media (pointer: coarse) {
    .note-close,
    .note-copy {
        padding: 0.3em 0.7em 0.36em;
    }
}

@media (max-width: 600px) {
    .note-dialog {
        padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
    }
}

