/* An airmail envelope on its own lining, a letter out of it, and a diary on writing paper. The blue is the pen's. */
@font-face { font-family: Besley; src: url(/besley.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }
:root { --desk: #eaf0f8; --sheet: #fbfdff; --cream: #fbf6ea; --ink: #18225c; --faint: #4f5a86; --lining: #223277; --red: #b8425a;
  --blue: #5068b4; --edge: clamp(1rem, 5vw, 4rem); --lie: 0 1px 2px rgb(24 34 92 / .28), 0 14px 30px -14px rgb(24 34 92 / .45); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 1.0625rem/1.7 Besley, Rockwell, Charter, Georgia, serif;
  overflow-wrap: break-word; overflow-x: clip; }
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; font-weight: 400; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 560; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
img, canvas { display: block; max-width: 100%; height: auto; }
button, summary { font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
.away { position: absolute; }
[hidden] { display: none !important; }

/* The lining shows above the envelope that came out of it */
.lining { height: 17rem; padding: 1.5rem var(--edge) 0; background: var(--lining) url(/roofs.svg) center top / 174px 156px; }
.lining :focus-visible { outline-color: #fff; }
nav { max-width: 70rem; margin: 0 auto; }
.name { display: inline-block; padding: .4rem .8rem; background: #fff; }
.name img { width: 8.5rem; }

.envelope { position: relative; display: flex; justify-content: space-between; gap: 2rem; width: calc(100% - 2 * var(--edge)); max-width: 70rem;
  min-height: 27rem; margin: -10.5rem auto 0; padding: clamp(1.25rem, 4vw, 3rem); padding-bottom: 5rem; border: 11px solid transparent; box-shadow: var(--lie);
  background: linear-gradient(var(--sheet) 0 0) padding-box,
    repeating-linear-gradient(-45deg, var(--red) 0 16px, var(--sheet) 16px 28px, var(--blue) 28px 44px, var(--sheet) 44px 56px) border-box; }
.envelope > div:first-child { align-self: flex-start; min-width: 0; flex: 1; }
.envelope h1 { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; }
.signature { width: min(31rem, 100%); max-height: 14rem; object-fit: contain; object-position: left; margin-bottom: 1rem; }
.work { font-size: 1.25rem; line-height: 1.4; }
.work:empty { display: none; }
.work::first-letter { text-transform: uppercase; }
.where { font-size: 1.25rem; line-height: 1.4; color: var(--faint); }
.air { position: absolute; left: clamp(1.25rem, 4vw, 3rem); bottom: 1.4rem; padding: .3rem .8rem .35rem; background: var(--blue); color: #fff;
  font-size: .85rem; font-weight: 560; line-height: 1.25; rotate: -1.2deg; }

/* A stamp: a solid middle, and a 14px grid of holes whose centres lie on the edge. Sides are multiples of 14px. */
.franking { position: relative; flex: none; align-self: flex-start; }
.lick { rotate: 1.8deg; filter: drop-shadow(0 1px 2px rgb(24 34 92 / .4)); }
.stamp { width: 224px; height: 280px; padding: 12px; background: #fff; color: var(--ink);
  mask: linear-gradient(#000 0 0) center / calc(100% - 12px) calc(100% - 12px) no-repeat,
    radial-gradient(circle, transparent 4px, #000 4.5px) -7px -7px / 14px 14px; }
.portrait { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.stamp b { display: grid; place-items: center; height: 100%; background: #dbe5f3; font-size: 5rem; }
.postmark { position: absolute; left: -8.5rem; bottom: -1.6rem; width: 18rem; max-width: none; overflow: visible; font-weight: 700; rotate: -7deg;
  filter: url(#worn); opacity: .88; }
@media (prefers-reduced-motion: no-preference) {
  .postmark { animation: thump .26s 1.1s cubic-bezier(.3, 0, .9, .4) both; }
  @keyframes thump { from { opacity: 0; scale: 1.5; } }
}

/* Where they are: the hour, and a postcard of the town in two inks */
.there { display: grid; grid-template-columns: minmax(0, 1fr) 27rem; gap: 2rem 4rem; align-items: center; max-width: 70rem; margin: 0 auto; padding: 3.5rem 0 0; }
@media (max-width: 78rem) { .there { margin: 0 var(--edge); } }
.now { font-size: clamp(2rem, 4.4vw, 3.4rem); font-weight: 560; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; margin-bottom: .75rem; }
.now time { font-variant-numeric: tabular-nums; }
.there p + p { font-size: 1.125rem; }
.counts { color: var(--faint); }
.postcard { margin-top: -5.5rem; padding: .8rem .8rem .7rem; background: #fff; box-shadow: var(--lie); rotate: 2.4deg; position: relative; }
.postcard div { position: relative; isolation: isolate; background: #fff; }
.postcard .map { width: 100%; filter: grayscale(1) brightness(.86) contrast(2.1); }
.postcard div::before { content: ""; position: absolute; inset: 0; background: #31459f; mix-blend-mode: screen; z-index: 1; }
.postcard div::after { content: ""; position: absolute; z-index: 2; left: 50%; top: 50%; width: 1.9rem; height: 1.9rem; translate: -50% -50%;
  border: 3px solid var(--red); border-radius: 50%; background: radial-gradient(var(--red) 0 24%, transparent 27%); }
.postcard b { position: absolute; z-index: 3; left: .9rem; bottom: .55rem; max-width: 92%; font-size: clamp(2rem, 5vw, 2.9rem); font-weight: 800; line-height: 1; letter-spacing: -.02em;
  color: var(--red); paint-order: stroke fill; -webkit-text-stroke: 7px #fff; }
.postcard figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; align-items: baseline; padding-top: .5rem; line-height: 1.3; }
.postcard small { font-size: .75rem; color: var(--faint); }

main { max-width: 70rem; margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) 0 0; }
@media (max-width: 78rem) { main { margin: 0 var(--edge); } }

/* Their writing paper */
.sheet { background: var(--cream) url(/paper.png) 0 0 / 15rem; box-shadow: var(--lie); }
.first > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.pen { padding: .55rem 1.1rem .6rem; border: 2px solid var(--ink); background: none; line-height: 1.2; }
.pen:hover { background: var(--ink); color: #fff; }
.sheets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem; align-items: start; margin: 2rem 0 1.75rem; }
.sheets a:only-child { grid-column: 1 / -1; justify-self: center; width: min(44rem, 100%); }
.sheets a:nth-child(odd) { rotate: -.6deg; }
.sheets a:nth-child(even) { rotate: .5deg; margin-top: 1.5rem; }
.sheets .sheet { width: 100%; background: white url(/paper.png) 0 0 / 20.65%; } /* the paper at the size it has in the page images */
summary { width: fit-content; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
summary::marker { color: var(--red); }
.typed { max-width: 42rem; margin-top: 1rem; padding: 1.5rem clamp(1.25rem, 4vw, 2.5rem); background: var(--sheet); }
.typed p + p { margin-top: .9rem; }
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  [data-strokes] { animation: ink .3s 4s both; }  /* if the writing has not begun by then */
  .sheet[data-strokes] { animation-name: page; animation-timing-function: step-end; }
  @keyframes ink { from { opacity: 0; } }
  @keyframes page { from { object-position: 200vw; } }  /* the paper lies there, with nothing on it */
}
@media print { [data-strokes] { animation: none; } }

/* The open postbox: a card, a box, and the desk the answer is written at */
.postbox { margin-top: clamp(3.5rem, 8vw, 6rem); scroll-margin-top: 1rem; }
.out { display: grid; grid-template-columns: minmax(0, 1fr) 10rem; gap: 2rem clamp(2rem, 6vw, 5rem); align-items: end; margin-top: 2rem; }
.card { position: relative; z-index: 1; display: grid; grid-template-columns: 1.35fr 1fr; background: var(--sheet); box-shadow: var(--lie); rotate: -.5deg; }
.said { display: grid; gap: .25rem; padding: clamp(1.1rem, 3vw, 2rem); border-right: 2px solid #c8d3ea; }
.card label { font-size: .9375rem; color: var(--faint); }
.card textarea, .card input { width: 100%; font: inherit; font-size: 1.125rem; line-height: 2rem; color: var(--ink); border: 0; border-radius: 0; padding: 0 .2rem;
  background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), #c8d3ea calc(2rem - 1px) 2rem) local; resize: none; }
.card ::placeholder { color: var(--faint); opacity: 1; }
.card input { height: 2rem; }
.card input:focus-visible, .card textarea:focus-visible { outline-offset: 0; }
.to { display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(1.1rem, 3vw, 2rem); }
.to p { font-size: 1.125rem; line-height: 2rem; border-bottom: 1px solid #c8d3ea; }
.place { position: absolute; top: clamp(1.1rem, 3vw, 2rem); right: clamp(1.1rem, 3vw, 2rem); width: 84px; height: 98px; outline: 1.5px dashed #9fb0d6; }
.place .stamp { width: 84px; height: 98px; padding: 9px; }
.place .stamp::before { content: ""; display: block; height: 100%; background: var(--lining) url(/roofs.svg) center / 78px 70px; }
.place .lick { visibility: hidden; }
.stamped .place .lick { visibility: visible; }
@media (prefers-reduced-motion: no-preference) { .stamped .place .lick { animation: lick .5s cubic-bezier(.3, 0, .6, 1); } }
@keyframes lick { from { opacity: 0; translate: 3rem -4rem; rotate: 22deg; scale: 1.7; } 70% { opacity: 1; translate: 0; scale: .96; } }
.box { width: 10rem; filter: drop-shadow(0 12px 14px rgb(24 34 92 / .3)); }
.told { margin: 1.5rem 0 1rem; color: var(--faint); }
form button { padding: .8rem 1.4rem .9rem; border: 0; background: var(--lining); color: #fff; font-size: 1.0625rem; line-height: 1.3; }
form button:hover { background: var(--ink); }
.trouble:not(:empty) { margin-top: 1rem; padding: .7rem 1rem; border-left: 5px solid var(--red); background: var(--sheet); font-weight: 560; }
.desk { margin: 2rem calc(50% - 50vw) 0; padding: clamp(1.75rem, 4vw, 3rem) var(--edge) clamp(2.5rem, 5vw, 4rem); color: #fff; scroll-margin-top: 0;
  background: #6d452c url(/wood.svg) center top / 900px 600px; box-shadow: inset 0 14px 30px -14px rgb(40 20 8 / .6); }
.doing { outline: none; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 560; line-height: 1.2; text-align: center; text-wrap: balance; text-shadow: 0 1px 2px #3a200f; }
.blotter { position: relative; width: min(40rem, 100%, max(18rem, (100vh - 13rem) * .707)); margin: 1.75rem auto 0; }
.blotter .sheet { width: 100%; aspect-ratio: 210 / 297; background: white url(/paper.png) 0 0 / 20.65%; box-shadow: 0 2px 3px rgb(40 20 8 / .5), 0 22px 40px -12px rgb(40 20 8 / .75); rotate: -.4deg; }
.blotter .lick { position: absolute; right: clamp(-5rem, calc((40rem - 92vw) / 2), .75rem); bottom: -1.75rem; rotate: 5deg; }
.blotter .stamp { width: 140px; height: 182px; }
.after { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 3.5rem; }
.after button, .save { padding: .6rem 1.2rem .7rem; border: 2px solid #fff; background: none; color: #fff; font-weight: 600; line-height: 1.2; text-decoration: none; }
.after button:hover, .save:hover { background: #fff; color: var(--ink); }
.desk details { width: min(40rem, 100%); margin: 1.5rem auto 0; }
.desk .typed { color: var(--ink); white-space: pre-line; }
.desk :focus-visible { outline-color: #fff; }
@media (prefers-reduced-motion: no-preference) { .desk { animation: sit .7s ease-out; } .desk .blotter { animation: slide .9s ease-out; } }
@keyframes sit { from { opacity: 0; } }
@keyframes slide { from { translate: 0 4rem; rotate: 3deg; } }

.journal { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 2rem 4rem; align-items: start; margin-top: clamp(3.5rem, 8vw, 6rem); }
.journal.alone { grid-template-columns: minmax(0, 46rem); justify-content: center; }
.diary { display: grid; gap: 2rem; }
article { position: relative; padding: clamp(1.5rem, 5vw, 3.75rem); padding-top: clamp(1.5rem, 4vw, 2.75rem); font-size: 1.125rem; line-height: 1.75; }
article:nth-of-type(even) { rotate: .25deg; }
article > p { max-width: 36em; text-wrap: pretty; hanging-punctuation: first; }
article > p + p { margin-top: 1rem; }
/* the date, stamped in red */
article h3 { width: fit-content; margin: 0 0 1.75rem auto; padding: .35rem .9rem .45rem; border: 2.5px solid var(--red); outline: 1px solid var(--red); outline-offset: -6px;
  color: var(--red); font-size: .9rem; font-weight: 640; line-height: 1.2; text-align: center; rotate: 2.5deg; filter: url(#worn); }
article:nth-of-type(even) h3 { rotate: -1.8deg; }
article h3 span { display: block; padding: 0 .3rem; }
article h3 b { display: block; font-size: 2.4rem; line-height: 1.05; font-weight: 700; }
.pulled { margin: 2rem 0 2rem -.1em; max-width: 22em; font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 520; line-height: 1.3; letter-spacing: -.01em; color: var(--blue); text-wrap: balance; }
article > .pulled + p { margin-top: 2rem; }

aside { position: sticky; top: 2rem; max-height: calc(100vh - 4rem); overflow-y: auto; margin: 0 -.9rem; padding: 0 .9rem .9rem; }
.heard { list-style: none; display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.heard li { padding: 1rem 1.1rem; background: var(--sheet); box-shadow: var(--lie); font-size: .98rem; line-height: 1.5; }
.heard li:nth-child(odd) { rotate: -.8deg; }
.heard li:nth-child(even) { rotate: .7deg; }
.heard a { color: var(--faint); font-size: .875rem; }

.lining:has(> nav:only-child):not(div) { height: auto; padding-bottom: 1.5rem; }
.index > h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 560; line-height: 1.1; margin-bottom: 2rem; }
.pals { list-style: none; display: grid; gap: 2rem; }
.pals .envelope { width: 100%; margin: 0; min-height: 0; padding: 1.5rem 2rem; text-decoration: none; }
.pals .stamp { width: 126px; height: 154px; }
.pals .stamp b { font-size: 3rem; }
.pals .signature { max-height: 7rem; width: auto; max-width: min(22rem, 100%); }

footer { margin-top: clamp(4rem, 9vw, 7rem); padding: 2rem var(--edge); background: var(--lining); color: #fff; }
footer p { max-width: 70rem; margin: 0 auto; }
footer :focus-visible { outline-color: #fff; }

@media (max-width: 52rem) {
  .lining { height: 14rem; }
  .envelope { flex-direction: column-reverse; gap: 2.25rem; min-height: 0; margin-top: -8.5rem; padding-bottom: 5rem; border-width: 9px; }
  .envelope > div:first-child { align-self: stretch; }
  .franking { align-self: flex-end; }
  .stamp { width: 154px; height: 196px; }
  .postmark { width: 14rem; left: -6.6rem; bottom: -1.4rem; }
  .signature { max-height: 9rem; }
  .air { bottom: 1.25rem; }
  .there { grid-template-columns: minmax(0, 1fr); padding-top: 2.5rem; }
  .postcard { margin: .5rem 0 0; rotate: 1.2deg; }
  .sheets, .journal { grid-template-columns: minmax(0, 1fr); }
  .sheets a:nth-child(even) { margin-top: 0; }
  aside { position: static; max-height: none; overflow: visible; }
  .out { grid-template-columns: minmax(0, 1fr); }
  .card { grid-template-columns: minmax(0, 1fr); }
  .said { border-right: 0; padding-right: calc(84px + 2.5rem); }
  .to { padding-top: 0; }
  .box { width: 7rem; justify-self: center; }
  .blotter .stamp { width: 98px; height: 126px; padding: 9px; }
  .pals .envelope { flex-direction: row; align-items: center; padding: 1rem 1.1rem; gap: 1rem; }
  .pals .stamp { width: 84px; height: 112px; padding: 9px; }
}
@media print { .lining, .pen, details, .air { display: none; } .envelope { margin-top: 0; } .sheet, .envelope, .postcard { box-shadow: none; } }
