@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%); }

/* ---------- خط‌های سقوط: تمام‌صفحه و همیشه رو به پایین ---------- */
.streaks {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.sk { position: absolute; inset-inline: 0; top: 0; height: 200%; will-change: transform; }
.sk img { width: 100%; height: 50%; object-fit: cover; }
.sk1 { animation: rise 5.5s linear infinite; opacity: .9; }
.sk2 { animation: rise2 8.5s linear infinite; opacity: .55; transform: scaleX(-1); inset-inline-start: 12%; }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(-50%); } }

@keyframes rise2 { from { transform: translateY(0) scaleX(-1); } to { transform: translateY(-50%) scaleX(-1); } }

/* ---------- صحنه: فریم‌های مرکب ---------- */
.stage {
  position: fixed;
  top: 0;
  left: 0;
  width: min(100vw, calc(100svh * .5263));
  aspect-ratio: 400 / 760;
  z-index: 1;
  pointer-events: none;
}
.stage-in { position: absolute; inset: 0; will-change: transform; }
.stage-in img {
  position: absolute;
  visibility: hidden;
  image-rendering: auto;
}
.stage-in img.on { visibility: visible; }

/* ---------- متن‌ها: سر جایشان می‌آیند و می‌روند ---------- */
.panel {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100svh;
  z-index: 3;
  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.live { 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.25rem; margin-bottom: 1em; }

.cr { margin-bottom: 1em; }
.cr:last-child { margin-bottom: 0; }
.cr dt {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: .95rem; line-height: 1.5; color: var(--ink-3);
}
.cr dd { font-size: clamp(1.55rem, 6.8vw, 2rem); line-height: 1.45; }
.crs.tight .cr { margin-bottom: .55em; }
.crs.tight .cr dd { font-size: clamp(1.3rem, 5.6vw, 1.6rem); }

.names { font-size: clamp(1.35rem, 5.8vw, 1.7rem); line-height: 1.8; color: var(--ink-2); }
.names.close { color: var(--ink); font-size: clamp(1.5rem, 6.4vw, 1.9rem); line-height: 1.85; }

.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.35rem, 5.6vw, 1.6rem); line-height: 1.4; }
.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.45rem, 6.2vw, 1.8rem); line-height: 1.8; }

.note {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: clamp(1.15rem, 4.9vw, 1.35rem);
  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;
  padding: 22px 26px 20px;
  font-size: 1.1rem;
  background:
    repeating-linear-gradient(transparent 0 calc(2em - 1px), rgba(23,19,16,.14) calc(2em - 1px) 2em) center 30px / calc(100% - 52px) auto no-repeat,
    url("../svg/paper.svg") 0 0 / 100% 100% no-repeat;
  filter: drop-shadow(2px 3px 0 rgba(23,19,16,.07));
}
.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: #1d1712; 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: 5svh;
  z-index: 3;
  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; }
}

/* ---------- نشانه‌ی اسکرول ---------- */
.hint {
  position: fixed;
  bottom: calc(2.5svh + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  color: var(--red);
  opacity: .45;
  pointer-events: none;
  transition: opacity .4s ease;
}
.hint .ring { opacity: 0; transition: opacity .4s ease; }
.hint .chev { transition: transform .4s ease; transform-origin: 12px 13px; }
.hint.up { pointer-events: auto; cursor: pointer; opacity: .75; }
.hint.up .ring { opacity: .5; }
.hint.up .chev { transform: rotate(180deg); }
.hint.gone { opacity: 0; }
