@font-face {
  font-family: "Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #eef1f5;      /* page */
  --envelope: #ffffff;   /* surfaces that hold a secret */
  --ink: #18233a;
  --muted: #59647a;
  --rule: #c9d0dc;
  --tint: #2d44a0;       /* security-envelope blue: the one accent */
  --tint-wash: #e2e7f6;
  --burn: #a8204b;       /* destructive actions and errors only */
  --sans: "Plex Sans", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, monospace;
  --measure: 36rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.masthead {
  display: flex;
  align-items: center;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.wordmark {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--tint);
  text-decoration: none;
}

.page {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 1.25rem;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0 0 1rem;
}

p { margin: 0 0 1rem; }
a { color: var(--tint); text-underline-offset: 0.18em; }
code { font-family: var(--mono); font-size: 0.92em; }

.hint { color: var(--muted); font-size: 0.875rem; margin: 0.4rem 0 0; }
.lede { color: var(--muted); font-size: 1.125rem; max-width: 32rem; }
.error { color: var(--burn); font-weight: 600; margin: 0.75rem 0 0; }
.optional { color: var(--muted); font-weight: 400; }

.steps {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.6rem 0 0.6rem 2.5rem;
  border-top: 1px solid var(--rule);
}
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--tint-wash);
  color: var(--tint);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.6rem;
  text-align: center;
}

/* Forms */

label { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.35rem; }

input, select, textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  background: var(--envelope);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible,
.secret:focus-visible {
  outline: 3px solid var(--tint);
  outline-offset: 2px;
}

button {
  font: 600 1rem/1 var(--sans);
  color: #fff;
  background: var(--tint);
  border: 0;
  border-radius: 6px;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: #22367f; }
button:disabled { opacity: 0.55; cursor: default; }
button.quiet {
  background: transparent;
  color: var(--tint);
  padding: 0.5rem 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
button.danger {
  background: transparent;
  color: var(--burn);
  border: 1px solid currentColor;
  padding: 0.5rem 0.8rem;
  font-size: 0.875rem;
}
button.danger:hover { background: var(--burn); color: #fff; }

.inline { display: flex; gap: 0.5rem; }
.inline input { flex: 1; min-width: 0; }

/* The envelope: white paper holding the secret, covered by the blue security tint until opened. */

.envelope {
  position: relative;
  background: var(--envelope);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 1.75rem 0;
  box-shadow: 0 1px 0 var(--rule), 0 12px 24px -16px rgba(24, 35, 58, 0.35);
}

.secret {
  display: block;
  margin: 0;
  min-height: 9rem;
  padding: 1.25rem 1.25rem;
  font: 400 1rem/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 0;
  border-radius: 4px;
  resize: vertical;
}
.envelope.compose:focus-within { outline: 3px solid var(--tint); outline-offset: 2px; }
.envelope.compose .secret:focus-visible { outline: none; }

.tint {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background-color: var(--tint-wash);
  background-image:
    repeating-linear-gradient(45deg, transparent 0 5px, rgba(45, 68, 160, 0.55) 5px 6px),
    repeating-linear-gradient(-45deg, transparent 0 5px, rgba(45, 68, 160, 0.35) 5px 6px),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(45, 68, 160, 0.25) 11px 12px);
  clip-path: inset(0 0 0 0);
}

/* Opening: the tint tears off from left to right. The one animation in the app. */
.envelope.opened .tint {
  animation: tear 700ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
@keyframes tear {
  to { clip-path: inset(0 0 0 100%); }
}

.open-form label { margin-top: 0; }
.open-form input { margin: 0.5rem 0 1rem; }
.after { margin-top: -0.5rem; }

/* Dashboard */

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1rem;
  margin-bottom: 1.5rem;
}
.options .field:first-child { grid-column: 1 / -1; max-width: 12rem; }

.result {
  margin: 1.75rem 0 0;
  padding: 1.25rem;
  background: var(--tint-wash);
  border-radius: 6px;
}
.result input { font-family: var(--mono); font-size: 0.875rem; }
.result .quiet { margin-top: 0.75rem; }

.sent, .how { margin-top: 4rem; }
.sent-list { list-style: none; margin: 0; padding: 0; }
.sent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}
.sent-item:last-child { border-bottom: 1px solid var(--rule); }
.sent-label { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sent-status { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.875rem; }
.sent-item.is-waiting .sent-label::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.5rem 0.12rem 0;
  border-radius: 50%;
  background: var(--tint);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] { display: none !important; }

@media (max-width: 34rem) {
  .page { padding-top: 2.25rem; }
  .inline { flex-direction: column; }
  .options { grid-template-columns: 1fr; }
  .options .field:first-child { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .envelope.opened .tint { animation: none; clip-path: inset(0 0 0 100%); }
}
