/* Resolve the shared typeface when the built page is opened from a subdirectory. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibmplexsans.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 700;
}
.letter-page {
  --kraft: #dac8a8;
  --terracotta: #a75639;
  --section-space: clamp(2rem, 4vw, 4rem);
  padding-top: .55rem;
  font-size: 1.125rem;
}
.letter-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 6vw, 6rem);
  padding-bottom: var(--section-space);
}
.letter-hero h1 {
  align-self: end;
  font-size: clamp(3rem, 5.3vw, 5rem);
  line-height: 1.02;
  letter-spacing: -.055em;
  margin: .15em 0 .24em;
}
.letter-hero h1 em { display: inline-block; font-weight: 350; }
.opening { max-width: 49ch; font-size: clamp(1.2rem, 1.6vw, 1.45rem); line-height: 1.4; }
.letter-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.letter-actions .btn { border-radius: 2rem; padding: .68rem 1.2rem; }
.letter-hero .tone {
  margin: 1.05rem 0 0;
  max-width: 61ch;
  color: var(--muted);
  padding-left: .9rem;
  border-left: 2px solid var(--terracotta);
}

/* A postage stamp made from the envelope drawing on the home-page door. */
.postal-art {
  position: relative;
  grid-area: 1 / 2 / 3 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background-color: #e9d9be;
  background-image: radial-gradient(#76533c24 .8px, transparent 1px),
    linear-gradient(125deg, #f6e9d4, transparent 80%);
  background-size: 4px 4px, 100% 100%;
  border: 1px solid #c4b49a;
  border-radius: .7rem;
}
.postage {
  position: relative;
  width: min(55%, 16rem);
  padding: 1rem;
  transform: rotate(-8deg);
  filter: drop-shadow(2px 6px 3px #5d493b35);
}
.postage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff9e9;
  mask: linear-gradient(#000 0 0) center / calc(100% - 10px) calc(100% - 10px) no-repeat,
    radial-gradient(circle at 5px 0, transparent 2.9px, #000 3.5px) top / 10px 5px repeat-x,
    radial-gradient(circle at 5px 100%, transparent 2.9px, #000 3.5px) bottom / 10px 5px repeat-x,
    radial-gradient(circle at 0 5px, transparent 2.9px, #000 3.5px) left / 5px 10px repeat-y,
    radial-gradient(circle at 100% 5px, transparent 2.9px, #000 3.5px) right / 5px 10px repeat-y;
}
.stamp-face {
  position: relative;
  padding: .5rem;
  border: 3px double #877b66;
  background: linear-gradient(0deg, #77897b 0 5%, #bfc4a6 5% 10%, #e9cc89 10% 15%,
    #d99d71 15% 20%, #bf795f 20% 25%, transparent 25%), #efe6d2;
}
.stamp-face svg { display: block; width: 100%; height: auto; }
.postmark {
  position: absolute;
  top: 23%;
  left: 68%;
  width: clamp(3.5rem, 5vw, 5rem);
  aspect-ratio: 1;
  border: 4px double #745e49;
  border-radius: 50%;
  opacity: .58;
  transform: rotate(10deg);
}
.postmark::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 25%;
  width: 6rem;
  height: 50%;
  background: repeating-linear-gradient(0deg, transparent 0 6px, #745e49 6px 7.5px);
}

.letter-and-guide, .context, .feedback {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 5rem);
}
.letter-and-guide, .letter-band { border-top: 1px solid var(--rule); padding-top: var(--section-space); }
.letter-band { margin-top: var(--section-space); }
.letter-page h2 { margin-bottom: .45em; }
.letter-page .credit, .sheet-foot p, .privacy-note, .letter-page .field-hint {
  color: var(--muted);
  font-size: 1rem;
}
.letter-sheet {
  padding: clamp(1.25rem, 3.3vw, 3.2rem);
  border: 1px solid #c4baa5;
  border-radius: .25rem;
  background: linear-gradient(to right, #d07d5c 0 20%, #dfab72 20% 40%, #e7ca86 40% 60%, #bfc9ae 60% 80%, #879c8d 80%)
    top / 100% 5px no-repeat, #fffdf4;
  box-shadow: 2px 3px 0 #e9dfcb, 3px 4px 0 #c9bfab;
}
.sheet-tools, .sheet-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.1rem;
  align-items: center;
  justify-content: space-between;
}
.sheet-tools { border-bottom: 1px solid #ded6c4; padding-bottom: 1rem; margin-bottom: 1.55rem; }
.sheet-links { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.sheet-tools a { display: inline-flex; align-items: center; font-size: 1rem; }
.letter-page .copy-button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; min-width: 8.8rem; }
.copy-button::before {
  content: "";
  width: .7rem;
  height: .88rem;
  border: 1.5px solid;
  border-radius: 2px;
  box-shadow: -3px -3px 0 -1px var(--ink), -3px -3px currentColor;
}
.sheet-foot .copy-button::before { box-shadow: -3px -3px 0 -1px var(--surface), -3px -3px currentColor; }
#letter-text { font-size: clamp(1.125rem, 1.37vw, 1.25rem); line-height: 1.6; user-select: text; }
#letter-text p { max-width: 66ch; margin-bottom: .85em; }
#letter-text p:first-child { font-weight: 550; }
#letter-text p:last-child { font-size: 1.65em; font-weight: 550; font-style: italic; line-height: 1; margin: 0; }
.sheet-foot { margin: 1rem 0 0; }
.sheet-foot p { margin: 0; flex: 1 1 15rem; }
.mo-form-note:empty { margin: 0; }
.copy-error { margin: .6rem 0; font-size: 1rem; }
.guide { padding-left: clamp(1.5rem, 2.5vw, 3rem); border-left: 1px solid var(--rule); }
.guide h3 { margin: 1.2em 0 .6em; font-size: 1.35rem; }
.before-steps h3 { margin: 0; font-size: 1.125rem; }
.before-steps ul { margin: .3rem 0 0; padding-left: 1.2em; }
.guide ol { padding-left: 1.55em; }
.guide ol li { padding-left: .35em; }
.guide li::marker { color: #815037; font-weight: 600; }
.guide h3 + ol { border-top: 1px solid var(--rule); padding-top: .7rem; }
.good-to-know { padding: 1.15rem 1.3rem; background: #f1e8d9; border-radius: .55rem; margin-bottom: 1rem; }
.good-to-know h3, .good-to-know ul, .guide > p:last-child { margin: 0; }
.good-to-know ul { padding: .65rem 0 0 1.1em; }
.good-to-know li + li { margin-top: .65rem; }
.letter-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(2rem, 4.5vw, 5rem);
}
.one-chat blockquote {
  margin: .8rem 0;
  padding: .45rem 1.1rem;
  border-left: 3px solid var(--terracotta);
  font-style: italic;
}
.one-chat blockquote span { -webkit-user-select: all; user-select: all; }
.style-and-tone {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  align-items: center;
}
.style-and-tone > div { flex: 1 1 15rem; }
.slider-drawing { width: 18rem; max-width: 100%; height: auto; pointer-events: none; }
.letter-options p:last-child, .context p:last-child { margin-bottom: 0; }
.background-folds .cass-fold:last-child { border-bottom: 1px solid var(--rule); }
.background-folds h2 { font-size: 1.3rem; }
.background-folds .cass-fold p { margin: .4rem 0 1rem; }
.examples { display: grid; gap: 1.15rem; }
.comparison { border: 1px solid var(--rule); border-radius: .55rem; background: var(--surface); }
.comparison h3 { padding: .8rem 1.2rem; margin: 0; border-bottom: 1px solid var(--rule); font-size: 1.2rem; }
.replies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.replies > div { padding: 1rem 1.2rem; }
.replies > div + div { border-left: 1px solid var(--rule); background: var(--read); border-bottom-right-radius: .5rem; }
.replies h4 { font-size: 1rem; letter-spacing: 0; }
.replies p { margin: 0; }
.feedback { grid-template-columns: minmax(0, 44rem); justify-content: center; row-gap: 0; }
.letter-page .mo-form { width: 100%; max-width: none; }
.letter-page .mo-form-body { gap: 1.3rem; }
.letter-page fieldset { border: 0; padding: 0; margin: 0; }
.letter-page legend { padding: 0; }
.letter-page small, .field-hint { font-weight: 400; }
.letter-page small { font-size: .875rem; color: var(--muted); }
.letter-page .field-hint { margin: -.25rem 0 .45rem; }
.rating-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.rating-options label:not(.sp-check) {
  display: inline-block; align-content: center; margin: 0;
  min-height: var(--tap); padding: .4rem .8rem; border: 1px solid #929e91;
  border-radius: .45rem; background: var(--surface); font-size: 1rem; cursor: pointer;
}
.rating-options input { margin: 0 .2rem 0 0; accent-color: var(--ink); }
.rating-options label:has(:checked) { background: var(--read); border-color: var(--ink); }
.privacy-note { border-top: 1px solid var(--rule); padding-top: 1rem; }
.letter-page .mo-form-note:empty { position: absolute; }

@media (min-width: 52.01rem) {
  .guide { align-self: start; line-height: 1.42; }
  .guide .good-to-know { margin-bottom: 0; }
}
@media (max-width: 52rem) {
  .device-steps { display: flex; flex-direction: column; }
  .phone-steps { order: -1; }
  .letter-and-guide, .letter-options, .context, .feedback { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .guide { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); padding-top: 2rem; }
  .letter-hero { grid-template-columns: minmax(0, 1fr) minmax(0, .65fr); gap: 0 1.5rem; }
}
@media (max-width: 40rem) {
  .letter-hero { grid-template-columns: minmax(0, 1fr) clamp(5rem, 24vw, 8rem); align-items: center; gap: .8rem .55rem; }
  .letter-hero h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); margin: 0; }
  .postal-art { grid-area: 1 / 2; border: 0; background: none; overflow: visible; }
  .postage { width: 92%; padding: .42rem; transform: rotate(6deg); }
  .stamp-face { padding: .1rem; }
  .postmark { display: none; }
  .hero-intro { grid-column: 1 / -1; }
  .letter-actions .btn { padding-inline: .9rem; }
  .letter-page .tone { margin-top: .85rem; }
  .replies { grid-template-columns: minmax(0, 1fr); }
  .replies > div + div { border-left: 0; border-top: 1px solid var(--rule); border-radius: 0 0 .5rem .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-letter *, .pg-letter *::before, .pg-letter *::after { animation: none; transition: none; scroll-behavior: auto; }
}

@media (max-width: 52rem) {
  .letter-page :is(.privacy-note, .form-small) a {
    display: inline-block;
    align-content: center;
    min-height: var(--tap);
  }
}
