:root {
  color-scheme: dark;
  --ink: #f3f0ff;
  --muted: #c4c4e1;
  --accent: #cbb7ff;
  --paper: #211a39;
  --border: #756797;
  --serif: Georgia, 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
  radial-gradient(ellipse at 76% 21%, #253e72, transparent 52%),
  linear-gradient(145deg, #0e132d, #182c55 68%, #121d38);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, h2:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(100% - 3rem, 68rem);
  margin: auto;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font: italic 1.24rem var(--serif);
}

.brand-mark {
  color: var(--accent);
  font-size: 1.35rem;
}

.mast-note {
  color: var(--muted);
  font-size: .875rem;
  text-align: right;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  padding-block: clamp(2.8rem, 7vw, 5.6rem) clamp(2.6rem, 5vw, 4.2rem);
}

.script {
  margin: 0 0 .4rem;
  color: var(--accent);
  font: italic 1.35rem var(--serif);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
}

h1 {
  margin: 0;
  font-size: clamp(3.5rem, 8vw, 7rem);
  line-height: .95;
  letter-spacing: -.06em;
}

h1 em {
  display: block;
  color: var(--accent);
  font-weight: 400;
}

.intro {
  max-width: 29rem;
  color: var(--muted);
  margin: 1.35rem 0 1.55rem;
}

.primary {
  min-height: 3rem;
  border: 1px solid #9678cd;
  border-radius: .35rem;
  padding: .65rem 1.2rem;
  background: #513781;
  color: #fff;
  font-weight: 650;
}

.primary:hover {
  background: #64469f;
}

.stage {
  display: grid;
  place-items: center;
}

.envelope {
  position: relative;
  isolation: isolate;
  display: block;
  width: min(85%, 25rem);
  aspect-ratio: 1.65;
  padding: 0;
  border: 0;
  border-radius: .35rem;
  background: #28244f;
  box-shadow: 0 1.4rem 2.6rem #050716a8;
  transform: rotate(-7deg);
  transition: transform .25s ease;
}

.envelope:hover, .envelope:focus-visible {
  transform: rotate(-3deg) translateY(-.2rem);
}

.envelope::before, .envelope::after {
  position: absolute;
  inset: 0;
  content: '';
  border-radius: inherit;
}

.envelope::before {
  background: linear-gradient(135deg, #4a4f90, #292a56 72%);
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 100%, 0 100%);
}

.envelope::after {
  background: linear-gradient(#59417f, #413168);
  clip-path: polygon(0 0, 100% 0, 50% 66%);
}

.seal {
  position: absolute;
  z-index: 1;
  top: 59%;
  left: 50%;
  translate: -50% -50%;
  width: clamp(2.75rem, 7vw, 4rem);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f3edff;
  background: radial-gradient(circle at 30% 23%, #9975cf, #684798 65%, #432862);
  box-shadow: inset 0 0 0 .2rem #ffffff20, 0 .25rem .55rem #0c09258c;
  font-size: 1.35rem;
}

.postmark {
  position: absolute;
  z-index: 1;
  top: 8%;
  right: 5%;
  display: grid;
  place-items: center;
  width: clamp(2.25rem, 6vw, 3.5rem);
  aspect-ratio: 1;
  border: 1px dashed #bda5ed;
  outline: 1px solid #bda5ed;
  outline-offset: -4px;
  color: #eddfff;
  font-family: var(--serif);
}

.collection {
  border-top: 1px solid var(--border);
  padding-block: 1.65rem 3.5rem;
}

.collection h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .9rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: .8rem;
  text-align: left;
  width: 100%;
  min-height: 5.3rem;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: #1a2040;
}

.choice:hover {
  background: #29234b;
  border-color: #aa93dc;
}

.icon {
  flex: none;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #352752;
  color: var(--accent);
  font-size: 1.1rem;
}

.choice strong {
  display: block;
  font: 1.2rem/1.2 var(--serif);
}

.choice small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .875rem;
}

.reader {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  align-items: safe center;
  justify-items: center;
  overflow: auto;
  padding: 1rem;
  background: #06091cd1;
  overscroll-behavior: contain;
}

.letter {
  position: relative;
  width: min(100%, 34rem);
  background: linear-gradient(150deg, #241d40, var(--paper) 70%);
  border-radius: .4rem;
  border: 1px solid #7967a0;
  padding: clamp(1.5rem, 6vw, 3rem);
  box-shadow: 0 1.2rem 4rem #050611a8;
  animation: unfold .3s ease both;
}

@keyframes unfold {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.close {
  position: absolute;
  top: .65rem;
  right: .65rem;
  width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent);
  font-size: 1.45rem;
  line-height: 1;
}

.letter h2 {
  margin: .35rem 0 1rem;
  padding-right: 1.5rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
}

.letter p {
  margin: 0 0 1rem;
  font: 1.12rem/1.65 var(--serif);
}

.letter .signature {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--accent);
}

.letter-nav {
  display: flex;
  gap: .6rem;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.letter-nav button {
  min-height: 2.75rem;
  padding: .45rem .7rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: .35rem;
}

.letter-nav button:hover, .close:hover {
  background: #352752;
}

body.reading {
  overflow: hidden;
}

@media (max-width: 42rem) {
  .wrap {
    width: calc(100% - 2rem);
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 2.45rem;
  }
  h1 {
    font-size: clamp(3rem, 13vw, 5rem);
  }
  h1 em {
    display: inline;
  }
  .stage {
    padding: .2rem 0 1rem;
  }
  .envelope {
    width: min(76%, 21rem);
  }
  .choices {
    grid-template-columns: 1fr;
    gap: .65rem;
  }
  .collection {
    padding-bottom: 2rem;
  }
}

@media (max-width: 23rem) {
  .mast-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
