.reading-room {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #15150f;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}
.reading-room.is-open { opacity: 1; pointer-events: auto; }
.reading-room[hidden] { display: none; }
.room-transition {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #15150f;
  transform: scaleY(1);
  transform-origin: bottom;
  transition: transform .85s cubic-bezier(.76,0,.24,1) .08s;
  pointer-events: none;
}
.reading-room.is-open .room-transition { transform: scaleY(0); }
.reading-room.is-changing .room-transition { transform: scaleY(1); transition-delay: 0s; }

.letter-room,
.floral-room {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.018);
  transition: opacity .5s ease .18s, transform .75s cubic-bezier(.22,.8,.25,1) .14s;
}
.letter-room[aria-hidden="false"],
.floral-room[aria-hidden="false"] { opacity: 1; visibility: visible; transform: none; }

.room-button {
  position: absolute;
  z-index: 20;
  top: clamp(18px,2.5vh,28px);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(45,42,33,.08);
  border-radius: 50%;
  background: rgba(250,247,238,.88);
  box-shadow: 0 8px 24px rgba(43,37,24,.13);
  cursor: pointer;
  transition: transform .3s cubic-bezier(.22,.8,.25,1), background .3s ease;
}
.room-button:hover { transform: translateY(-3px); background: #fffdf7; }
.room-back,.floral-back { left: clamp(18px,2.5vw,28px); font-size: 25px; line-height: 1; }
.room-menu,.floral-menu { right: clamp(18px,2.5vw,28px); font-size: 13px; letter-spacing: 2px; }
.room-toast {
  position: absolute;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%,16px);
  padding: 10px 15px;
  border-radius: 999px;
  color: #faf7ee;
  background: rgba(20,20,16,.88);
  font-size: 11px;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.room-toast.is-visible { opacity: 1; transform: translate(-50%,0); }

/* LETTER */
.letter-room { perspective: 1400px; }
.letter-background {
  position: absolute;
  inset: -24px;
  background-image: linear-gradient(rgba(17,22,15,.08),rgba(17,22,15,.2)), url("/assets/images/letter-meadow-desktop.jpg");
  background-position: center;
  background-size: cover;
  filter: blur(10px) saturate(.82) brightness(.88);
  transform: scale(1.035);
  transition: transform 7s ease;
}
.reading-room.is-open .letter-background { transform: scale(1.065); }
.letter-card {
  position: relative;
  width: min(720px, calc(100vw - 112px));
  height: min(86svh, 850px);
  min-height: 620px;
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto auto;
  padding: clamp(64px,8vh,90px) clamp(58px,6vw,78px) clamp(26px,3vh,36px);
  border: 1px solid rgba(64,54,33,.13);
  border-radius: 32px;
  color: #36332c;
  background:
    radial-gradient(circle, rgba(91,76,47,.04) .5px, transparent .7px),
    linear-gradient(115deg, rgba(255,255,255,.6), transparent 43%),
    #f7f2e7;
  background-size: 4px 4px, 100% 100%, auto;
  box-shadow: 0 26px 80px rgba(8,12,8,.3), inset 0 0 45px rgba(178,151,95,.07);
  overflow: hidden;
  transform: rotateX(1.2deg) translateY(30px) scale(.96);
  opacity: 0;
  transition: transform .85s cubic-bezier(.22,.8,.25,1) .28s, opacity .55s ease .25s;
}
.reading-room.is-open .letter-room[aria-hidden="false"] .letter-card { transform: none; opacity: 1; }
.letter-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(147,121,71,.07);
}
.letter-date {
  position: absolute;
  top: clamp(27px,4vh,40px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  text-transform: uppercase;
  letter-spacing: .24em;
  font-size: 9px;
  color: #777166;
  white-space: nowrap;
}
.letter-date::after {
  content: "◇";
  display: block;
  width: 88px;
  margin: 7px auto 0;
  border-top: 1px solid rgba(54,51,44,.22);
  text-align: center;
  line-height: 0;
  font-size: 8px;
  background: #f7f2e7;
}
.letter-flower {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 8px 7px rgba(25,27,15,.12));
}
.letter-flower img { width: 100%; height: 100%; object-fit: contain; }
.letter-flower-top { width: 112px; height: 250px; top: 76px; right: -15px; transform: rotate(-5deg); }
.letter-flower-bottom { width: 84px; height: 190px; left: -20px; bottom: 42px; transform: rotate(173deg); opacity: .88; }
.letter-header,
.letter-copy,
.letter-signature,
.letter-actions { position: relative; z-index: 3; }
.letter-header { padding-right: 40px; }
.letter-category {
  margin: 0 0 13px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 9px;
  color: #817a6d;
}
.letter-title {
  max-width: 570px;
  margin: 0;
  font: 400 clamp(46px,5vw,68px)/.88 var(--script);
  letter-spacing: .005em;
  color: #39352d;
}
.letter-byline {
  margin: 15px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(54,51,44,.13);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 8px;
  color: #777166;
}
.letter-byline strong {
  margin-left: 5px;
  text-transform: none;
  letter-spacing: .02em;
  font: 500 14px/1 var(--serif);
  color: #39352d;
}
.letter-copy {
  min-height: 0;
  overflow: hidden;
  padding-right: 24px;
  font: 400 clamp(13px,1.2vw,15.5px)/1.52 var(--serif);
  letter-spacing: .005em;
}
.letter-copy p { margin: 0 0 12px; }
.letter-copy p:last-child { margin-bottom: 0; }
.letter-signature {
  justify-self: end;
  align-self: end;
  margin-top: 8px;
  padding-right: 4px;
  text-align: right;
  font-family: var(--script);
  color: #4f4a40;
}
.letter-signature span { display: block; font-size: 19px; line-height: .9; }
.letter-signature strong { display: block; margin-top: -1px; font-size: 25px; line-height: 1; font-weight: 400; }
.letter-actions {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  align-items: end;
  margin-top: 10px;
  padding-top: 13px;
  border-top: 1px solid rgba(54,51,44,.14);
}
.letter-actions button {
  border: 0;
  background: none;
  font-size: 25px;
  color: #6c665b;
  cursor: pointer;
}
.letter-actions button:nth-child(2) { font-size: 21px; }
.letter-actions button[aria-pressed="true"] { color: #687141; }
.letter-next {
  position: absolute;
  left: 50%;
  bottom: max(14px,env(safe-area-inset-bottom));
  width: min(640px,calc(100vw - 150px));
  min-height: 66px;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 42px;
  align-items: center;
  gap: 20px;
  padding: 12px 18px 12px 25px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  color: #f5f0e3;
  background: rgba(42,56,29,.9);
  backdrop-filter: blur(14px);
  transform: translate(-50%,20px);
  opacity: 0;
  cursor: pointer;
  transition: transform .7s cubic-bezier(.22,.8,.25,1) .5s, opacity .45s ease .48s, background .3s ease;
}
.reading-room.is-open .letter-room[aria-hidden="false"] .letter-next { transform: translate(-50%,0); opacity: 1; }
.letter-next:hover { background: rgba(50,66,34,.98); }
.letter-next span { text-align: left; text-transform: uppercase; letter-spacing: .16em; font-size: 7px; opacity: .7; }
.letter-next strong { font: 400 22px/1 var(--script); }
.letter-next i { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; font-style: normal; }

/* FLORAL */
.floral-room { background: #dcd4c2; }
.floral-paper {
  position: relative;
  width: min(1040px,calc(100vw - 72px));
  height: min(88svh,880px);
  min-height: 620px;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle, rgba(102,83,49,.035) .5px, transparent .7px),
    linear-gradient(110deg,rgba(255,255,255,.58),transparent 48%),
    #f7f3e8;
  background-size: 4px 4px,100% 100%,auto;
  box-shadow: 0 30px 90px rgba(51,44,27,.22);
  transform: translateY(28px) scale(.97);
  opacity: 0;
  transition: transform .85s cubic-bezier(.22,.8,.25,1) .28s, opacity .55s ease .25s;
}
.reading-room.is-open .floral-room[aria-hidden="false"] .floral-paper { transform: none; opacity: 1; }
.floral-top,
.floral-bottom {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: cover;
}
.floral-top {
  top: 0;
  height: 25%;
  background-image: url("/assets/images/floral-top.jpg");
  background-position: center top;
  mask-image: linear-gradient(to bottom,#000 45%,transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom,#000 45%,transparent 100%);
  opacity: .9;
}
.floral-bottom {
  bottom: 0;
  height: 24%;
  background-image: url("/assets/images/floral-bottom.jpg");
  background-position: center bottom;
  mask-image: linear-gradient(to top,#000 42%,transparent 100%);
  -webkit-mask-image: linear-gradient(to top,#000 42%,transparent 100%);
  opacity: .88;
}
.floral-date {
  position: absolute;
  z-index: 5;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  text-transform: uppercase;
  letter-spacing: .24em;
  font-size: 9px;
  color: #686257;
}
.floral-content {
  position: relative;
  z-index: 4;
  width: min(640px,70%);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16% 0 15%;
  text-align: center;
}
.floral-category {
  margin: 0 0 9px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 8px;
  color: #777064;
}
.floral-title {
  margin: 0;
  font: 500 clamp(50px,6.5vw,82px)/.82 var(--serif);
  letter-spacing: -.04em;
}
.floral-rule { width: 78px; height: 1px; margin: 18px auto; background: rgba(43,40,33,.25); }
.floral-subheading {
  margin: 0 auto 18px;
  max-width: 520px;
  color: #716a5e;
  font: 400 18px/1.4 var(--serif);
}
.floral-copy {
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
  font: 400 15px/1.5 var(--serif);
  overflow: hidden;
}
.floral-copy p { margin: 0 0 13px; }
.floral-copy p:last-child { margin: 0; }
.floral-ornament {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 13px;
  color: #6f6758;
}
.floral-ornament span { width: 68px; height: 1px; background: rgba(43,40,33,.28); }
.floral-ornament i { font-size: 7px; letter-spacing: 3px; font-style: normal; }

@media (max-width: 760px) {
  .room-button { width: 40px; height: 40px; top: 14px; }
  .room-back,.floral-back { left: 13px; }
  .room-menu,.floral-menu { right: 13px; }
  .letter-background {
    background-image: linear-gradient(rgba(17,22,15,.1),rgba(17,22,15,.18)), url("/assets/images/letter-meadow-mobile.jpg");
    filter: blur(7px) saturate(.85) brightness(.88);
    transform: scale(1.025);
  }
  .reading-room.is-open .letter-background { transform: scale(1.04); }
  .letter-card {
    width: calc(100vw - 30px);
    height: calc(100dvh - 30px);
    min-height: 0;
    max-height: none;
    padding: 62px clamp(31px,8vw,42px) 15px;
    border-radius: 24px;
    grid-template-rows: auto auto auto 1fr auto;
  }
  .letter-actions { grid-row: 5; }
  .letter-date { top: 24px; font-size: 7px; }
  .letter-date::after { width: 63px; margin-top: 6px; }
  .letter-flower-top { width: 72px; height: 164px; top: 59px; right: -20px; opacity: .9; }
  .letter-flower-bottom { width: 54px; height: 120px; left: -18px; bottom: 38px; opacity: .75; }
  .letter-header { padding-right: 15px; text-align: center; }
  .letter-category { margin-bottom: 7px; font-size: 6.8px; }
  .letter-title {
    max-width: 100%;
    font-size: clamp(31px,9.3vw,43px);
    line-height: .91;
  }
  .letter-byline { margin: 8px 0 9px; padding-bottom: 8px; font-size: 6.5px; }
  .letter-byline strong { font-size: 11px; }
  .letter-copy {
    padding-right: 0;
    font-size: clamp(10.6px,2.8vw,12.4px);
    line-height: 1.43;
  }
  .letter-copy p { margin-bottom: 8px; }
  .letter-signature { margin-top: 4px; padding-right: 0; }
  .letter-signature span { font-size: 13px; }
  .letter-signature strong { font-size: 17px; }
  .letter-actions { margin-top: 5px; padding-top: 8px; }
  .letter-actions button { font-size: 20px; }
  .letter-actions button:nth-child(2) { font-size: 17px; }
  .letter-next { display: none; }

  .floral-paper {
    width: calc(100vw - 24px);
    height: calc(100dvh - 24px);
    min-height: 0;
    border-radius: 24px;
  }
  .floral-top { height: 23%; background-image: url("/assets/images/floral-top.jpg"); opacity: .86; }
  .floral-bottom { height: 21%; background-image: url("/assets/images/floral-bottom.jpg"); opacity: .8; }
  .floral-date { top: 25px; font-size: 7px; }
  .floral-content {
    width: calc(100% - 76px);
    padding: 22% 0 18%;
  }
  .floral-category { margin-bottom: 5px; font-size: 6.5px; }
  .floral-title { font-size: clamp(38px,12vw,52px); line-height: .82; }
  .floral-rule { width: 54px; margin: 11px auto; }
  .floral-subheading { margin-bottom: 10px; font-size: 13px; line-height: 1.35; }
  .floral-copy { font-size: clamp(10.7px,2.85vw,12.4px); line-height: 1.43; }
  .floral-copy p { margin-bottom: 8px; }
  .floral-ornament { bottom: 25px; gap: 8px; }
  .floral-ornament span { width: 42px; }
}

@media (max-width: 360px), (max-height: 680px) {
  .letter-card { padding-top: 54px; padding-bottom: 10px; }
  .letter-date { top: 20px; }
  .letter-title { font-size: clamp(27px,8.6vw,34px); }
  .letter-byline { margin: 5px 0 6px; padding-bottom: 6px; }
  .letter-copy { font-size: clamp(8.5px,2.45vw,10.2px); line-height: 1.34; }
  .letter-copy p { margin-bottom: 5px; }
  .letter-signature span { font-size: 11px; }
  .letter-signature strong { font-size: 14px; }
  .letter-actions { padding-top: 5px; }
  .letter-flower-top { width: 58px; height: 134px; top: 52px; }
  .letter-flower-bottom { width: 42px; height: 95px; }
  .floral-content { width: calc(100% - 62px); padding-top: 20%; padding-bottom: 15%; }
  .floral-title { font-size: 34px; }
  .floral-subheading { font-size: 11px; margin-bottom: 7px; }
  .floral-copy { font-size: 9.2px; line-height: 1.35; }
  .floral-copy p { margin-bottom: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .room-transition { display: none; }
  .letter-card,.floral-paper { opacity: 1; transform: none; }
}
