/* Secret launch page. Paper, ink, one strip of red tape. */

@font-face { font-family: "Alegreya"; src: url("fonts/Alegreya-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/Alegreya-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/AlegreyaSans-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/AlegreyaSans-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Playpen Sans"; src: url("fonts/PlaypenSans-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --paper: #ECE2CC;      /* the desk sheet everything lies on */
  --sheet: #FAF5E7;      /* a cleaner sheet: the field, the privacy note */
  --ink: #1D2946;        /* blue-black fountain pen */
  --pencil: #58534A;     /* small print */
  --tape: #BD3227;       /* the red tape */
  --tape-words: #FFF6E9;
  --red-ink: #A3271E;    /* red that is read, not just seen */
  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  --sans: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Playpen Sans", "Bradley Hand", "Segoe Print", cursive;
  --teeth: polygon(5px 0, calc(100% - 5px) 0, 100% 12.5%, calc(100% - 5px) 25%, 100% 37.5%, calc(100% - 5px) 50%, 100% 62.5%, calc(100% - 5px) 75%, 100% 87.5%, calc(100% - 5px) 100%, 5px 100%, 0 87.5%, 5px 75%, 0 62.5%, 5px 50%, 0 37.5%, 5px 25%, 0 12.5%);
  --lift: 0 1px 1px rgba(64, 44, 12, .16), 0 16px 22px -16px rgba(64, 44, 12, .55);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper) url("paper.svg");
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--sans);
}
a { color: inherit; text-underline-offset: .15em; }
a:focus-visible, .done:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.page {
  max-width: 27rem;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.hero { margin-block: auto; }

h1 {
  margin: 0 0 .55rem;
  font: 700 clamp(1.85rem, 8.3vw, 2.3rem)/1.06 var(--serif);
  letter-spacing: -.012em;
  text-wrap: balance;
}
.lede { margin: 0 0 1.1rem; font: italic 400 1.22rem/1.32 var(--serif); text-wrap: pretty; }
.lede span { display: inline-block; }

/* The tape: every button, and the strips that hold the paper down. */
.tape {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  margin: 0;
  padding: .9rem 1.5rem;
  border: 0;
  border-radius: 0;
  background: var(--tape) url("paper.svg");
  color: var(--tape-words);
  font: 700 1.125rem/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  clip-path: var(--teeth);
  -webkit-appearance: none;
  appearance: none;
}
.tape:hover { background-color: #A92A20; }
.tape:focus-visible { outline: 2px dashed var(--tape-words); outline-offset: -7px; }
.tape:disabled { opacity: .7; cursor: default; }
.strip {
  position: absolute;
  top: -.8rem;
  left: 50%;
  width: 6.5rem;
  height: 1.7rem;
  margin-left: -3.25rem;
  background: var(--tape) url("paper.svg");
  opacity: .94;
  transform: rotate(-3deg);
  clip-path: var(--teeth);
}

/* The form. */
.join__label { display: block; margin: 0 0 .35rem; font: 700 .875rem/1.1 var(--sans); }
.join__row { display: grid; gap: .6rem; }
.join__input {
  width: 100%;
  min-height: 3.25rem;
  padding: .8rem .9rem;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--sheet);
  color: var(--ink);
  font: 400 1.125rem/1.2 var(--sans);
  -webkit-appearance: none;
  appearance: none;
}
.join__input::placeholder { color: var(--pencil); opacity: .75; }
.join__input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.join__trap { position: absolute; left: -9999px; }
.join__error { margin: .6rem 0 0; color: var(--red-ink); font-weight: 700; }
.join__bonus { margin: .7rem 0 0; font: 500 .92rem/1.35 var(--hand); }
.join__note { color: var(--pencil); font-size: .875rem; line-height: 1.4; }
.join__note { margin: .65rem 0 0; }

/* After signing up. */
.done { outline-offset: 6px; }
.done__title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .3rem; font: 700 1.7rem/1.1 var(--serif); }
.done__tick { flex: none; fill: none; stroke: var(--red-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; }
.done__next { margin: 0 0 .5rem; line-height: 1.4; }
.done__dry { display: inline-block; margin: 0 0 .5rem; padding: .3rem .55rem; background: #F1D974; color: #3A3004; font-size: .92rem; }
.done__ask { margin: .5rem 0 .65rem; font: italic 400 1.15rem/1.3 var(--serif); }
.done__copied { margin: .6rem 0 0; font: 500 .92rem/1.3 var(--hand); color: var(--red-ink); }
.done__link { margin-top: .6rem; font-size: 1rem; }

/* The envelope. The wrap holds its back and, in the "addressed" variant, its front. */
.object { position: relative; }
.envelope-defs { position: absolute; }
.envelope-wrap { display: block; width: min(100%, 18.5rem); margin: .1rem auto .9rem; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
button.envelope-wrap { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button.envelope-wrap:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }
button.envelope-wrap.is-front { cursor: default; }
.envelope { display: block; width: 100%; height: auto; transform: rotate(-3deg); }
.envelope--front { display: none; }
.is-front .envelope--back { display: none; }
.is-front .envelope--front { display: block; }
/* The address is written letter by letter; the postmark waits until it lands. */
.envelope__address tspan { stroke: var(--ink); stroke-width: .55; stroke-opacity: 0; stroke-dasharray: 46; }
.envelope__mark { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.is-stamped .envelope__mark { opacity: .92; }
.done.is-waiting { visibility: hidden; }
/* "not yet", written beside the envelope when someone taps it. */
.notyet { position: absolute; right: .1rem; bottom: -.5rem; margin: 0; font: 500 1.4rem/1 var(--hand); color: var(--red-ink); transform: rotate(-7deg); opacity: 0; pointer-events: none; }
.is-trying .notyet { opacity: 1; }

/* The privacy note, and the page of links that "build.py --all" makes. */
.sheet {
  position: relative;
  margin: 1.5rem -.25rem 1rem;
  padding: 2rem 1.35rem 1.25rem;
  background: var(--sheet) url("paper.svg");
  box-shadow: var(--lift);
}
.sheet h1 { font-size: 1.9rem; }
.sheet h2 { margin: 1.3rem 0 .2rem; font: 700 1.05rem/1.2 var(--sans); }
.sheet p { margin: 0 0 .6rem; }
.sheet mark { background: #F1D974; color: #3A3004; padding: 0 .2em; }
.sheet__back { margin-top: 1.5rem; }
.chooser h2 { margin-top: 1.6rem; }
.chooser ul { margin: .5rem 0 0; padding: 0; list-style: none; }
.chooser li { margin: 0; padding: .7rem 0; border-top: 1px solid rgba(29, 41, 70, .16); }
.chooser li a:first-child { display: block; font-weight: 700; font-size: 1.15rem; }
.chooser li span { display: block; color: var(--pencil); font-size: .92rem; line-height: 1.35; }
.chooser li a + a, .chooser li span + a { display: inline-block; margin-top: .3rem; font-size: .95rem; }

/* Movement. The envelope lands once; after that each variant has its own life:
   calm      every few seconds the flap tries to lift, the tape strains, it settles
   peek      the same, further, and a sliver of what is inside shows
   tap       a tap makes it try harder, shudder, and "not yet" is written beside it
   addressed after a sign-up it turns over, the address is written, the postmark lands
   With "reduce motion" on, none of this runs. */
.envelope__flap { transform-box: fill-box; transform-origin: 50% 0; }
.envelope__tape, .envelope__gap { transform-box: fill-box; transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {
  .envelope--back { animation: land .7s cubic-bezier(.2, .8, .3, 1.15) both, nudge 5.2s 1.6s ease-in-out infinite; }
  .envelope__flap { animation: flap 5.2s 1.6s ease-in-out infinite; }
  .envelope__tape { animation: strain 5.2s 1.6s ease-in-out infinite; }
  .envelope__gap { animation: gap 5.2s 1.6s ease-in-out infinite; }

  .env-peek .envelope--back { animation: land .7s cubic-bezier(.2, .8, .3, 1.15) both, peek-nudge 6.4s 1.6s ease-in-out infinite; }
  .env-peek .envelope__flap { animation: peek-flap 6.4s 1.6s ease-in-out infinite; }
  .env-peek .envelope__tape { animation: peek-strain 6.4s 1.6s ease-in-out infinite; }
  .env-peek .envelope__gap { animation: peek-gap 6.4s 1.6s ease-in-out infinite; }

  .is-trying .envelope-wrap { animation: shudder 1.15s ease-in-out; }
  .is-trying .envelope__flap { animation: try-flap 1.15s ease-in-out; }
  .is-trying .envelope__tape { animation: try-strain 1.15s ease-in-out; }
  .is-trying .envelope__gap { animation: try-gap 1.15s ease-in-out; }
  .is-trying .notyet { animation: notyet 2.1s ease-out both; }

  .envelope-wrap.is-turning-out { animation: turn-out .22s ease-in forwards; }
  .envelope-wrap.is-turning-in { animation: turn-in .3s cubic-bezier(.2, .8, .3, 1.2); }
  .is-writing .envelope__address tspan { animation: write .45s ease-out both; }
  .is-stamped .envelope__mark { animation: stamp .2s cubic-bezier(.6, 0, .9, .5) both; }
  .envelope-wrap.is-stamped { animation: thud .32s .18s ease-out; }
  .done.is-arriving { animation: arrive .45s ease-out both; }
  .done:not([hidden]) .done__tick { animation: draw .5s .1s ease-out both; }
}
@keyframes land { from { opacity: 0; transform: translateY(-18px) rotate(-8deg); } }
@keyframes nudge {
  0%, 76%, 100% { transform: rotate(-3deg); }
  81% { transform: rotate(-3.3deg); }
  89% { transform: rotate(-3.7deg) translateY(-1px); }
  96% { transform: rotate(-2.85deg); }
}
@keyframes flap {
  0%, 76%, 100% { transform: scaleY(1); }
  81% { transform: scaleY(.972); }
  84% { transform: scaleY(.992); }
  89% { transform: scaleY(.945); }
  92% { transform: scaleY(.953); }
  96% { transform: scaleY(1.006); }
}
@keyframes strain {
  0%, 76%, 100% { transform: none; }
  81% { transform: translateY(-2px) rotate(-.9deg); }
  84% { transform: translateY(-.5px); }
  89% { transform: translateY(-4.2px) rotate(-1.8deg) scaleX(1.02); }
  92% { transform: translateY(-3.6px) rotate(-1.4deg) scaleX(1.015); }
  96% { transform: translateY(.5px); }
}
@keyframes gap {
  0%, 76%, 100% { opacity: .4; transform: none; }
  81% { opacity: .5; transform: translateY(1.5px); }
  89%, 92% { opacity: .68; transform: translateY(3.5px); }
}
/* peek and tap: the hinge stays put, the tip is pushed up and a little to one side,
   so the flap's left edge opens (matrix: the third number leans it, the fourth lifts it). */
@keyframes peek-nudge {
  0%, 60%, 100% { transform: rotate(-3deg); }
  64% { transform: rotate(-3.3deg); }
  73%, 85% { transform: rotate(-3.9deg) translateY(-1px); }
  92% { transform: rotate(-2.85deg); }
}
@keyframes peek-flap {
  0%, 60%, 100% { transform: matrix(1, 0, 0, 1, 0, 0); }
  64% { transform: matrix(1, 0, .02, .965, 0, 0); }
  67% { transform: matrix(1, 0, 0, .992, 0, 0); }
  73% { transform: matrix(1, 0, .125, .815, 0, 0); }
  85% { transform: matrix(1, 0, .118, .826, 0, 0); }
  91% { transform: matrix(1, 0, 0, 1.006, 0, 0); }
}
@keyframes peek-strain {
  0%, 60%, 100% { transform: none; }
  64% { transform: translate(1px, -2.5px) rotate(-1deg); }
  67% { transform: translateY(-.5px); }
  73% { transform: translate(5px, -8px) rotate(-3.2deg) scaleX(1.03); }
  85% { transform: translate(3.7px, -6.4px) rotate(-2.7deg) scaleX(1.025); }
  91% { transform: translateY(.6px); }
}
@keyframes peek-gap {
  0%, 60%, 100% { opacity: .4; transform: none; }
  73%, 85% { opacity: .7; transform: translateY(4px); }
}
@keyframes shudder {
  0%, 100% { transform: none; }
  18% { transform: rotate(-.6deg); }
  30% { transform: rotate(.2deg); }
  50% { transform: rotate(-1.4deg) translate(1px, -2px); }
  60% { transform: rotate(.9deg) translateX(-2px); }
  70% { transform: rotate(-.8deg) translateX(2px); }
  80% { transform: rotate(.4deg) translateX(-1px); }
  90% { transform: rotate(-.2deg); }
}
@keyframes try-flap {
  0%, 100% { transform: matrix(1, 0, 0, 1, 0, 0); }
  18% { transform: matrix(1, 0, .03, .95, 0, 0); }
  30% { transform: matrix(1, 0, .01, .985, 0, 0); }
  50% { transform: matrix(1, 0, .125, .815, 0, 0); }
  66% { transform: matrix(1, 0, .116, .828, 0, 0); }
  84% { transform: matrix(1, 0, 0, 1.008, 0, 0); }
}
@keyframes try-strain {
  0%, 100% { transform: none; }
  18% { transform: translate(1px, -2.5px) rotate(-1deg); }
  30% { transform: translateY(-.5px); }
  50% { transform: translate(5px, -8px) rotate(-3.2deg) scaleX(1.03); }
  66% { transform: translate(3.6px, -6.2px) rotate(-2.6deg) scaleX(1.025); }
  84% { transform: translateY(.6px); }
}
@keyframes try-gap {
  0%, 100% { opacity: .4; transform: none; }
  50%, 66% { opacity: .7; transform: translateY(4px); }
}
@keyframes notyet {
  0% { opacity: 1; clip-path: inset(-40% 100% -40% -5%); }
  24%, 76% { opacity: 1; clip-path: inset(-40% -5% -40% -5%); }
  100% { opacity: 0; clip-path: inset(-40% -5% -40% -5%); }
}
@keyframes turn-out { to { transform: translateY(-8px) scaleX(.03); } }
@keyframes turn-in { from { transform: translateY(-8px) scaleX(.03); } }
@keyframes write {
  0% { fill-opacity: 0; stroke-opacity: 1; stroke-dashoffset: 46; }
  65% { fill-opacity: .15; stroke-opacity: 1; stroke-dashoffset: 0; }
  100% { fill-opacity: 1; stroke-opacity: 0; stroke-dashoffset: 0; }
}
@keyframes stamp { from { opacity: 0; transform: scale(1.8) rotate(7deg); } }
@keyframes thud { 30% { transform: translateY(3px) rotate(.4deg); } 60% { transform: translateY(-1px); } }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } }
@keyframes draw { from { stroke-dashoffset: 48; } to { stroke-dashoffset: 0; } }

/* Wider than a phone: the envelope on the left, the words beside it. */
@media (min-width: 56rem) {
  .page { max-width: 68rem; padding: 2rem 3rem 1.5rem; }
  .hero { display: grid; grid-template-columns: 1fr 1fr; gap: 4.5rem; align-items: center; }
  h1 { font-size: clamp(2.6rem, 4.2vw, 3.5rem); margin-bottom: .9rem; }
  .lede { font-size: 1.5rem; margin-bottom: 1.5rem; }
  .join__row { grid-template-columns: 1fr auto; }
  .tape { width: auto; padding-inline: 1.9rem; }
  .envelope-wrap { width: 100%; max-width: 31rem; margin: 0 auto; }
  .notyet { right: 8%; font-size: 1.9rem; }
  .strip { width: 8.5rem; height: 2.1rem; margin-left: -4.25rem; top: -1rem; }
  .sheet { max-width: 36rem; margin: 2.5rem auto 1rem; padding: 2.75rem 2.5rem 1.75rem; }
}

/* The picture for link previews (og-card.html, photographed by shoot.mjs): the app's
   dotted paper, the name as a rubber stamp, a strip of tape. Nothing about the secret,
   because networks keep it for weeks and the address later becomes the app's own page. */
.og body { width: 1200px; height: 630px; overflow: hidden; background: #FBF7EE radial-gradient(circle at center, #DCD2BD 1.7px, transparent 2.3px) 0 0 / 30px 30px; }
.og__card { position: relative; display: grid; place-items: center; height: 630px; }
.og__stamp { display: block; margin-top: 26px; transform: rotate(-5deg); }
.og__tape { position: absolute; top: -22px; left: 50%; width: 270px; height: 76px; margin-left: -135px; background: var(--tape) url("paper.svg"); opacity: .95; clip-path: var(--teeth); transform: rotate(2.5deg); }
