@font-face {
  font-family: "Tahrir";
  src: url("../fonts/tahrir.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #e6e6e5;
  --ink: #171310;
  --ink-2: #554e49;
  --ink-3: #857c76;
  --red: #971d1f;
  --line: rgba(23, 19, 16, .18);
  --stage-h: 70svh;      /* قاب عینک؛ خود عینک در ثلث بالای آن می‌افتد */
  --text-y: 68svh;       /* جایی که متن‌ها ظاهر و محو می‌شوند */
  --pad: 8vw;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Tahrir", Tahoma, sans-serif;
  line-height: 1.9;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p, dl, dd, ol { margin: 0; padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- صحنه ---------- */
.stage {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--stage-h);
  z-index: 1;
  pointer-events: none;
}
.stage-in {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;     /* کل قاب دیده می‌شود، روی موبایل و دسکتاپ */
  opacity: 0;
  transition: opacity .18s linear;
}
.layer.on { opacity: 1; }

/* ---------- متن‌ها: سر جایشان می‌آیند و می‌روند ---------- */
.panel {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100svh;
  z-index: 2;
  pointer-events: none;
}
.b {
  position: absolute;
  top: var(--text-y);
  transform: translateY(-50%);
  inset-inline: var(--pad);
  max-width: 38rem;
  margin-inline-start: auto;
  opacity: 0;
  text-align: start;
}
.b > * { pointer-events: auto; }

/* عنوان */
.title img { margin-inline-start: auto; }
.title img + img { margin-top: -1.2%; }
.title img:nth-child(1) { width: 86%; }
.title img:nth-child(2) { width: 54%; }
.title img:nth-child(3) { width: 70%; }
.title img:nth-child(4) { width: 77%; }
.eqt { width: 76%; margin: 6% 0 0 auto; opacity: 0; }

h2 { color: var(--red); font-size: 1.1rem; margin-bottom: 1.1em; }

.cr { margin-bottom: 1em; }
.cr:last-child { margin-bottom: 0; }
.cr dt {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: .9rem; line-height: 1.5; color: var(--ink-3);
}
.cr dd { font-size: clamp(1.35rem, 6vw, 1.75rem); line-height: 1.5; }
.crs.tight .cr { margin-bottom: .55em; }
.crs.tight .cr dd { font-size: clamp(1.15rem, 5vw, 1.4rem); }

.names { font-size: clamp(1.2rem, 5.2vw, 1.5rem); line-height: 1.85; color: var(--ink-2); }
.names.close { color: var(--ink); line-height: 2; }

.path { list-style: none; border-inline-start: 1px solid var(--line); padding-inline-start: 18px; }
.path li { position: relative; margin-bottom: 1.3em; }
.path li:last-child { margin-bottom: 0; }
.path li::before {
  content: ""; position: absolute; inset-inline-start: -22px; top: .8em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--line);
}
.path li.now::before { background: var(--red); }
.path span { display: block; }
.yr { color: var(--red); font-size: 1.05rem; }
.pl { font-size: clamp(1.2rem, 5vw, 1.45rem); line-height: 1.45; }
.cst, .nt {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: .85rem; line-height: 1.8; color: var(--ink-3);
}
.aw {
  margin-top: .5em; padding-inline-start: 12px;
  border-inline-start: 2px solid var(--red);
  color: var(--red); font-size: 1rem; line-height: 1.75;
}

.b.wide { inset-inline: 0; max-width: none; margin-inline: 0; }
.motif { width: 62%; max-width: 330px; margin-inline: auto; }

.prompt { font-size: clamp(1.3rem, 5.6vw, 1.6rem); line-height: 1.85; }

.note {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: clamp(1.05rem, 4.4vw, 1.2rem);
  line-height: 2; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.note::before {
  content: ""; display: block; width: 22px; height: 1px;
  background: var(--red); margin-bottom: 12px;
}

/* ---------- جعبه‌ی یادگاری: کاغذ کهنه ---------- */
.link-btn, .send, .close { font: inherit; cursor: pointer; background: none; border: 0; }
.link-btn { color: var(--red); border-bottom: 1px solid var(--red); padding: 4px 0; font-size: 1.1rem; }
.link-btn:focus-visible, .send:focus-visible, .close:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--red); outline-offset: 3px;
}
.lbl {
  display: block; font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: .85rem; color: var(--ink-3); margin-bottom: 10px;
}
.sheetpaper {
  position: relative;
  background:
    repeating-linear-gradient(transparent 0 calc(2em - 1px), rgba(23,19,16,.10) calc(2em - 1px) 2em),
    linear-gradient(115deg, #f3efe4 0%, #efe9dc 45%, #eae2d2 100%);
  border: 1px solid rgba(23,19,16,.22);
  border-radius: 1px 3px 2px 4px / 3px 1px 4px 2px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 2px 3px 0 rgba(23,19,16,.06);
  font-size: 1.05rem;
}
.sheetpaper::before {           /* خط شیرازه */
  content: "";
  position: absolute;
  inset-inline-end: 9px;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(151,29,31,.35);
}
.sheetpaper textarea {
  width: 100%;
  display: block;
  border: 0; background: transparent; resize: none; overflow: hidden;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 1em; line-height: 2em;
  color: #241c16; outline: none; padding: 0;
  min-height: 6em;
}
.sheetpaper textarea::placeholder { color: rgba(36,28,22,.38); }
.hp { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.wf { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 14px; }
.counter { font-family: "Vazirmatn", Tahoma, sans-serif; font-size: .8rem; color: var(--ink-3); }
.send { background: var(--red); color: #efeeec; padding: 10px 22px; font-size: 1.05rem; }
.send[disabled] { opacity: .5; cursor: default; }
.send-state { margin-top: 10px; font-family: "Vazirmatn", Tahoma, sans-serif; font-size: .85rem; color: var(--ink-2); min-height: 1.4em; }

/* ---------- پایان ---------- */
.outro {
  position: fixed;
  left: 0; right: 0;
  bottom: 6svh;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.5svh;
  opacity: 0;
  pointer-events: none;
}
.outro.live { pointer-events: auto; }
.showinfo { width: 84%; max-width: 420px; }
.ticket { display: block; width: 46%; max-width: 210px; }

/* ارتفاع اسکرول را جاوااسکریپت می‌سازد */
.scroller { position: relative; z-index: 0; }

/* ---------- همه‌ی یادگاری‌ها ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-back { position: absolute; inset: 0; background: rgba(23,19,16,.5); }
.sheet-body {
  position: absolute; inset: auto 0 0 0; max-height: 86svh;
  background: var(--bg); border-top: 2px solid var(--ink);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { font-size: 1.1rem; }
.close { color: var(--ink-2); font-size: .95rem; border-bottom: 1px solid var(--line); }
.sheet-scroll { overflow-y: auto; padding: 22px 20px 36px; -webkit-overflow-scrolling: touch; }
.sheet-scroll .note { margin-bottom: 28px; }
body.locked { overflow: hidden; }

/* ---------- دسکتاپ ---------- */
@media (min-width: 820px) {
  :root { --pad: 6vw; --text-y: 70svh; }
  .outro { bottom: 5svh; gap: 2.5svh; }
  .showinfo { max-width: 360px; }
  .ticket { max-width: 175px; }
  .b { max-width: 32rem; }
  .cr dd { font-size: 1.7rem; }
  .motif { max-width: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .layer { transition: none; }
}
