:root {
  --paper: #f5f2eb;        /* warm paper, the page */
  --paper-deep: #ebe6dc;   /* the darker edge of the page */
  --card: #fffdf8;         /* the form sheet */
  --ink: #171614;          /* words and hairlines */
  --ink-soft: rgba(23, 22, 20, 0.58);
  --ink-faint: rgba(23, 22, 20, 0.16);
  --accent: #2f5bd3;       /* the only accent: the button, the trail, the rule */
  --pill-ink: #fbfaf6;
  --sans: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, monospace;
  --w: min(420px, 88vw);   /* the card, measured on the width */
  --gap: clamp(6px, 1.6vh, 12px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(110% 90% at 50% 42%, var(--paper) 50%, var(--paper-deep) 100%);
}

.grain {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.eyebrow {
  font-family: var(--mono);
  font-size: clamp(9px, 1.7vh, 11px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* the form sheet */
.card {
  grid-area: 1 / 1;
  position: relative;
  width: var(--w);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: clamp(14px, 3.4vh, 26px) clamp(14px, 4vw, 26px);
  background: var(--card);
  border: 1px solid var(--ink-faint);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 18px 40px -22px rgba(23, 22, 20, 0.35), 0 2px 6px -2px rgba(23, 22, 20, 0.12);
  overflow: hidden;
  transform-origin: 50% 0%;
}

.card__head { display: grid; gap: 4px; margin-bottom: 2px; }
.card__title {
  font-size: clamp(16px, 3.4vh, 22px);
  font-weight: 600;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.01em;
}

.field {
  position: relative;
  display: grid;
  gap: 3px;
  padding: clamp(6px, 1.4vh, 9px) 12px;
  border: 1px solid var(--ink-faint);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.field__label { font-size: clamp(9px, 1.6vh, 11px); color: var(--ink-soft); }
.field__value, .line { font-size: clamp(12px, 2.3vh, 14px); white-space: nowrap; }
.field__lines { display: grid; gap: 1px; }
.line { display: block; overflow: hidden; text-overflow: clip; }

/* the pill of the site: the label widens on the wdth axis, the background swells */
.pill {
  position: relative;
  align-self: flex-start;
  margin-top: 2px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: clamp(9px, 2vh, 12px) 20px;
  color: var(--pill-ink);
  font: 600 clamp(12px, 2.3vh, 14px) / 1 var(--sans);
  font-variation-settings: "wdth" 100;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.pill__bg {
  position: absolute; inset: 0; z-index: -1;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 8px 18px -10px var(--accent);
}
.pill__work {
  position: absolute; left: 20px; right: 20px; bottom: 6px; height: 1px;
  background: rgba(255, 255, 255, 0.75);
  transform: scaleX(0); transform-origin: 0 50%;
}
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }

/* the shading that crosses the sheet while it folds */
.fold {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(23, 22, 20, 0) 0%, rgba(23, 22, 20, 0.12) 50%, rgba(255, 255, 255, 0.4) 52%, rgba(23, 22, 20, 0) 100%);
}

/* the envelope */
.envelope {
  grid-area: 1 / 1;
  position: relative;
  z-index: 2;
  width: 132px; height: 88px;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}
.envelope__body { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.envelope__flap, .envelope__fold { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.envelope__fold { stroke: var(--ink-soft); stroke-width: 1; }

.trail { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail path { fill: none; stroke: var(--accent); stroke-width: 1; stroke-linecap: round; }

/* the thank-you page */
.thanks {
  grid-area: 1 / 1;
  width: var(--w);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: clamp(6px, 1.6vh, 12px);
  visibility: hidden;
}
.thanks__title {
  font-size: clamp(26px, 7vh, 46px);
  font-weight: 600;
  font-variation-settings: "wdth" 92;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.thanks__lede { font-size: clamp(13px, 2.6vh, 16px); color: var(--ink-soft); }
.thanks__rule { width: 64px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 50% 50%; margin: 4px 0; }
.back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: clamp(12px, 2.3vh, 14px); font-weight: 600;
  color: var(--ink); text-decoration: none;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--ink-faint);
  transition: border-color 0.3s, background-color 0.3s;
}
.back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@media (hover: hover) {
  .back:hover { border-color: var(--accent); background: #fff; }
  .back:hover svg { transform: translateX(3px); }
}
