:root {
  --bg: #fbf6ec;
  --ink: #1f2a24;
  --muted: #5f625a;
  --green: #14382a;
  --green-2: #1d4a37;
  --red: #b4232f;
  --red-dark: #8f1a24;
  --gold: #d9b45a;
  --line: #e4d9c5;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 8px 28px rgba(20, 30, 25, .10);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; line-height: 1.12; margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
button { font: inherit; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1.5px solid transparent; border-radius: 999px;
  padding: .62em 1.15em; font-weight: 600; font-size: 15px; line-height: 1.2;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .seg-btn:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #e8b94a; outline-offset: 2px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 2px 0 var(--red-dark); }
.btn-primary:hover { background: #c22a37; }
.btn-primary[disabled] { opacity: .65; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #c9bca4; background: #fffdf8; }
.btn-small { padding: .45em .9em; font-size: 14px; }
.btn-lg { padding: .85em 1.4em; font-size: 16.5px; }
.btn-block { display: flex; width: 100%; }

/* ---------- top bar + hero ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--green); color: #fbf3df;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; }
.nav { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.nav a:not(.btn) { text-decoration: none; opacity: .85; }
.nav a:not(.btn):hover { opacity: 1; text-decoration: underline; }
.nav .btn { background: #fbf3df; color: var(--green); }

.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 70% 0%, #1f5240 0%, var(--green) 60%); color: #fbf3df; }
.snow {
  position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(2px 2px at 30px 40px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 150px 110px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90px 170px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 60px 250px, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 250px 60px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 330px 300px, #fff 50%, transparent 51%);
  background-size: 200px 200px, 200px 200px, 300px 300px, 300px 300px, 400px 400px, 400px 400px;
  animation: snowfall 22s linear infinite;
}
@keyframes snowfall {
  to { background-position: 20px 200px, 20px 200px, -30px 300px, -30px 300px, 40px 400px, 40px 400px; }
}
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } html { scroll-behavior: auto; } }

.hero-inner {
  position: relative; max-width: 1180px; margin: 0 auto;
  padding: clamp(36px, 6vw, 72px) clamp(18px, 4vw, 40px) clamp(48px, 7vw, 88px);
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center;
}
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12.5px; font-weight: 700; color: var(--gold); margin: 0 0 14px; }
.hero h1 { font-size: clamp(36px, 5.2vw, 60px); font-weight: 700; }
.hero h1 em { font-style: italic; color: #f4d27a; }
.lede { font-size: clamp(17px, 1.6vw, 19.5px); max-width: 34em; opacity: .92; margin: 18px 0 26px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.trust { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14.5px; opacity: .9; }
.trust li::before { content: "✓"; color: var(--gold); font-weight: 800; margin-right: 7px; }

.hero-art { position: relative; height: 470px; }
.hero-letter, .hero-cert { position: absolute; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); border-radius: 3px; overflow: hidden; }
.hero-letter { width: 330px; left: 4%; top: 20px; transform: rotate(-3.5deg); }
.hero-cert { width: 390px; right: 0; top: 120px; transform: rotate(5deg); }
.sample-tag {
  position: absolute; top: 14px; right: -34px; transform: rotate(38deg);
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  padding: 4px 40px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* scaling boxes: JS sets --s and the height */
.scale-box { position: relative; width: 100%; overflow: hidden; }
.scale-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform: scale(var(--s, .4)); }

/* ---------- builder ---------- */
.builder { padding: clamp(36px, 6vw, 72px) clamp(16px, 4vw, 40px); }
.builder-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
.form-col {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 30px);
  position: sticky; top: 16px;
}
.form-col h2 { font-size: 28px; }
.form-intro { color: var(--muted); margin: 8px 0 20px; font-size: 15px; }
.field { margin-bottom: 16px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.req { color: var(--red); }
input[type="text"], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fffdf9; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: border-color .15s, background .15s;
}
input[type="text"]:focus, textarea:focus { border-color: #c79a3e; background: #fff; outline: none; }
input::placeholder, textarea::placeholder { color: #a6a294; }
.prefix-input { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf9; overflow: hidden; }
.prefix-input:focus-within { border-color: #c79a3e; background: #fff; }
.prefix-input .prefix { flex: 0 0 auto; padding: 10px 0 10px 12px; color: var(--muted); font-style: italic; white-space: nowrap; font-size: 15px; align-self: center; }
.prefix-input input { border: none; background: transparent; padding-left: 6px; min-width: 0; }
.prefix-input input:focus { background: transparent; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.mobile-only { display: none; }

.preview-col { min-width: 0; scroll-margin-top: 12px; }
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.seg { display: inline-flex; background: #efe6d4; border-radius: 999px; padding: 4px; align-self: flex-start; max-width: 100%; }
.seg-btn { border: none; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14.5px; cursor: pointer; color: var(--muted); }
.seg-btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tool-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-right: 4px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip.is-active { border-color: var(--green); background: var(--green); color: #fff; }
.letter-tools .btn { font-size: 14px; padding: .45em .95em; }
.view-cert .letter-tools, .view-cert .editor { display: none !important; }

.editor { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.editor label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.editor textarea { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 18px; line-height: 1.45; resize: vertical; min-height: 220px; }
.editor-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; }
.editor-note { font-size: 13px; color: var(--muted); }

.stage-wrap { position: relative; }
/* Inactive stage stays laid out (so text can be measured) but is invisible. */
.stage { position: absolute; left: 0; top: 0; width: 100%; visibility: hidden; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 16px 40px rgba(40, 30, 10, .16); }
.stage.is-active { position: relative; visibility: visible; }
.stage .scale-box { border-radius: 4px; }

.buy-card {
  margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 26px); scroll-margin-top: 12px;
}
.buy-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.buy-head h3 { font-size: 22px; }
.price { font-family: 'Fraunces', serif; font-weight: 700; font-size: 30px; color: var(--red); }
.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: 15px; }
.checks li::before { content: "✓"; color: var(--green-2); font-weight: 800; margin-right: 9px; }
.fine { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }
.buy-error { margin: 10px 0 0; font-size: 14px; color: var(--red-dark); background: #fdf0ef; border: 1px solid #f2cdca; border-radius: 10px; padding: 10px 12px; }
.dl-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.dl-row .btn { flex: 1 1 160px; }
.unlocked-only { display: none; }
body.is-unlocked .unlocked-only { display: block; }
body.is-unlocked .locked-only { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--green); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  font-weight: 600; font-size: 15px; z-index: 100; max-width: calc(100% - 32px); text-align: center;
}

/* ---------- how + faq ---------- */
.how, .faq { max-width: 1000px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px); }
.how h2, .faq h2 { font-size: clamp(28px, 3.4vw, 38px); margin-bottom: 22px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step-n { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.steps h3 { font-size: 20px; margin-bottom: 6px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 15px 0; list-style-position: outside; }
.faq details p { margin: 0 0 16px; color: var(--muted); }
.foot { text-align: center; padding: 30px 20px 44px; color: var(--muted); font-size: 13.5px; border-top: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { height: 360px; max-width: 520px; width: 100%; margin: 0 auto; }
  .hero-letter { width: 250px; left: 2%; top: 10px; }
  .hero-cert { width: 300px; right: 0; top: 90px; }
  .builder-inner { grid-template-columns: 1fr; }
  .form-col { position: static; }
  .mobile-only { display: flex; margin-top: 6px; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav a:not(.btn) { display: none; }
  .hero-art { height: 300px; }
  .hero-letter { width: 205px; }
  .hero-cert { width: 250px; top: 80px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .prefix-input { flex-direction: column; }
  .prefix-input .prefix { align-self: flex-start; padding: 8px 12px 0; font-size: 13.5px; }
  .prefix-input input { padding-left: 12px; }
  .seg { align-self: stretch; }
  .seg-btn { flex: 1; padding: 8px 10px; font-size: 14px; }
}

/* ---------- print (only after unlock) ---------- */
#printRoot, .print-locked { display: none; }
@page { size: letter portrait; margin: 0; }
@page certpage { size: letter landscape; margin: 0; }
@media print {
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .site, .toast { display: none !important; }
  body.is-unlocked #printRoot { display: block; }
  body.is-locked .print-locked { display: block; font: 600 18pt Georgia, serif; text-align: center; padding-top: 3in; }
  .print-page { width: 8.5in; height: 10.98in; overflow: hidden; break-after: page; page-break-after: always; }
  .print-page.cert-page { page: certpage; width: 11in; height: 8.48in; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page .sheet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
