:root {
  --cream: #fbf6ec;
  --pine: #1f4d3a;
  --cranberry: #b0302b;
  --gold: #c9a24a;
  --ink: #3a2a1e;
  --shadow: rgba(31, 77, 58, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 252, 245, 0.4) 0%, rgba(251, 246, 236, 0) 40%);
  background-blend-mode: multiply, normal;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
.site-logo {
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--pine);
  line-height: 1.25;
}

a {
  color: var(--pine);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--cranberry);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.site-header {
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(31, 77, 58, 0.15);
  background: rgba(251, 246, 236, 0.94);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--pine);
}

.site-container {
  width: 100%;
  margin-inline: auto;
  padding-inline: max(1.25rem, env(safe-area-inset-left), env(safe-area-inset-right));
}

.site-container.wrap {
  max-width: 42rem;
}

.site-container.wrap-wide {
  max-width: 56rem;
}

/* Legacy aliases */
.wrap,
.wrap-wide {
  width: 100%;
  max-width: inherit;
}

.hero {
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
}

.lead {
  font-size: 1.125rem;
  max-width: 38rem;
}

.snowflake-divider {
  display: block;
  margin: 2rem auto;
  color: var(--gold);
}

.stationery-frame {
  position: relative;
  background: #fffef8;
  border: 3px double var(--gold);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px var(--pine),
    0 10px 28px var(--shadow);
}

.stationery-frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(31, 77, 58, 0.12);
  pointer-events: none;
  border-radius: 1px;
}

.tool-card {
  padding: 1.35rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.field-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .field-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

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

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(31, 77, 58, 0.35);
  border-radius: 3px;
  font: inherit;
  background: var(--cream);
  color: var(--ink);
}

.field-textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.field-hint {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-weight: 600;
  border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--pine);
  color: var(--cream);
  border-color: var(--pine);
}

.btn-primary:hover {
  background: #163a2c;
}

.btn-secondary {
  background: transparent;
  color: var(--pine);
  border-color: var(--pine);
}

.btn-block {
  width: 100%;
  margin-top: 0.75rem;
}

.field-error {
  color: var(--cranberry);
  font-weight: 600;
}

#turnstile-container {
  margin: 1rem 0;
}

.stationery {
  position: relative;
  background: #fffef8;
  border: 3px double var(--gold);
  padding: 1.5rem 1.25rem 3rem;
  margin: 1rem 0;
  box-shadow: inset 0 0 0 1px var(--pine);
}

.letterhead {
  font-family: 'Libre Baskerville', Georgia, serif;
  text-align: center;
  font-size: 0.95rem;
  color: var(--pine);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.letter-body p {
  margin: 0 0 1rem;
}

.letter-blur-fake {
  filter: blur(6px);
  user-select: none;
  pointer-events: auto;
  opacity: 0.85;
}

.wax-seal {
  position: absolute;
  right: 1rem;
  bottom: 0.75rem;
  opacity: 0.95;
}

.word-counter {
  font-size: 0.9rem;
  text-align: center;
  color: var(--pine);
}

.paywall-card {
  background: #fff;
  border: 2px solid var(--cranberry);
  padding: 1.25rem;
  margin-top: 1rem;
  border-radius: 4px;
}

.paywall-modal {
  position: fixed;
  inset: 0;
  background: rgba(58, 42, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.paywall-modal .paywall-card {
  max-width: 24rem;
  margin: 0;
}

.pricing-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .pricing-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.price-card {
  border: 2px solid var(--pine);
  padding: 1.25rem;
  background: #fffef8;
  border-radius: 4px;
}

.price-card.featured {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 74, 0.35);
}

.price-amount {
  font-size: 1.75rem;
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--cranberry);
}

.stamp-sample {
  border: 3px dashed var(--cranberry);
  padding: 1.25rem 1rem 2.75rem;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.55);
}

.sample-stationery {
  border-style: solid;
  border-color: var(--gold);
  border-width: 3px;
  border-style: double;
}

.sample-stationery .wax-seal-static {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
}

.stamp-sample.stationery-frame::before {
  inset: 5px;
  border-color: rgba(176, 48, 43, 0.15);
}

.stamp-sample::before {
  content: 'SAMPLE';
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--cranberry);
  margin-bottom: 0.5rem;
}

.faq details {
  border-bottom: 1px solid rgba(31, 77, 58, 0.2);
  padding: 0.75rem 0;
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--pine);
}

.breadcrumbs {
  font-size: 0.9rem;
  margin: 1rem 0;
}

.breadcrumbs a {
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.content-links {
  margin: 1.5rem 0 0;
}

.site-footer {
  margin-top: 3rem;
  padding: 2.5rem 0 2rem;
  border-top: 3px double rgba(201, 162, 74, 0.55);
  background: linear-gradient(180deg, rgba(31, 77, 58, 0.04) 0%, rgba(31, 77, 58, 0.08) 100%);
  font-size: 0.9rem;
}

.footer-inner {
  text-align: center;
}

.footer-inner .snowflake-divider {
  margin: 0 auto 1.25rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.footer-wordmark {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-weight: 700;
  color: var(--pine);
  margin: 0;
  font-size: 1.05rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.site-footer nav a {
  text-decoration: none;
  font-weight: 600;
}

.site-footer nav a:hover {
  text-decoration: underline;
}

.footer-refund {
  opacity: 0.9;
  font-size: 0.85rem;
}

.checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 42, 30, 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.checkout-panel {
  background: var(--cream);
  border: 2px solid var(--pine);
  max-width: 26rem;
  width: 100%;
  padding: 1.5rem;
  position: relative;
  max-height: 90vh;
  overflow: auto;
}

.checkout-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: var(--pine);
}

.payment-disabled {
  background: #e8e4da;
  padding: 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  opacity: 0.95;
}

.plan-choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plan-choice {
  text-align: left;
  padding: 0.75rem;
  border: 2px solid var(--pine);
  background: #fffef8;
  cursor: pointer;
  font: inherit;
}

.plan-choice.is-selected {
  border-color: var(--gold);
}

.content-section {
  margin: 2.5rem 0;
}

@media print {
  body * {
    visibility: hidden;
  }
  .stationery-full,
  .stationery-full * {
    visibility: visible;
  }
  .stationery-full {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
    box-shadow: none;
    padding: 0.75in;
  }
  @page {
    size: 8.5in 11in;
    margin: 0.75in;
  }
  .letter-actions,
  .site-header,
  .site-footer,
  .tool-card,
  .hero,
  .content-section {
    display: none !important;
  }
}
