:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d6;
  --sheet: #fffdf8;
  --ink: #1c2433;
  --ink-soft: #4a5468;
  --line: #d8cfbc;
  --stamp: #b3372e;
  --stamp-deep: #8f2a23;
  --text-base: clamp(1rem, 0.95rem + 0.3vw, 1.0625rem);
  --space-section: clamp(3rem, 2rem + 4vw, 6rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: var(--text-base);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(179, 55, 46, 0.05), transparent 60%),
    var(--paper);
  line-height: 1.6;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }

/* ---- header ---- */
header.site {
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 231, 0.9);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 0.8rem; }
.wordmark { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.wordmark .dot { color: var(--stamp); }
.header-note { font-size: 0.85rem; color: var(--ink-soft); }

/* ---- hero ---- */
.hero { padding: var(--space-section) 0 2.5rem; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  max-width: 18ch;
}
.hero p.lede { max-width: 52ch; margin-top: 1rem; color: var(--ink-soft); font-size: 1.1em; }
.hero .assurances { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin-top: 1.25rem; font-size: 0.9rem; color: var(--ink-soft); }
.hero .assurances span::before { content: '✓ '; color: var(--stamp); font-weight: 700; }

/* ---- generator layout ---- */
.generator { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 2rem; align-items: start; padding-bottom: var(--space-section); }
@media (max-width: 900px) { .generator { grid-template-columns: 1fr; } }

/* ---- form panel ---- */
.panel {
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.4rem;
}
.panel h2 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 1rem; }
fieldset { border: 0; margin: 0 0 1.1rem; }
fieldset legend { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stamp-deep); margin-bottom: 0.55rem; }
.field { margin-bottom: 0.65rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 0.2rem; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit; font-size: 0.95rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--stamp);
  box-shadow: 0 0 0 3px rgba(179, 55, 46, 0.14);
}
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 0.45rem; }
.check input { accent-color: var(--stamp); width: 1rem; height: 1rem; }
.check label { margin: 0; font-weight: 500; color: var(--ink); }

/* ---- actions ---- */
.actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 700; font-size: 0.98rem;
  padding: 0.75rem 1.2rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background 150ms var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-pay { background: var(--stamp); color: #fff; box-shadow: 0 2px 0 var(--stamp-deep); }
.btn-pay:hover { background: var(--stamp-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: rgba(28, 36, 51, 0.06); }
.pay-note { font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.unlocked-badge { display: none; text-align: center; font-weight: 700; color: var(--stamp-deep); font-size: 0.95rem; }
body.unlocked .btn-pay, body.unlocked .pay-note { display: none; }
body.unlocked .unlocked-badge { display: block; }

/* ---- the document sheet ---- */
.sheet-frame { position: relative; }
.sheet {
  position: relative;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(28, 36, 51, 0.08), 0 12px 40px -12px rgba(28, 36, 51, 0.25);
  padding: clamp(1.5rem, 4vw, 3.2rem);
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.55;
  color: #14181f;
  min-height: 640px;
  overflow: hidden;
}
.sheet h3.doc-title {
  text-align: center; font-size: 1.6rem; letter-spacing: 0.18em;
  text-transform: uppercase; margin-bottom: 0.2rem;
}
.sheet .doc-sub { text-align: center; font-size: 0.85rem; color: #555; margin-bottom: 1.6rem; letter-spacing: 0.04em; }
.sheet .clause { margin-bottom: 0.9rem; text-align: justify; }
.sheet .clause b.n { letter-spacing: 0.06em; }
.sheet .val { border-bottom: 1px solid #999; padding: 0 0.15em; white-space: pre-wrap; }
.sheet .val:empty::after, .sheet .val.empty::after { content: '\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0'; }
.sheet table.spec { width: 100%; border-collapse: collapse; margin: 0.4rem 0 1rem; font-size: 0.93rem; }
.sheet table.spec td { border: 1px solid #bbb; padding: 0.35rem 0.6rem; }
.sheet table.spec td.k { width: 34%; font-weight: 700; background: #f5f2ea; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; margin-top: 2.4rem; }
.sig-block .line { border-bottom: 1px solid #14181f; height: 2.1rem; }
.sig-block .cap { font-size: 0.78rem; color: #444; margin-top: 0.25rem; letter-spacing: 0.03em; }
.notary { margin-top: 2.2rem; border-top: 1px dashed #999; padding-top: 1.2rem; font-size: 0.9rem; }
.notary h4 { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 0.6rem; }

/* watermark (free tier) */
.sheet.wm::before, .sheet.wm::after {
  content: 'PREVIEW · PLAINBILL · PREVIEW';
  position: absolute; left: -10%; width: 120%;
  text-align: center;
  font-size: 3rem; font-weight: 700; letter-spacing: 0.2em;
  color: rgba(179, 55, 46, 0.13);
  transform: rotate(-27deg);
  pointer-events: none;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sheet.wm::before { top: 26%; }
.sheet.wm::after { top: 64%; }

/* ---- content sections ---- */
.content { padding-bottom: var(--space-section); max-width: 720px; }
.content h2 { font-family: var(--serif); font-size: 1.6rem; margin: 2.2rem 0 0.7rem; letter-spacing: -0.01em; }
.content p, .content li { color: var(--ink-soft); margin-bottom: 0.7rem; }
.content ul { padding-left: 1.2rem; }
.content strong { color: var(--ink); }

/* ---- landers ---- */
.lander-cta { margin: 1.6rem 0; }
.type-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.type-links a {
  font-size: 0.88rem; font-weight: 600; text-decoration: none;
  color: var(--ink); border: 1px solid var(--line); background: var(--sheet);
  padding: 0.4rem 0.85rem; border-radius: 999px;
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out);
}
.type-links a:hover { border-color: var(--stamp); background: #fff; }

footer.site { border-top: 1px solid var(--line); padding: 2rem 0 3rem; font-size: 0.82rem; color: var(--ink-soft); }
footer.site p { max-width: 70ch; margin-bottom: 0.5rem; }

/* ---- print ---- */
@media print {
  body { background: #fff; }
  header.site, .hero, .panel, .content, footer.site, .actions, .type-links { display: none !important; }
  .generator { display: block; padding: 0; }
  .sheet { border: 0; box-shadow: none; min-height: auto; padding: 0.25in 0.4in; }
  @page { margin: 0.6in; }
}
