@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #eef1f5;
  --card: #ffffff;
  --ink: #16213e;
  --muted: #586379;
  --line: #d3d9e3;
  --red: #c8243b;
  --blue: #1e4b8f;
  --focus: #1e4b8f;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
}
a { color: var(--blue); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; font-size: 15px; }
.brand { font-weight: 700; font-stretch: 85%; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand svg { width: 28px; height: 20px; }
.top nav a { color: var(--muted); text-decoration: none; margin-left: 18px; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }

/* hero */
.hero { padding: 28px 0 8px; }
h1 {
  margin: 0;
  font-size: clamp(46px, 11vw, 104px);
  line-height: .9;
  font-weight: 850;
  font-stretch: 68%;
  letter-spacing: -.012em;
}
.lead { max-width: 34em; margin: 18px 0 28px; font-size: 19px; color: var(--muted); }

/* the envelope: airmail border */
.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 36px 24px;
  background: var(--card);
  border: 12px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--red) 0 16px, #fff 16px 24px, var(--blue) 24px 40px, #fff 40px 48px) 12;
  text-align: center;
  transition: transform .15s ease;
}
.drop.over { transform: scale(1.012); }
.drop.over::after { content: ""; position: absolute; inset: 0; background: rgba(30, 75, 143, .06); pointer-events: none; }
.drop-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; font-stretch: 85%; line-height: 1.2; }
.drop-hint { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick {
  display: inline-block;
  padding: 14px 26px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 650;
  border-radius: 4px;
  cursor: pointer;
}
.pick:hover { background: var(--blue); }
.drop input:focus-visible + .pick { outline: 3px solid var(--focus); outline-offset: 3px; }
.privacy { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.privacy svg { width: 13px; height: 13px; vertical-align: -1px; margin-right: 4px; }

/* result */
#out:empty { display: none; }
#out { margin-top: 28px; display: grid; gap: 20px; scroll-margin-top: 12px; }
.letter {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 22px 24px 26px;
  animation: unfold .45s cubic-bezier(.2, .7, .2, 1) both;
}
.letter.nested { margin-left: 22px; border-left: 4px solid var(--blue); }
.letter.error { border-left: 4px solid var(--red); }
@keyframes unfold { from { opacity: 0; transform: translateY(-18px); } }
@media (prefers-reduced-motion: reduce) { .letter { animation: none; } .drop { transition: none; } }
.source { margin: 0 0 4px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.letter h2 { margin: 0 0 14px; font-size: 28px; line-height: 1.15; font-weight: 750; font-stretch: 80%; overflow-wrap: anywhere; }
.letter h3 { margin: 26px 0 10px; font-size: 17px; font-weight: 700; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 15px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }

.atts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.att { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
/* postage stamp: perforated edge */
.stamp {
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  padding: 4px;
  background: radial-gradient(circle at 50% 50%, transparent 3px, var(--blue) 3.5px) -5px -5px / 10px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  font-stretch: 75%;
  letter-spacing: .02em;
  position: relative;
}
.stamp::before { content: ""; position: absolute; inset: 5px; background: var(--blue); z-index: 0; }
.stamp { isolation: isolate; }
.stamp::before { z-index: -1; }
.att-name { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.att-name small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.att-act { display: flex; gap: 8px; }
.btn {
  display: inline-block;
  padding: 9px 16px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--blue); border-color: var(--blue); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.body { border: 1px solid var(--line); background: #fff; }
.mail-html { display: block; width: 100%; height: 420px; border: 0; }
.mail-text { padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; max-height: 70vh; overflow: auto; }
.note { margin: 0; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.body .note { border-bottom: 1px solid var(--line); }

/* content */
.content { padding: 56px 0 24px; }
.content section { max-width: 40em; margin-bottom: 40px; }
.content h2 { font-size: 30px; line-height: 1.1; font-weight: 750; font-stretch: 78%; margin: 0 0 12px; }
.content p, .content li { margin: 0 0 12px; }
.content ol { padding-left: 1.3em; }
.content code { font-size: 15px; background: #fff; border: 1px solid var(--line); padding: 1px 5px; border-radius: 3px; overflow-wrap: anywhere; }
.path { font-weight: 600; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 650; }
details p { margin: 10px 0 0; }

footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 40px; font-size: 14px; color: var(--muted); }
footer a { color: var(--muted); margin-right: 16px; }
.legal h2 { font-size: 20px; margin-top: 28px; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .top nav a { margin-left: 12px; }
  .lead { font-size: 17px; }
  .drop { min-height: 220px; padding: 28px 16px; border-width: 9px; }
  .drop-title { font-size: 20px; }
  .letter { padding: 18px 16px 22px; }
  .letter.nested { margin-left: 10px; }
  .letter h2 { font-size: 23px; }
  .att { grid-template-columns: auto 1fr; }
  .att-act { grid-column: 1 / -1; }
  .att-act .btn { flex: 1; text-align: center; }
  .stamp { width: 46px; height: 52px; font-size: 12px; }
  .content h2 { font-size: 25px; }
}
