:root {
  --ink: #534d45;
  --muted: #82796e;
  --page: #faf9f7;
  --side: #f4f2ef;
  --line: #dfdad4;
  --dark: #58534c;
  --rail: clamp(190px, 13.2vw, 260px);
  --sans: 'Be Vietnam Pro', Arial, sans-serif;
  --serif: 'Lora', Georgia, serif;
  font: 400 14px/1.55 var(--sans);
  color: var(--ink);
  background: var(--page);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 9px;
  padding: 9px 14px;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover {
  background-color: #ede9e3;
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
[hidden] {
  display: none !important;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.piece:focus-visible {
  outline: 2px solid #9c5142;
  outline-offset: 3px;
}
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn {
  border: 0;
  padding: 6px;
}
.primary {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}
.primary:hover,
.split > button:hover {
  background: #47423c;
}
.subtle {
  border: 0;
  padding: 7px 4px;
  color: #756b60;
}
.subtle:hover {
  background: transparent;
  text-decoration: underline;
}
.brand {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  line-height: 1;
  text-decoration: none;
}
.brand-heart {
  width: 30px;
  height: 27px;
  object-fit: contain;
}
.signature {
  width: 75px;
  height: 35px;
  object-fit: contain;
}
.brand:focus-visible {
  border-radius: 5px;
}
h1,
h2 {
  font: italic 500 clamp(40px, 4.65vw, 76px) / 1.22 var(--serif);
  letter-spacing: -0.05em;
  margin: 0 0 21px;
  color: #5d564d;
}
h2 {
  font-size: clamp(28px, 3vw, 39px);
}
p {
  margin: 0 0 17px;
}
small,
.hint {
  color: var(--muted);
  font-size: 12px;
}
label {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}
input:not([type='checkbox']):not([type='range']):not([type='color']),
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d8d3cc;
  border-radius: 9px;
  background: #fcfbf8;
  padding: 11px 13px;
}
textarea {
  resize: vertical;
  min-height: 94px;
}
input::placeholder,
textarea::placeholder {
  color: #958b80;
}
.actions,
.form-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.actions {
  margin: 20px 0;
}
.form-end {
  justify-content: flex-end;
  margin-top: 24px;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.error {
  color: #943b38;
  margin: 16px 0 0;
}
#notice:not(:empty) {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(92vw, 510px);
  border-radius: 10px;
  background: #443d35;
  color: white;
  padding: 10px 18px;
  box-shadow: 0 4px 18px #30231627;
  font-size: 13px;
}
#rail {
  position: fixed;
  z-index: 6;
  inset: 0 auto 0 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  padding: 14px 14px 7px;
  border-right: 1px solid #e1ddd7;
  background: var(--side);
}
#main {
  margin-left: var(--rail);
  min-height: 100dvh;
  outline: none;
}
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 7px;
}
.rail-head .icon-btn {
  color: #8b8277;
}
.nav-item {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 9px 12px;
  font-size: 13px;
  margin: 1px 0;
  border-radius: 10px;
}
.nav-item.active {
  background: #e5e1dc;
  font-weight: 500;
}
.rail-foot {
  margin-top: auto;
  position: relative;
}
#profile {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  padding: 8px 5px;
  gap: 10px;
  font-size: 13px;
}
#profile > .icon {
  margin-left: auto;
  width: 16px;
  color: #8a8177;
}
.avatar {
  flex-shrink: 0;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ece6dc, #d6c6ad);
  color: #37332a;
  display: grid;
  place-items: center;
  font: 600 12px var(--sans);
  letter-spacing: -0.04em;
}
.account-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  width: max(100%, 222px);
  box-shadow: 0 6px 24px #37271c13;
  border: 1px solid #e8e4de;
  border-radius: 12px;
  background: white;
  padding: 9px 0;
}
.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 13px 9px;
}
.identity strong,
.identity small {
  display: block;
  overflow-wrap: anywhere;
}
.identity strong {
  font-weight: 600;
  font-size: 13px;
}
.identity small {
  font-size: 10px;
}
.menu-item {
  border: 0;
  border-radius: 0;
  width: 100%;
  justify-content: flex-start;
  gap: 13px;
  padding: 7px 14px;
  font-size: 12px;
}
.menu-item .icon {
  width: 15px;
  height: 15px;
}
.menu-item.last {
  border-top: 1px solid var(--line);
  margin-top: 5px;
  padding-top: 10px;
}
.mobile-menu {
  display: none;
}
.collapsed {
  --rail: 65px;
}
.collapsed #rail {
  padding-inline: 7px;
}
.collapsed .rail-head {
  flex-direction: column;
  gap: 10px;
}
.collapsed .signature,
.collapsed .nav-item span,
.collapsed #profile span,
.collapsed #profile > .icon {
  display: none;
}
.collapsed .nav-item,
.collapsed #profile {
  justify-content: center;
}
.collections {
  width: min(56.5%, 1110px);
  margin: 0 auto;
  padding: clamp(40px, 6.15vh, 76px) 0 90px;
}
.collection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.collection-head h1 {
  font-size: clamp(30px, 2.08vw, 43px);
  font-weight: 600;
  margin: 0;
}
.split {
  display: flex;
  position: relative;
  flex-shrink: 0;
}
.split > button {
  background: var(--dark);
  border: 0;
  color: white;
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 500;
}
.split > button:first-child {
  border-radius: 10px 0 0 10px;
}
.split > button:nth-child(2) {
  border-radius: 0 10px 10px 0;
  border-left: 1px solid #ffffff38;
  padding-inline: 10px;
}
.split > button:nth-child(2) .icon {
  width: 14px;
}
#more-menu {
  position: absolute;
  z-index: 3;
  top: calc(100% + 5px);
  right: 0;
  border: 1px solid #ded8d0;
  border-radius: 9px;
  padding: 4px;
  background: #fff;
  box-shadow: 0 4px 17px #32231417;
  white-space: nowrap;
}
#more-menu button {
  border: 0;
}
.box-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 1.65vw, 34px);
  margin-top: clamp(38px, 5.8vh, 58px);
}
.box-card {
  display: block;
  text-align: left;
  border: 0;
  padding: 0;
  background: transparent;
  min-width: 0;
}
.box-card:hover {
  background: transparent;
}
.box-card img {
  width: 100%;
  display: block;
  aspect-ratio: 1.32;
  object-fit: fill;
  border-radius: 12px;
  transition:
    transform 0.19s,
    filter 0.19s;
}
.box-card:hover img {
  transform: translateY(-3px) rotate(-0.35deg);
  filter: drop-shadow(0 6px 5px #31211417);
}
.box-card.opening img {
  transform: translateY(-4px) rotate(0.6deg) scale(1.012);
}
.box-card strong,
.box-card small {
  display: block;
  overflow-wrap: anywhere;
}
.box-card strong {
  font-size: 16px;
  color: #35312c;
  margin-top: 9px;
  font-weight: 500;
}
.box-card small {
  font-size: 12px;
  margin-top: 3px;
}
.detail {
  width: min(920px, 84%);
  margin: auto;
  padding: clamp(32px, 6vh, 72px) 0 76px;
}
.detail h1 {
  margin-top: 28px;
}
.dedication {
  font-size: clamp(15px, 1.25vw, 20px);
  color: #7b7165;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.letter-grid,
.read-envelopes {
  display: grid;
  align-items: start;
  gap: 27px;
  grid-template-columns: repeat(auto-fill, minmax(min(245px, 100%), 1fr));
}
.letter-grid {
  margin-top: 40px;
}
.letter-state {
  display: block;
  margin-top: 9px;
}
.envelope {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 375/280;
  padding: 8%;
  text-align: center;
  color: #675843;
  border: 0;
  border-radius: 12px;
  background: #cfb58a url('assets/kraft.webp') center / 100% 100% no-repeat;
  box-shadow: 0 1px 2px #51402e14;
}
.envelope:hover {
  background-color: #cfb58a;
}
.flap {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 100% 14%, 55% 72%, 50% 76%, 45% 73%, 0 14%);
  transform-origin: 50% 0;
  transition: transform 0.43s ease;
}
.env-label {
  display: block;
  max-width: 100%;
  font: italic 500 clamp(19px, 1.6vw, 31px) / 1.25 var(--serif);
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}
.env-label em {
  display: block;
}
.envelope.opening {
  animation: lift 0.44s ease;
}
.envelope.opening .flap {
  transform: perspective(600px) rotateX(155deg);
}
.envelope.opening .env-label {
  opacity: 0.55;
}
.still {
  margin-top: 22px;
}
.still .env-label {
  font-size: 24px;
}
@keyframes lift {
  45% {
    transform: translateY(-5px) rotate(-0.65deg);
  }
}
body:is(
    [data-view='reader'],
    [data-view='editor'],
    [data-view='welcome'],
    [data-view='message']
  )
  #rail {
  display: none;
}
body:is(
    [data-view='reader'],
    [data-view='editor'],
    [data-view='welcome'],
    [data-view='message']
  )
  #main {
  margin: 0;
}
body[data-view='reader'],
body[data-view='welcome'],
body[data-view='message'] {
  background: #f4f2ef;
}
.reader-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 21px clamp(22px, 5.86vw, 72px);
}
.reader-brand .brand-heart {
  width: 23px;
  height: 22px;
}
.reader-brand .signature {
  width: 65px;
  height: 29px;
}
.reader-body {
  width: min(1080px, 87vw);
  margin: auto;
  padding: clamp(74px, 12.8vh, 155px) 0 95px;
}
.reader-body h1 {
  font-size: clamp(47px, 5.7vw, 82px);
  margin: 0 0 21px;
  overflow-wrap: anywhere;
}
.read-envelopes {
  grid-template-columns: repeat(auto-fit, minmax(min(245px, 100%), 375px));
  margin-top: clamp(52px, 9.5vh, 110px);
}
.signed {
  text-align: right;
  color: #7f766c;
  margin-top: clamp(58px, 9.5vh, 108px);
  font-size: 17px;
}
.signed strong {
  display: block;
  margin-top: 6px;
  font: italic 500 26px/1.45 var(--serif);
  color: #5b544c;
}
.welcome {
  max-width: 570px;
  margin: auto;
  padding: 13vh 24px;
}
.welcome h1 {
  margin-top: 64px;
}
.welcome > .subtle {
  margin-top: 30px;
}
dialog {
  width: min(510px, calc(100vw - 32px));
  max-height: 90dvh;
  padding: 32px;
  border: 1px solid #ded8d0;
  border-radius: 16px;
  background: #fbf9f6;
  color: var(--ink);
  box-shadow: 0 15px 80px #3b322522;
  overflow: auto;
}
dialog::backdrop {
  background: #37302856;
}
#close-dialog {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
}
dialog h2 {
  padding-right: 22px;
  margin: 10px 0 22px;
}
details {
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}
summary {
  cursor: pointer;
  font-weight: 500;
}
details p {
  margin: 10px 0 3px;
}
body:has(dialog[open]) {
  overflow: hidden;
}
dialog audio {
  display: block;
  max-width: 100%;
  margin: 12px 0;
}
@media (max-width: 1250px) {
  .collections {
    width: min(80%, 930px);
  }
}
@media (max-width: 900px) {
  :root {
    --rail: 180px;
  }
  .collections {
    width: 84%;
  }
  .box-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .signature {
    width: 65px;
  }
}
@media (max-width: 719px) {
  #rail {
    transform: translateX(-103%);
    width: 238px;
    transition: transform 0.18s;
    box-shadow: 4px 0 30px #3e2d1d1a;
  }
  .mobile-nav #rail {
    transform: translateX(0);
  }
  #main {
    margin: 0;
  }
  .mobile-menu {
    display: inline-flex;
    margin: 13px 0 0 5.8vw;
    padding: 7px;
  }
  .collections {
    width: 88%;
    padding: 26px 0 60px;
  }
  .collection-head {
    gap: 7px;
  }
  .collection-head h1 {
    font-size: clamp(25px, 6vw, 36px);
  }
  .split > button {
    padding: 8px 9px;
    font-size: 11px;
  }
  .split > button:nth-child(2) {
    padding-inline: 6px;
  }
  .box-grid {
    gap: 18px 12px;
    margin-top: 32px;
  }
  .box-card strong {
    font-size: 14px;
  }
  .box-card small {
    font-size: 10px;
  }
  .pair {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .pair label {
    margin-bottom: 0;
  }
  .reader-brand {
    padding: 18px 5.9vw;
  }
  .reader-body {
    width: 88.2vw;
    padding-top: clamp(70px, 13vh, 150px);
  }
  .reader-body h1 {
    font-size: clamp(45px, 11.4vw, 65px);
    margin-bottom: 20px;
  }
  .read-envelopes {
    grid-template-columns: min(83%, 375px);
    gap: 26px;
    margin-top: clamp(52px, 9.5vh, 111px);
  }
  .read-envelopes .env-label {
    font-size: clamp(18px, 4.7vw, 26px);
  }
  .signed {
    margin-top: clamp(62px, 9.5vh, 108px);
  }
  .detail {
    width: 88%;
    padding-top: 18px;
  }
  .detail h1 {
    font-size: 43px;
  }
  dialog {
    padding: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.avatar {
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
#more-menu:not([hidden]) {
  display: grid;
}
#more-menu button {
  justify-content: flex-start;
}
.return-home,
.guide-links a,
.about-page a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6b6258;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 0;
}
.return-home:hover,
.guide-links a:hover,
.about-page a:hover {
  text-decoration: underline;
}
.return-home .icon,
.about-page a .icon {
  width: 15px;
  height: 15px;
}
.guide-page {
  padding: clamp(50px, 9vh, 110px) 0 60px;
  margin-left: clamp(24px, 10.5vw, 225px);
}
.guide-page h1 {
  margin-right: 6vw;
}
.guide-page .dedication {
  margin-bottom: 0;
  padding-right: 5vw;
}
.guide-controls {
  display: flex;
  justify-content: flex-end;
  padding-right: 5vw;
  margin: 16px 0 3px;
}
.guide-shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(246px, 25.5vw, 450px);
  gap: clamp(20px, 2.5vw, 50px);
  padding: 7px max(6vw, 24px) 15px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.guide-shelf .envelope {
  scroll-snap-align: start;
}
.guide-page .signed {
  margin: clamp(40px, 7vh, 80px) 9vw 0;
}
.guide-links {
  display: flex;
  gap: 22px;
  margin-top: 44px;
}
.policy-page {
  width: min(740px, 87vw);
  margin: 0 auto;
  padding: clamp(48px, 8vh, 110px) 0 95px;
}
.policy-page h1 {
  font-size: clamp(44px, 5vw, 72px);
  max-width: 17ch;
}
.policy-date {
  color: #7b7065;
}
.policy-page section {
  margin-top: clamp(30px, 5.5vh, 62px);
}
.policy-page section h2 {
  font: 600 17px/1.55 var(--sans);
  letter-spacing: normal;
  margin-bottom: 14px;
}
.policy-page section p {
  font-size: 15px;
  line-height: 1.85;
}
.about-page {
  width: min(590px, 87vw);
  margin: auto;
  padding: clamp(54px, 12vh, 140px) 0 60px;
  text-align: center;
}
.about-page h1,
.about-page p {
  font:
    400 clamp(15px, 1.25vw, 19px) / 1.65 ui-monospace,
    monospace;
  color: #756b60;
  letter-spacing: 0;
}
.about-page h1 {
  margin-bottom: 22px;
}
.about-page img {
  width: 95%;
  height: auto;
  margin: clamp(30px, 6vh, 85px) 0 17px;
  display: inline-block;
}
.creation-form {
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100dvh;
  max-width: 100%;
  max-height: 100dvh;
  padding: clamp(95px, 13.5vh, 152px) 24px 56px;
  border: none;
  border-radius: 0;
  background: #f4f2ef;
  box-shadow: none;
}
.creation-form.box-layout {
  padding-top: clamp(120px, 23.5vh, 230px);
}
.creation-form #dialog-body {
  width: min(100%, 500px);
  margin: 0 auto;
}
.creation-form.box-layout #dialog-body {
  width: min(100%, 562px);
}
.creation-logo {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
}
.creation-logo .brand-heart {
  width: 19px;
  height: 19px;
}
.creation-logo .signature {
  width: 61px;
  height: 28px;
}
.creation-form #close-dialog {
  top: 20px;
  right: clamp(18px, 4vw, 54px);
}
.creation-form h2 {
  font-size: clamp(36px, 4.3vw, 49px);
  margin: 0 0 clamp(32px, 6vh, 60px);
}
.creation-form label {
  margin: 0 0 28px;
}
.creation-form label,
.field-caption {
  font-size: 14px;
  color: #73685c;
}
.field-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.field-caption .char-count {
  color: #82796e;
  font-size: 12px;
}
.creation-form .pair {
  gap: 20px;
}
.creation-form input {
  min-height: 48px;
}
.creation-form .still {
  margin-top: clamp(24px, 4vh, 42px);
}
.creation-form .form-end {
  margin-top: clamp(22px, 4vh, 42px);
}
.creation-form .primary {
  padding: 11px 18px;
}
@media (max-width: 719px) {
  .guide-page {
    margin-left: 6vw;
  }
  .guide-shelf {
    grid-auto-columns: min(78vw, 375px);
  }
  .creation-form.box-layout {
    padding-top: 100px;
  }
  .creation-form .pair {
    gap: 0;
  }
}
