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

:root {
  --ink: #253129;
  --ink-soft: #6E746F;
  --green: #455A4C;
  --green-deep: #283A31;
  --rust: #8E5A49;
  --gold: #D5B46D;
  --gold-deep: #A8843D;
  --cream: #FFF9F1;
  --paper: #FFFDF8;
  --paper-shadow: #DED4C7;
  --line: rgba(37,49,41,.12);
  --shadow: 0 28px 72px rgba(37,49,41,.16);
  --shadow-soft: 0 14px 34px rgba(37,49,41,.09);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(213,180,109,.14), transparent 25%),
    radial-gradient(circle at 10% 30%, rgba(69,90,76,.10), transparent 20%),
    linear-gradient(180deg, #F5EDE4 0%, #E9E1D7 100%);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.8;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
blockquote {
  margin: 0;
  font-family: Fraunces, "Playfair Display", Georgia, serif;
}

p {
  margin: 0;
}

.eyebrow {
  color: var(--gold-deep);
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--gold {
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 12px 30px rgba(213,180,109,.20);
}

.button--rust {
  color: #fff;
  background: var(--rust);
}

.button--green {
  color: #fff;
  background: var(--green);
}

.button--soft {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

.opening {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  gap: 36px;
  padding: 18px;
  overflow: auto;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(213,180,109,.18), transparent 24%),
    linear-gradient(135deg, #283A31, #725443);
  transition: opacity .4s ease, visibility .4s ease;
}

.opening.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.opening__visual {
  position: relative;
  width: min(330px, 72vw);
  padding: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  box-shadow: 0 30px 70px rgba(0,0,0,.28);
  transform: rotate(-3deg);
}

.opening__visual img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.opening__note {
  position: absolute;
  right: -34px;
  bottom: 40px;
  padding: 14px 18px;
  color: var(--ink);
  background: var(--gold);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  transform: rotate(8deg);
}

.opening__copy {
  max-width: 650px;
  text-align: center;
}

.opening .eyebrow {
  color: #E7D29A;
}

.opening__copy h1 {
  margin-top: 12px;
  color: #fff;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.05em;
}

.opening__copy > p:not(.eyebrow) {
  margin-top: 18px;
  color: rgba(255,255,255,.74);
  font-family: Georgia, serif;
  font-size: 1.18rem;
  font-style: italic;
}

.opening__copy .button {
  margin-top: 30px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: min(1100px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(245,237,228,.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
}

.topbar__actions {
  display: flex;
  gap: 18px;
}

.topbar__button {
  padding: 0;
  border: 0;
  color: var(--ink-soft);
  background: none;
  cursor: pointer;
}

.topbar__button:hover,
.topbar__button:focus-visible {
  color: var(--rust);
}

main {
  padding: 50px 0 130px;
}

.letter {
  width: min(840px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(34px, 7vw, 76px);
  border: 1px solid rgba(37,49,41,.08);
  background:
    linear-gradient(rgba(255,253,248,.95), rgba(255,253,248,.95)),
    repeating-linear-gradient(
      0deg,
      transparent 0 34px,
      rgba(37,49,41,.035) 34px 35px
    );
  box-shadow:
    0 3px 0 var(--paper-shadow),
    0 32px 80px rgba(37,49,41,.15);
}

.letter__heading {
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line);
}

.letter__date {
  margin-bottom: 34px;
  color: var(--ink-soft);
  font-size: .9rem;
  text-align: right;
}

.letter__heading h1 {
  max-width: 700px;
  margin-top: 14px;
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.055em;
}

.letter__lead {
  max-width: 650px;
  margin-top: 24px;
  color: var(--ink-soft);
  font-family: Georgia, serif;
  font-size: clamp(1.14rem, 2.5vw, 1.38rem);
  font-style: italic;
}

.letter__body {
  padding-top: 44px;
}

.letter__body > p {
  color: #505851;
  font-family: Georgia, serif;
  font-size: clamp(1.05rem, 2.1vw, 1.17rem);
  line-height: 2;
}

.letter__body > p + p {
  margin-top: 28px;
}

.letter__body blockquote {
  margin: 46px 0;
  padding: 32px 0 32px 30px;
  border-left: 8px solid var(--gold);
  color: var(--rust);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  font-style: italic;
  line-height: 1.35;
}

.letter-photo {
  margin: 54px 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  transform: rotate(-1deg);
}

.letter-photo--opposite {
  transform: rotate(1.2deg);
}

.letter-photo img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: contain;
  background: #EDE4D8;
}

.letter-photo figcaption {
  padding: 16px 12px 8px;
  color: var(--ink-soft);
  font-family: Georgia, serif;
  font-size: .96rem;
  font-style: italic;
  line-height: 1.6;
}

.letter__pause {
  margin: 54px 0;
  padding: clamp(26px, 5vw, 42px);
  color: #fff;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  box-shadow: var(--shadow-soft);
}

.letter__pause span {
  color: var(--gold);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.letter__pause p {
  margin-top: 18px;
  font-family: Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.55;
}

.letter__signature {
  margin-top: 52px;
}

.letter__signature span {
  display: block;
  color: var(--ink-soft);
  font-family: Georgia, serif;
  font-size: 1.1rem;
}

.letter__signature strong {
  display: block;
  margin-top: 6px;
  color: var(--rust);
  font-family: Georgia, serif;
  font-size: 3rem;
  font-style: italic;
  font-weight: 500;
}

.postscript {
  margin-top: 68px;
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.postscript__closed {
  text-align: center;
}

.postscript__closed h2 {
  margin-top: 12px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 500;
  line-height: 1.05;
}

.postscript__closed .button {
  margin-top: 28px;
}

.postscript__open {
  position: relative;
  padding: clamp(30px, 6vw, 52px);
  background: #EAE2D7;
}

.postscript__open span {
  position: absolute;
  top: 18px;
  right: 22px;
  color: rgba(142,90,73,.18);
  font-family: Georgia, serif;
  font-size: 5rem;
  font-weight: 700;
}

.postscript__open p {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  font-style: italic;
  line-height: 1.55;
}

.letter__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 48px;
}

.audio-player {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: min(440px, calc(100% - 36px));
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 12px 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.50);
  border-radius: 20px;
  background: rgba(255,249,241,.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.audio-player__play {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  cursor: pointer;
}

.audio-player__meta strong {
  display: block;
  font-family: Georgia, serif;
  font-size: .96rem;
  font-weight: 500;
}

.audio-player__meta span {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: .78rem;
}

.audio-player__progress {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold-deep);
}

.footer {
  padding: 0 18px 110px;
  color: var(--ink-soft);
  font-size: .9rem;
  text-align: center;
}

.footer a {
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(37,49,41,.82);
  backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 18px;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 34px 90px rgba(37,49,41,.30);
}

.modal__panel iframe {
  width: 100%;
  height: min(82vh, 880px);
  border: 0;
  border-radius: 20px;
  background: #fff;
}

.modal__close {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--rust);
  font-size: 1.4rem;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 90;
  left: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  background: var(--green);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 800px) {
  .opening {
    grid-template-columns: minmax(280px,.75fr) minmax(0,1.25fr);
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar__actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  main {
    padding-top: 24px;
  }

  .letter {
    width: min(100% - 20px, 840px);
    padding: 28px 22px 36px;
  }

  .letter__date {
    text-align: left;
  }

  .letter__actions {
    flex-direction: column;
  }

  .letter__actions .button {
    width: 100%;
  }

  .audio-player {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (max-height: 760px) and (min-width: 641px) {
  .opening {
    gap: 22px;
  }

  .opening__visual {
    width: min(230px, 34vh);
  }

  .opening__copy h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
  }

  .opening__copy > p:not(.eyebrow) {
    margin-top: 12px;
  }

  .opening__copy .button {
    margin-top: 22px;
  }
}
