/* Your memories and letters (letters.js): boxes after the Photo Box reference, letters on cream paper. */
.lt-files { max-width: 980px; padding-bottom: 80px; }
.lt-head { text-align: center; padding: 28px 0 8px; }
.lt-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.lt-head p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.lt-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.lt-empty { text-align: center; color: var(--muted); font-size: 14px; max-width: 360px; margin: 48px auto; }


/* ---------------------------------------------------------------- the box */
.pbox { --s: min(296px, calc(62vw - 26px)); --sh: calc(var(--s) / 1.6); --bw: calc(var(--s) * .9); --bh: calc(var(--sh) * .84);
  --bx: calc(var(--s) * .315); --by: calc(var(--s) * .62 + var(--sh) - var(--bh) - var(--sh) * .02); --cw: calc(var(--s) * .34);
  --part: 0; position: relative; width: calc(var(--s) * 1.42); height: calc(var(--sh) + var(--s) * .62);
  /* the fan rises about .3 of the sleeve above it: closed, the rest of the headroom is given back */
  margin-top: calc(var(--s) * -.3); }
/* One organized stack (as in the app): each box tucked behind the one in front, its city strip showing; they deal
   in one by one. Click opens a box: it comes to the front, the rest step back, its files pop out one by one. */
.lt-boxes { display: flex; flex-direction: column; align-items: center; padding-top: 0; }
.pbox { z-index: calc(100 - var(--i, 0)); animation: pbox-deal .55s cubic-bezier(.22,1,.36,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.pbox + .pbox { margin-top: calc(var(--sh) * .42 - var(--sh) - var(--s) * .62); }
@keyframes pbox-deal { from { opacity: 0; transform: translateY(36px); } }
.pbox.open { z-index: 200; --part: 1; }
.lt-boxes.has-open .pbox:not(.open) { opacity: .12; filter: blur(2px); transition: opacity .35s, filter .35s; }
.lt-boxes .pbox { transition: opacity .35s, filter .35s; }
.pbox-hit { position: absolute; left: calc(var(--s) * .145); top: calc(var(--s) * .62); width: calc(var(--s) * 1.13); height: var(--sh); z-index: 5; border: 0; background: none; border-radius: 12px; cursor: pointer; }
.pbox.open .pbox-hit { z-index: 0; }
.pbox-hit:focus-visible { outline: 2px solid var(--from); outline-offset: 4px; }

.pbox-sleeve { position: absolute; z-index: 3; left: calc(var(--s) * .145); top: calc(var(--s) * .62); width: var(--s); height: var(--sh); pointer-events: none;
  border-radius: calc(var(--s) * .045); overflow: hidden; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--from) 86%, transparent), color-mix(in srgb, var(--to) 93%, transparent));
  -webkit-backdrop-filter: blur(14px) saturate(1.25); backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: inset 0 0 0 .7px rgba(255,255,255,.32), inset 0 1px 0 rgba(255,255,255,.45), 0 calc(var(--s) * .05) calc(var(--s) * .12) color-mix(in srgb, var(--to) 30%, transparent), 0 1px 2px rgba(0,0,0,.07);
  transform: translateX(calc(var(--part) * var(--s) * (-.1176 - .085))); transition: transform .6s cubic-bezier(.22,1,.36,1); }
.pbox-glass { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 50%); }
.pbox-title { position: absolute; left: 7%; bottom: 31%; font-size: calc(var(--s) * .068); font-weight: 600; letter-spacing: -.005em; }
.pbox-sub { position: absolute; left: 7%; right: 7%; bottom: 20%; font-size: calc(var(--s) * .036); font-weight: 500; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbox-rule { position: absolute; left: 7%; right: 7%; bottom: 11%; height: .6px; background: rgba(255,255,255,.32); }
.pbox-new { position: absolute; right: 5%; top: 7%; font-size: calc(var(--s) * .04); font-weight: 600; color: var(--tab); background: rgba(255,255,255,.95); padding: 2px 8px; border-radius: 99px; }

.pbox-kraft { position: absolute; z-index: 2; left: var(--bx); top: var(--by); width: var(--bw); height: var(--bh); pointer-events: none;
  /* closed, the box sticks out a little further from the sleeve, a print standing in it (the reference) */
  transform: translateX(calc(var(--part) * var(--s) * (.3024 - .085) + (1 - var(--part)) * var(--s) * .1)); transition: transform .6s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.06)) drop-shadow(0 8px 12px rgba(0,0,0,.07)); }
