@font-face {
  font-family: "Post Typewriter";
  src: url("assets/fonts/NimbusMonoPS-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f8f4e9;
  --ink: #332f29;
  --muted: #635b50;
  --red: #9f4333;
  --red-dark: #833426;
  --rule: #c6bcaa;
  --grain: url("assets/paper.webp");
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(#f8f4e970, #f8f4e970), var(--grain) repeat, var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.53 "Post Typewriter", "Courier New", Courier, monospace;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; }
button, a, input, select { color: inherit; }
button, select, .check-label { cursor: pointer; }
button { background: none; }
a { text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 400; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #345e55;
  outline-offset: 5px;
}
::selection { background: #e5d49b; color: #29251f; }
[hidden] { display: none !important; }
.wrap { width: min(87.5%, 1160px); margin-inline: auto; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon, .card-postage svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}
.icon { width: 1.28em; height: 1.28em; flex: none; }
.skip { position: fixed; inset: 12px auto auto 12px; padding: 10px; background: var(--paper); z-index: 5; transform: translateY(-160%); }
.skip:focus { transform: none; }

.site-header { position: relative; padding-top: 4px; border-bottom: 1px solid var(--rule); }
.site-header::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: var(--grain), repeating-linear-gradient(125deg, #a8503d 0 15px, #eee5ce 15px 28px, #708780 28px 43px, #eee5ce 43px 57px);
}
.sitebar {
  min-height: 78px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: clamp(22px, 3.5vw, 54px);
  align-items: center;
}
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 9px; width: fit-content; font-size: 1.85rem; line-height: 1; letter-spacing: -.07em; }
.brand img { display: block; }
.brand span { padding-top: .06em; }
.nav-links { display: flex; align-items: center; gap: clamp(18px, 2.5vw, 38px); }
.nav-links a { padding-block: 10px; font-size: .97rem; }
.nav-links a:hover, .text-button:hover { color: var(--red-dark); background-color: #eae0ca80; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 9px;
  min-height: 44px; padding: 10px 18px;
  border: 1.45px solid var(--ink); border-radius: 2px 3px 2px 2px;
  background: var(--grain), #faf6ea; line-height: 1.25; font-size: 1rem;
  box-shadow: 1px 2px 0 #54453742;
  transition: background-color .15s, box-shadow .15s, transform .15s;
}
.button:hover { background-color: #eee5d1; transform: translateY(-1px); box-shadow: 1px 3px 0 #54453742; }
.button:active { transform: translateY(1px); box-shadow: none; }
.header-send { color: var(--red-dark); border-color: #a36b55; min-height: 39px; font-size: .95rem; padding: 7px 13px; box-shadow: none; }
.header-send .icon { width: 17px; height: 17px; }
.red-button { color: #fffaf0; background-color: var(--red); border-color: #803726; box-shadow: 2px 3px 0 #5d45324d; }
.red-button:hover { background-color: var(--red-dark); }
.desk {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center; gap: clamp(24px, 5vw, 76px);
  padding-top: clamp(44px, 5.5vw, 80px);
}
h1 { font-size: clamp(2.45rem, 4.3vw, 4rem); line-height: 1.09; letter-spacing: -.06em; text-wrap: balance; }
.welcome-note { margin: 14px 0 23px; max-width: 43ch; color: #49443e; line-height: 1.5; }
.text-button { padding: 6px 2px; border: none; color: var(--red-dark); font-size: .98rem; }

.daily { position: relative; isolation: isolate; scroll-margin-top: 22px; }
.daily::before {
  content: ""; position: absolute; z-index: -1; inset: 4px 2px -3px 3px;
  background: #e5d7af; border: 1px solid #c3b28e; transform: rotate(.32deg); box-shadow: 1px 3px 5px #5844211c;
}
.note-paper {
  position: relative; display: grid; grid-template-columns: 75px minmax(0, 1fr); align-items: stretch;
  border: 1px solid #c5b68e;
  background: var(--grain), repeating-linear-gradient(transparent 0 26px, #a4683a19 26px 27px), #f5e9ba;
}
.note-paper::before {
  content: ""; position: absolute; z-index: 1; width: 60px; height: 17px; top: -7px; left: 8px;
  transform: rotate(-8deg);
  background: var(--grain), repeating-linear-gradient(90deg, #edddb91a 0 2px, #b69f681c 2px 3px), #e4d2a1d9;
  clip-path: polygon(1% 9%, 97% 0, 95% 20%, 100% 36%, 96% 56%, 100% 79%, 95% 98%, 1% 96%, 4% 75%, 0 54%, 3% 31%);
}
.date-stub {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  grid-row: span 2; gap: 0; min-height: 158px; padding: 12px 4px 10px;
  border-right: 1px dashed #b59870;
  background: var(--grain), #f1e1ad; color: #7e4831;
  text-transform: uppercase; font-size: .76rem; letter-spacing: .11em; line-height: 1.15;
}
.date-stub .day-number { margin: 3px 0 1px; font-size: 2.5rem; letter-spacing: -.1em; padding-right: .08em; line-height: .9; }
.daily-copy { align-self: center; padding: 19px 22px 0; }
.daily-copy h2 { display: flex; align-items: center; gap: 8px; color: #864533; font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; line-height: 1.35; }
.daily-copy h2 .icon { width: 20px; height: 20px; }
.daily-prompt { margin-top: 7px; font-size: clamp(1.22rem, 1.55vw, 1.45rem); letter-spacing: -.048em; line-height: 1.22; text-wrap: pretty; }
.check-label { display: inline-flex; align-items: center; justify-content: flex-start; gap: 10px; align-self: center; width: fit-content; margin: 1px 22px 6px; min-height: 44px; font-size: .94rem; white-space: nowrap; color: #5b4a34; }
.check-label input { appearance: none; margin: 0; display: grid; place-content: center; width: 20px; height: 20px; border: 1.5px solid #7d6949; border-radius: 1px 2px 1px 2px; background: #fff9df6b; }
.check-label input:checked::after { content: ""; width: 12px; height: 6px; border: solid #375b42; border-width: 0 0 2.5px 2.5px; transform: translateY(-2px) rotate(-48deg); }
.check-label:has(input:checked) { color: #36533e; }
.check-label:hover input { background-color: #fff9df; }

.letter-box { padding: clamp(42px, 4.5vw, 69px) 0 66px; scroll-margin-top: 3px; }
#box-heading { font-size: clamp(2rem, 3vw, 2.75rem); letter-spacing: -.052em; line-height: 1.12; }
.box-intro { color: var(--muted); margin: 5px 0 22px; }
.letter-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 21px; }
.letter-grid li { display: flex; }
.letter-card {
  --stock: #f7efdb;
  --card-ink: #65513d;
  position: relative; isolation: isolate; display: flex; flex-flow: column; align-items: flex-start; gap: 0;
  width: 100%; min-height: 183px; padding: 22px 23px 17px;
  text-align: left; border: 1px solid #cbbfa8; border-radius: 2px 1px 3px 1px;
  box-shadow: 1px 3px 1px #57493219;
  background: var(--grain), var(--stock);
  transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.letter-card:hover, .letter-card:focus-visible { transform: translateY(-3px) rotate(-.35deg); border-color: #988568; box-shadow: 2px 6px 6px #55432824; }
.letter-card[data-paper="swallow"] { --stock: #e7eeea; --card-ink: #445f65; border-radius: 1px 2px 2px 3px; }
.letter-card[data-paper="sunrise"] { --stock: #f3e4d9; --card-ink: #895943; }
.letter-card[data-paper="teacup"] { --stock: #f3e7d9; --card-ink: #835543; }
.letter-card[data-paper="sprout"] { --stock: #e9ebd9; --card-ink: #506044; }
.letter-card[data-paper="moon"] { --stock: #eee6e4; --card-ink: #6e535e; }
.card-postage { position: absolute; top: 13px; right: 14px; width: 69px; transform: rotate(5deg); pointer-events: none; }
.letter-card[data-paper="swallow"] .card-postage, .letter-card[data-paper="teacup"] .card-postage { transform: rotate(-4deg); }
.card-stamp { display: block; width: 100%; height: auto; filter: drop-shadow(0 1px 1px #49382136); }
.card-postage svg { position: absolute; width: 42px; height: 22px; left: -16px; bottom: 7px; transform: rotate(-11deg); color: #5a493f; opacity: .64; stroke-width: 1.5px; }
.card-mood { color: var(--card-ink); font-size: .875rem; letter-spacing: .014em; max-width: calc(100% - 70px); }
.card-title { margin: 12px 0 19px; font-size: clamp(1.4rem, 1.82vw, 1.75rem); letter-spacing: -.04em; line-height: 1.15; max-width: calc(100% - 78px); }
.card-open { display: flex; align-items: center; gap: 7px; margin-top: auto; font-size: .9rem; color: var(--card-ink); }
.card-open .icon { width: 17px; height: 17px; }
.site-footer { border-top: 1px solid var(--rule); }
.site-footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 85px; }
.site-footer .brand { font-size: 1.25rem; letter-spacing: -.06em; }
.site-footer .text-button { font-size: .93rem; font-weight: 400; }

body:has(dialog[open]) { overflow: hidden; }
dialog { width: min(660px, calc(100% - 32px)); max-height: 88vh; max-height: 88dvh; border: 1px solid #ae9f85; border-radius: 2px 3px 2px 1px; padding: 36px clamp(24px, 4.4vw, 54px); color: var(--ink); background: var(--grain), #fbf7eb; box-shadow: 2px 8px 35px #211b1440; overscroll-behavior: contain; }
dialog::backdrop { background: #332d2585; }
.close { position: absolute; right: 10px; top: 10px; display: grid; place-content: center; width: 38px; height: 38px; border: none; color: var(--muted); z-index: 1; }
.close:hover { color: var(--red); }
.close .icon { width: 20px; height: 20px; }
dialog h2 { font-size: clamp(1.95rem, 4vw, 2.65rem); letter-spacing: -.045em; line-height: 1.08; margin: 15px 0 22px; padding-right: 8px; }
dialog h2:focus { outline: none; }
dialog p + p, .letter-body p + p { margin-top: 16px; }
.reader-letterhead { display: flex; align-items: center; min-height: 46px; }
.reader-stamp { position: absolute; right: 49px; top: 21px; width: 43px; height: auto; transform: rotate(6deg); }
.letter-mood { max-width: calc(100% - 52px); color: var(--red-dark); font-size: .95rem; }
.letter-body { line-height: 1.65; font-size: 1.09rem; }
.signature { color: var(--red-dark); overflow-wrap: anywhere; margin: 24px 0; white-space: pre-line; }
.modal-actions { border-top: 1px dashed var(--rule); padding-top: 18px; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); }
.fields label { color: var(--ink); margin: 6px 0; }
.fields label span { font-weight: 400; color: var(--muted); }
.fields select, .fields input { padding: 10px 12px; border-radius: 2px; border: 1px solid #ad9f89; background-color: #fffaf0; min-height: 44px; }
.fields select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, #635749 50%), linear-gradient(135deg, #635749 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 11px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.fields input { width: 100%; cursor: text; }
.fields input::placeholder { color: #756a5c; }
.preview { width: fit-content; margin: 4px 0 14px; color: var(--red-dark); font-size: .94rem; }
.sharing-note { font-size: .95rem; line-height: 1.5; color: var(--muted); margin: 18px 0 20px; }
.share-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.share-actions .button { padding: 10px 12px; font-size: .95rem; }
.share-status { font-size: .95rem; overflow-wrap: anywhere; color: #405e44; }
.share-status:not(:empty) { margin-top: 14px; }

@media (max-width: 950px) {
  .wrap { width: 90%; }
  .sitebar { gap: 20px; }
  .nav-links { gap: 17px; }
  .sitebar .brand { font-size: 1.52rem; gap: 6px; white-space: normal; }
  .sitebar .brand span { text-wrap: balance; }
  .sitebar .brand img { width: 38px; height: auto; }
  .header-send { font-size: .89rem; padding: 7px 10px; }
  .note-paper { grid-template-columns: 58px minmax(0, 1fr); }
  .daily-copy { padding-inline: 18px; }
  .note-paper::before { width: 44px; left: 4px; }
  .check-label { margin-left: 18px; }
  .letter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .letter-card { padding: 17px 16px; }
  .card-postage { width: 52px; right: 10px; }
  .card-mood { max-width: calc(100% - 45px); }
  .card-title { max-width: calc(100% - 58px); }
}
@media (max-width: 760px) {
  .brand { font-size: 1.55rem; gap: 5px; }
  .brand img { width: 38px; height: auto; }
  .nav-links a, .header-send { font-size: .87rem; }
  .nav-links { gap: 13px; }
  .header-send { padding: 7px 9px; }
}
@media (max-width: 680px) {
  .sitebar { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0 5px; }
  .nav-links { grid-column: 1 / -1; grid-row: 2; gap: 21px; }
  .nav-links a { padding: 5px 0; }
  .header-send { grid-row: 1; grid-column: 2; }
  .desk { grid-template-columns: 1fr; gap: 31px; padding-top: 33px; }
  h1 { font-size: clamp(2.1rem, 7.8vw, 2.7rem); }
  .welcome-note { margin: 10px 0 17px; }
  .note-paper { grid-template-columns: 65px 1fr; }
  .date-stub { grid-row: 1 / 3; min-height: 120px; }
  .date-stub .day-number { font-size: 2rem; }
  .note-paper::before { width: 44px; left: 8px; }
  .daily-copy { padding: 15px 17px 0; }
  .daily-copy h2 { font-size: .78rem; letter-spacing: .06em; }
  .daily-copy h2 .icon { width: 17px; height: 17px; }
  .daily-prompt { font-size: 1.24rem; margin-top: 5px; }
  .check-label { width: fit-content; margin: 0 0 3px 17px; }
  .check-label input { width: 17px; height: 17px; }
  .box-intro { margin-bottom: 17px; }
}
@media (max-width: 510px) {
  .wrap { width: 89%; }
  .sitebar .brand { font-size: 1.38rem; gap: 4px; }
  .sitebar .brand img { width: 33px; }
  .header-send .icon { display: none; }
  .letter-grid { grid-template-columns: 1fr; }
  .letter-card { min-height: 145px; padding: 16px 20px; }
  .card-title { margin: 8px 0 13px; max-width: calc(100% - 67px); font-size: 1.58rem; }
  .card-postage { right: 14px; top: 13px; width: 60px; }
  .card-mood { max-width: calc(100% - 60px); }
  #box-heading { font-size: 2.15rem; }
  .site-footer .wrap { min-height: 75px; gap: 10px; }
  .site-footer .brand { font-size: 1.03rem; }
  .site-footer .brand img { width: 28px; }
  .site-footer .text-button { font-size: .86rem; }
  dialog { padding: 27px 22px; }
  .fields input { font-size: 1rem; }
  .reader-stamp { width: 32px; }
}
@media (max-width: 365px) {
  .wrap { width: 92%; }
  .sitebar .brand { font-size: 1.25rem; }
  .brand img { width: 33px; }
  .button { padding-inline: 12px; }
  .site-footer .brand img { display: none; }
  #box-heading { font-size: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
@media (forced-colors: active) {
  .check-label input { appearance: auto; }
  .check-label input:checked::after { display: none; }
}
.share-status input { width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--rule); background: #fffaf0; }