.pbox-kraft::before { content: ''; position: absolute; inset: 0; border-radius: calc(var(--s) * .018);
  background: linear-gradient(180deg, rgba(160,140,100,.25), transparent 18%), url(/app/paper.png) 0 0 / 256px, #EADFC7; background-blend-mode: normal, multiply, normal;
  -webkit-mask: radial-gradient(circle calc(var(--bh) * .15) at 62% 0, transparent 97%, #000 100%); mask: radial-gradient(circle calc(var(--bh) * .15) at 62% 0, transparent 97%, #000 100%); }
.pbox-label { position: absolute; right: 6%; bottom: 10%; font-size: calc(var(--bh) * .065); letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: #A8987A; }
.pbox-tab { position: absolute; right: calc(var(--bw) * -.035); top: 34%; width: calc(var(--bw) * .06); height: 32%; border-radius: 3px; background: var(--tab); z-index: -1; }

.pbox-prints { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.pbox.open .pbox-prints { pointer-events: auto; }
.pbox-print { position: absolute; left: calc(var(--bx) + var(--bw) / 2 - var(--cw) / 2 + (var(--k) - 1) * var(--s) * .07); top: calc(var(--by) + var(--cw) * .1);
  width: var(--cw); height: calc(var(--cw) * 1.2); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 2px;
  transform: translate(calc(var(--part) * ((var(--t) - .5) * var(--bw) * .62 + var(--s) * .04 - (var(--k) - 1) * var(--s) * .07 + var(--s) * (.3024 - .085))
      + (1 - var(--part)) * (var(--s) * .1 + var(--bw) * .3 - var(--k) * var(--s) * .08 - (var(--k) - 1) * var(--s) * .07)),
    calc(var(--part) * -1 * (var(--cw) * .7 + var(--s) * .06 + var(--s) * .1 * (1 - (2 * var(--t) - 1) * (2 * var(--t) - 1)))
      - (1 - var(--part)) * (var(--cw) * .1 + var(--sh) * .16)))
    rotate(calc((var(--t) - .5) * 26deg * var(--part)));   /* closed, files stand straight */
  transition: transform .55s cubic-bezier(.22,1,.36,1) calc(var(--k) * 30ms); }
.pbox-print.new { top: calc(var(--by) - var(--sh) * .16 + var(--cw) * .1); }
.pbox.open .pbox-print { transition: transform .5s cubic-bezier(.34,1.5,.64,1) calc(300ms + var(--k) * 120ms); }   /* they pop out one by one */
.pbox-print:focus-visible { outline: 2px solid var(--from); outline-offset: 3px; }

/* ---------------------------------------------------------------- prints, envelopes, stamps */
.lt-print { display: flex; flex-direction: column; align-items: center; gap: 5%; width: 100%; height: 100%; padding-top: 7%; border-radius: 2px;
  background: url(/app/paper.png) 0 0 / 256px, #F8F6F1; background-blend-mode: multiply;
  box-shadow: 0 .5px 1px rgba(0,0,0,.1), 0 6px 14px rgba(0,0,0,.09); color: #4A4A4F; }
.lt-pic { position: relative; width: 86%; aspect-ratio: 1; overflow: hidden; background: #EFEAE0; }
.lt-pic img { width: 100%; height: 100%; object-fit: cover; }
.lt-pic-souv img { object-fit: contain; padding: 6%; }
.lt-pic-letter { background: #F2EDE2; }
.lt-pic-letter .lt-stamp { position: absolute; right: 5%; top: 5%; }
.lt-typed { position: absolute; left: 8%; right: 8%; top: 26%; bottom: 4%; overflow: hidden; font: calc(var(--cw, 100px) * .056) / 1.35 "American Typewriter", "Courier New", monospace; color: #24252B; text-align: left; }
.lt-cap { font-size: calc(var(--cw, 100px) * .07); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 88%; }

.lt-stamp { --w: 40px; display: inline-grid; place-items: center; width: var(--w); height: calc(var(--w) * 1.2); background: #FFFEFA; flex: none;
  -webkit-mask: radial-gradient(circle calc(var(--w) * .035) at 50% 50%, transparent 95%, #000) calc(var(--w) * -.05) calc(var(--w) * -.05) / calc(var(--w) / 9) calc(var(--w) / 9) round;
  box-shadow: 0 .5px 1px rgba(0,0,0,.15); }
.lt-stamp-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3%; width: 80%; height: 83%; background: var(--paper); }
.lt-stamp svg { width: 70%; aspect-ratio: 1; stroke: var(--ink); stroke-width: .24; stroke-linecap: round; fill: none; }
.lt-stamp b { font: 600 calc(var(--w) * .095) / 1 ui-monospace, monospace; letter-spacing: .05em; color: var(--ink); text-transform: uppercase; max-width: 92%; overflow: hidden; white-space: nowrap; }

.lt-env { display: inline-block; width: 46px; aspect-ratio: 1.42; flex: none; }
.lt-env-face { position: relative; display: block; width: 100%; height: 100%; border-radius: 2px;
  background: url(/app/paper.png) 0 0 / 256px, #F6F4EF; background-blend-mode: multiply; box-shadow: 0 .5px 1px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.08); }
.lt-env-face .lt-stamp { position: absolute; right: 7%; top: 9%; --w: 24% !important; width: 24%; height: auto; aspect-ratio: .83; }
.lt-env .lt-lock, .lt-env .lt-dot { position: absolute; right: 7%; bottom: 8%; color: #2E3A86; opacity: .5; }
.lt-env .lt-dot { width: 6px; height: 6px; border-radius: 50%; background: #6D28D9; opacity: 1; }
.lt-env-print { width: 120%; transform: rotate(-90deg); transform-origin: center; position: absolute; left: -10%; top: 25%; }
.lt-env-lg { width: 260px; }
:root[data-theme="dark"] .lt-env-face { background-color: #DCD8CF; }

.lt-gesture { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1.4px dashed rgba(154,51,66,.85); border-radius: 4px; color: #9A3342;
  font: 13px/1.35 ui-monospace, "Courier New", monospace; transform: rotate(-1.5deg); max-width: 100%; }
.lt-gesture b { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.lt-gesture.kept { border-style: solid; }
.lt-gesture i { font-style: italic; }

/* ---------------------------------------------------------------- lifted */
.lt-lift { position: fixed; inset: 0; z-index: 1000;   /* over the open box (z 200 in the stack) */
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px;
  background: color-mix(in srgb, var(--page, #EFEFEE) 88%, transparent); cursor: pointer; }
.lt-lift-card { --cw: 300px; }
.lt-lift-card .lt-print { height: auto; aspect-ratio: auto; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 24px 48px rgba(0,0,0,.14); }
.lt-lift-card .lt-print:not(.lt-print-big) { aspect-ratio: 1 / 1.2; padding: 7% 0 0; }
.lt-print-big { position: relative; align-items: stretch !important; max-height: 62vh; overflow: auto; cursor: auto; }
.lt-print-big .lt-stamp { position: absolute; right: 14px; top: 14px; }
.lt-typed-big { font: 16px/1.6 "American Typewriter", "Courier New", monospace; color: #24252B; margin: 52px 0 0; white-space: pre-wrap; }
.lt-sign { font: 16px "American Typewriter", "Courier New", monospace; color: #24252B; text-align: right; margin: 8px 0 12px; }
.lt-lift-cap { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; max-width: 340px; }
.lt-lift-cap b { font-size: 15px; font-weight: 600; }
.lt-lift-cap span { font-size: 13px; color: var(--muted); }
.lt-lift-cap a { font-size: 13px; font-weight: 600; color: var(--accent, #6D28D9); margin-top: 6px; }
.lt-lift-cap small { font-size: 11px; color: var(--faint, #A3A6B4); margin-top: 6px; }

/* ---------------------------------------------------------------- reading */
.lt-read { max-width: 640px; }
.lt-page { margin: 32px auto 0; max-width: 560px; padding: 32px 30px; border-radius: 3px; color: #24252B;
  background: url(/app/paper.png) 0 0 / 256px, #FBF7EE; background-blend-mode: multiply; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 14px 30px rgba(0,0,0,.08); }
.lt-date { font: 13px "American Typewriter", "Courier New", monospace; opacity: .6; text-align: right; margin: 0 0 18px; }
.lt-body { font: 17px/1.65 "American Typewriter", "Courier New", monospace; white-space: pre-wrap; margin: 0; }
.lt-keep { text-align: center; margin-top: 24px; }
.lt-sealed { text-align: center; padding: 60px 0; color: var(--muted); }

.lt-opening { display: flex; flex-direction: column; align-items: center; padding-top: 22vh; }
.lt-back { position: relative; width: min(340px, 82vw); aspect-ratio: 1.42; perspective: 900px; filter: drop-shadow(0 12px 22px rgba(0,0,0,.12)); }
.lt-back > * { position: absolute; }
.lt-inside { inset: 0; background: #E9E6DF; border-radius: 3px; }
.lt-letter { left: 5%; right: 5%; top: 5%; height: 88%; z-index: 2; padding: 14px; overflow: hidden; border-radius: 2px; font: 11px/1.5 "American Typewriter", monospace; color: #24252B;
  background: url(/app/paper.png) 0 0 / 256px, #FBF7EE; background-blend-mode: multiply; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lt-pocket { inset: 0; z-index: 3; background: url(/app/paper.png) 0 0 / 256px, #F6F4EF; background-blend-mode: multiply; clip-path: polygon(0 22%, 50% 62%, 100% 22%, 100% 100%, 0 100%); }
.lt-flap { left: 0; right: 0; top: 0; height: 60%; z-index: 4; transform-origin: top; background: url(/app/paper.png) 0 0 / 256px, #F6F4EF; background-blend-mode: multiply;
  clip-path: polygon(0 0, 100% 0, 56% 95%, 50% 100%, 44% 95%); }
.lt-from { font: 16px ui-monospace, "Courier New", monospace; color: #2E3A86; margin-top: 22px; }
:root[data-theme="dark"] .lt-from { color: #A9B4F5; }
.lt-opening.go .lt-flap { animation: lt-flap .7s cubic-bezier(.45,0,.25,1) .5s forwards; }
.lt-opening.go .lt-letter { animation: lt-slide .85s cubic-bezier(.3,0,.2,1) 1.25s forwards; }
@keyframes lt-flap { 0% { transform: rotateX(0); z-index: 4; } 49% { z-index: 4; } 50% { z-index: 1; background-color: #E9E6DF; } 100% { transform: rotateX(178deg); z-index: 1; background-color: #E9E6DF; } }
@keyframes lt-slide { to { transform: translateY(-72%); } }

/* ---------------------------------------------------------------- writing and the stay */
.lt-paper { position: relative; padding: 18px 20px; border-radius: 3px; background: url(/app/paper.png) 0 0 / 256px, #FBF7EE; background-blend-mode: multiply; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 10px 24px rgba(0,0,0,.07); }
.lt-paper textarea { width: 100%; min-height: 220px; border: 0; outline: 0; resize: vertical; background: transparent; color: #24252B; font: 17px/1.65 "American Typewriter", "Courier New", monospace; }
.lt-gestures { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.lt-gestures legend { font-weight: 600; margin-bottom: 8px; }
.lt-gestures .chip[aria-pressed="true"], .lt-gestures .chip.loved[aria-pressed="true"] { background: var(--ink); color: var(--page, #fff); }
.lt-gestures .chip.loved:not([aria-pressed="true"]) { background: color-mix(in srgb, #DB2777 9%, transparent); }
.lt-done { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0; text-align: center; }
.lt-when { font: 600 19px ui-monospace, "Courier New", monospace; color: #2E3A86; margin: 12px 0 0; }
:root[data-theme="dark"] .lt-when { color: #A9B4F5; }
.lt-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; color: inherit; text-decoration: none; }
.lt-row .grow { display: flex; flex-direction: column; gap: 2px; }

@media (prefers-reduced-motion: reduce) {
  .pbox-sleeve, .pbox-kraft, .pbox-print { transition: opacity .2s ease !important; }
  .pbox-sleeve, .pbox-kraft { transform: none !important; }
  .pbox .pbox-print { transform: none !important; opacity: 0; }
  .pbox.open .pbox-print { opacity: 1; transform: translateY(calc(var(--cw) * -1.1)) translateX(calc((var(--t) - .5) * var(--bw) * .62 + var(--s) * .2)) !important; }
}

/* one flat floor under the boxes: no page glow */

/* while a card is lifted, the box steps right out of the way (as in the app) */
.lt-boxes.lifting .pbox { opacity: 0 !important; transition: opacity .25s; }

/* On a wide screen the boxes sit side by side again (Krishi preferred it there); phones keep the stack. */
@media (min-width: 900px) {
  .lt-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px 24px; justify-items: center; }
  .lt-boxes .pbox + .pbox { margin-top: calc(var(--s) * -.3); }
  .lt-boxes .pbox { z-index: auto; }
  .lt-boxes.has-open .pbox:not(.open) { opacity: 1; filter: none; }
  .lt-boxes .pbox.open { z-index: 200; }
}
/* only the box itself takes clicks: its empty headroom (room for the fan) lets them through to the box behind */
.pbox { pointer-events: none; }
.pbox-hit, .pbox.open .pbox-prints { pointer-events: auto; }

/* Memories sits on the app's glow; the front city's colors glow softly behind the stack (as in the app) */
.lt-files { position: relative; }
.lt-aura { position: absolute; left: 50%; top: 120px; width: min(560px, 120vw); height: 420px; transform: translateX(-50%); pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side at 35% 40%, color-mix(in srgb, var(--from) 45%, transparent), transparent),
              radial-gradient(closest-side at 70% 70%, color-mix(in srgb, var(--to) 35%, transparent), transparent); filter: blur(40px); }
.lt-files > :not(.lt-aura) { position: relative; z-index: 1; }
.lt-foot { margin-top: 28px; }
/* closed, a box is just its sleeve (as on the phone): the kraft box and its files appear when it opens */
.pbox-kraft, .pbox-prints { opacity: var(--part); transition: transform .6s cubic-bezier(.22,1,.36,1), opacity .3s ease; }
.av-sys { display: inline-grid; place-items: center; color: #fff; background: linear-gradient(135deg, #A48BF5, #DC5F80); }
