:root {
  --wine: #632d36;
  --wine-dark: #321c22;
  --rust: #a64e32;
  --copper: #bd754b;
  --gold: #c6a15e;
  --gold-light: #e2c991;
  --olive: #687052;
  --paper: #eee2ca;
  --paper-light: #f7efdf;
  --ink: #392923;
  --muted: #8d7460;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #f4e9d6;
  background: radial-gradient(
    ellipse at 50% 45%,
    #56352f 0%,
    #2c2020 48%,
    #171416 100%
  );
  font-family: "Vazirmatn", sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  opacity: 0.18;
}

.ambient-one {
  top: -170px;
  right: -100px;
  background: #a64e32;
}

.ambient-two {
  bottom: -200px;
  left: -100px;
  background: #a37a3e;
}

.grain,
.cover-texture,
.paper-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grain {
  z-index: 10;
  opacity: 0.09;
  background-image: url("https://www.transparenttextures.com/patterns/natural-paper.png");
}

.experience {
  width: 100%;
  min-height: 100vh;
  padding: 38px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.intro {
  text-align: center;
  margin-bottom: 26px;
}

.eyebrow,
.cover-edition,
.cover-number,
.cover-small-title,
.cover-bottom,
.final-kicker,
.footer-note {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 3px;
}

.eyebrow {
  color: var(--gold-light);
  font-size: 11px;
}

.intro h1 {
  margin: 10px 0 4px;
  font:
    500 clamp(35px, 5vw, 58px) "Playfair Display",
    serif;
  letter-spacing: -1.5px;
}

.intro h1 em {
  color: var(--gold-light);
  font-family: "Cormorant Garamond", serif;
}

.intro p {
  color: #c7aa91;
  font-size: 12px;
  margin: 8px 0 0;
  letter-spacing: 0.5px;
}

/* BOOK STAGE */

.album-stage {
  width: min(100%, 850px);
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1800px;
  position: relative;
}

.album-shadow {
  position: absolute;
  width: 78%;
  height: 45px;
  bottom: 28px;
  background: #080607;
  filter: blur(24px);
  opacity: 0.75;
  border-radius: 50%;
}

.book-shell {
  width: 100%;
  max-width: 760px;
  position: relative;
  z-index: 2;
  padding: 12px;
  border-radius: 5px 12px 12px 5px;
  background: linear-gradient(
    90deg,
    #171012,
    #6b4431 2%,
    #24191a 5%,
    #3c2924 95%,
    #100c0d
  );
  box-shadow:
    0 30px 65px #080506a8,
    0 7px 0 #120d0e,
    0 10px 0 #6a4938,
    0 14px 0 #211516;
}

#album {
  width: 100%;
  position: relative;
  margin: auto;
}

.page {
  background: var(--paper-light);
  color: var(--ink);
  overflow: hidden;
  position: relative;
  border: 1px solid #d4c3a5;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.page.--left {
  border-right: 1px solid #c7b28f;
}

.page.--right {
  border-left: 1px solid #c7b28f;
}

.page.--hard {
  background: #4a252b;
}

.page.--flipping {
  box-shadow: 0 8px 25px #0005;
}

/* COVER */

.cover-page {
  color: var(--gold-light);
  background: radial-gradient(
    ellipse at 50% 42%,
    #7a3c3c 0%,
    #512831 52%,
    #28191f 100%
  );
  border: 1px solid #a9824e;
  box-shadow:
    inset 0 0 0 5px #3c2227,
    inset 0 0 0 6px #b28a50,
    inset 0 0 35px #130b0d;
}

.cover-texture {
  opacity: 0.28;
  background-image: url("https://www.transparenttextures.com/patterns/dark-leather.png");
  mix-blend-mode: screen;
}

.cover-inner-border {
  position: absolute;
  inset: 17px;
  border: 1px solid #c6a15e;
  outline: 1px solid #c6a15e55;
  outline-offset: 5px;
  pointer-events: none;
}

.cover-inner-border::before,
.cover-inner-border::after {
  content: "✦";
  position: absolute;
  color: var(--gold-light);
  font-size: 18px;
}

.cover-inner-border::before {
  top: -12px;
  left: -8px;
}

.cover-inner-border::after {
  bottom: -12px;
  right: -8px;
}

.cover-top,
.cover-bottom {
  position: absolute;
  left: 36px;
  right: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #dfc38b;
}

.cover-top {
  top: 34px;
}

.cover-bottom {
  bottom: 27px;
}

.cover-monogram {
  font-size: 19px;
  letter-spacing: 1px;
}

.cover-monogram i {
  color: #d9a37b;
  font-style: normal;
  font-size: 12px;
}

.cover-center {
  position: absolute;
  top: 16%;
  width: 100%;
  text-align: center;
  padding: 0 20px;
}

.cover-emblem {
  width: 45px;
  height: 45px;
  margin: 0 auto 13px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold-light);
}

.cover-emblem svg {
  width: 22px;
  stroke-width: 1.2;
}

.cover-small-title {
  font-size: 9px;
  color: #d6b77d;
}

.cover-center h2 {
  font:
    500 clamp(32px, 5vw, 48px)/1.05 "Playfair Display",
    serif;
  color: #f1dfbb;
  margin: 13px 0;
  text-shadow: 0 3px 15px #160b0c;
}

.cover-center h2 em {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.18em;
  color: #d9a36e;
}

.cover-rule,
.final-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--gold-light);
}

.cover-rule span,
.final-divider span {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.cover-rule svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.3;
}

.cover-center p {
  color: #d6bda0;
  font:
    italic 14px "Cormorant Garamond",
    serif;
  margin-top: 12px;
}

.cover-spine-decoration {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 13px;
  width: 10px;
  border-left: 1px solid #d3b16d66;
  border-right: 1px solid #1a0e12;
  background: linear-gradient(90deg, #1c1014, #75463d, #2a171c);
}

/* LOCK ON COVER */

.lock-plaque {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: min(75%, 270px);
  padding: 13px 15px 12px;
  text-align: center;
  color: #513b26;
  background: linear-gradient(135deg, #e4c98e, #a77b40 48%, #e3c78c);
  border: 1px solid #f1dba9;
  outline: 1px solid #6c4b2b;
  outline-offset: -5px;
  border-radius: 4px;
  box-shadow:
    0 6px 12px #12090b80,
    inset 0 1px 3px #fff8d5;
}

.plaque-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font:
    600 9px "Cormorant Garamond",
    serif;
  letter-spacing: 2px;
}

.plaque-heading svg {
  width: 13px;
  height: 13px;
}

.lock-plaque p {
  margin: 7px 0;
  font-size: 10px;
}

#lockForm {
  display: flex;
  gap: 5px;
  direction: rtl;
}

#password {
  min-width: 0;
  flex: 1;
  height: 31px;
  border: 1px solid #8d693d;
  background: #f4e5c6;
  color: #3b2920;
  border-radius: 2px;
  text-align: center;
  outline: none;
  font-size: 11px;
}

#password::placeholder {
  color: #8d7655;
}

#lockForm button {
  width: 36px;
  border: 1px solid #5b3d2b;
  border-radius: 2px;
  background: #59313a;
  color: #f2d9a3;
  display: grid;
  place-items: center;
  transition: 0.25s;
}

#lockForm button:hover {
  background: #382027;
}

#lockForm button svg {
  width: 15px;
}

.lock-message {
  display: block;
  margin-top: 7px;
  font-size: 9px;
  color: #63452d;
}

.lock-message.error {
  color: #762b2b;
}

/* MEMORY PAGE */

.memory-page {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 34px 28px;
  background:
    radial-gradient(ellipse at 20% 15%, #fff9e9 0%, transparent 48%),
    linear-gradient(135deg, #f4ead7, #e9dcc4);
}

.memory-page::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid #c6ae85;
  pointer-events: none;
}

.memory-page::after {
  content: "";
  position: absolute;
  inset: 17px;
  border: 1px solid #c6ae8545;
  pointer-events: none;
}

.page-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8c7054;
  font:
    10px "Cormorant Garamond",
    serif;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

.page-topline .line {
  width: 45px;
  height: 1px;
  background: #b99c6e;
}

.memory-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
  direction: ltr;
  min-height: 78%;
  position: relative;
  z-index: 1;
}

.photo-zone {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-width: 0;
}

.polaroid {
  width: 100%;
  max-width: 225px;
  padding: 10px 10px 36px;
  background: #fffdf7;
  box-shadow:
    0 12px 25px #5a3d2b24,
    0 2px 4px #3d2a1b25;
  transform: rotate(-3deg);
  position: relative;
  transition: transform 0.5s ease;
}

.polaroid:hover {
  transform: rotate(0deg) translateY(-4px);
}

.polaroid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: #fffdf7;
}

.polaroid-caption {
  position: absolute;
  bottom: 9px;
  left: 10px;
  right: 10px;
  text-align: center;
  font:
    italic 14px "Cormorant Garamond",
    serif;
  color: #79614b;
}

.photo-tape {
  position: absolute;
  width: 68px;
  height: 18px;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  background: #c5a46a99;
  z-index: 2;
}

.memory-copy {
  direction: rtl;
  text-align: right;
  min-width: 0;
}

.memory-index {
  color: #a46b46;
  font:
    11px "Cormorant Garamond",
    serif;
  letter-spacing: 2px;
}

.memory-copy h2 {
  font:
    500 clamp(23px, 3vw, 33px) "Vazirmatn",
    sans-serif;
  color: #59362d;
  margin: 13px 0 5px;
}

.memory-date {
  color: #a07d5e;
  font:
    italic 14px "Cormorant Garamond",
    serif;
  direction: ltr;
  text-align: right;
}

.memory-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 0;
  color: #a66d48;
}

.memory-divider span {
  height: 1px;
  width: 36px;
  background: #c5a77d;
}

.memory-divider svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.2;
}

.memory-description {
  font-size: 12px;
  line-height: 2.4;
  color: #715849;
  white-space: pre-line;
}

.memory-signature {
  display: block;
  margin-top: 19px;
  color: #a46b46;
  font:
    italic 15px "Cormorant Garamond",
    serif;
}

.botanical-decoration {
  position: absolute;
  right: 19px;
  bottom: 20px;
  color: #9a8760;
  opacity: 0.35;
}

.botanical-decoration svg {
  width: 34px;
  height: 34px;
  stroke-width: 1;
}

.page-number {
  position: absolute;
  bottom: 23px;
  left: 30px;
  color: #9d8465;
  font:
    12px "Cormorant Garamond",
    serif;
}

/* FINAL PAGE */

.final-page {
  background: radial-gradient(ellipse at center, #f6edda, #e4d4b8);
  display: flex;
  justify-content: center;
  align-items: center;
}

.paper-grain {
  opacity: 0.12;
  background-image: url("https://www.transparenttextures.com/patterns/natural-paper.png");
}

.final-border {
  position: absolute;
  inset: 20px;
  border: 1px solid #b99b6d;
  outline: 1px solid #b99b6d55;
  outline-offset: 5px;
}

.final-content {
  position: relative;
  z-index: 1;
  width: 78%;
  text-align: center;
  color: #59382f;
}

.final-kicker {
  color: #a27b53;
  font-size: 10px;
}

.final-heart {
  display: block;
  width: 24px;
  margin: 24px auto;
  color: #a64e45;
  stroke-width: 1.2;
}

.final-content h2 {
  font:
    500 34px "Playfair Display",
    serif;
  margin: 0 0 20px;
}

.final-content h2 em {
  color: #a65d43;
  font-family: "Cormorant Garamond", serif;
}

.final-divider {
  margin-bottom: 24px;
}

.final-divider svg {
  width: 18px;
  stroke-width: 1;
}

.final-content p {
  white-space: pre-line;
  font-size: 13px;
  line-height: 2.5;
  color: #765b49;
}

.final-signature {
  display: block;
  margin-top: 25px;
  font:
    italic 16px "Cormorant Garamond",
    serif;
  color: #a36d4c;
}

.restart-button {
  margin-top: 30px;
  border: 1px solid #ad8a5d;
  color: #765238;
  background: transparent;
  padding: 10px 18px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.3s;
}

.restart-button:hover {
  background: #765238;
  color: #f5e9d4;
}

.restart-button svg {
  width: 14px;
}

/* CONTROLS */

.stage-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c3a78c;
  font-size: 11px;
  margin-top: 27px;
}

.stage-caption svg {
  width: 14px;
  stroke-width: 1.3;
}

.album-controls {
  display: flex;
  align-items: center;
  gap: 25px;
  margin-top: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.album-controls.ready {
  opacity: 1;
  pointer-events: auto;
}

.control-button {
  width: 37px;
  height: 37px;
  border: 1px solid #a9895c;
  background: transparent;
  color: #e4c995;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: 0.25s;
}

.control-button:hover:not(:disabled) {
  background: #a9895c;
  color: #28191b;
}

.control-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.control-button svg {
  width: 17px;
}

.page-progress {
  width: 150px;
  text-align: center;
  color: #d9bd8d;
  font:
    12px "Cormorant Garamond",
    serif;
  letter-spacing: 1px;
}

.progress-track {
  height: 2px;
  margin-top: 8px;
  background: #725746;
}

#progressFill {
  width: 0;
  height: 100%;
  background: #d3b16e;
  transition: width 0.4s;
}

.footer-note {
  margin-top: auto;
  padding-top: 35px;
  color: #947c68;
  font-size: 9px;
}

/* RESPONSIVE */

@media (max-width: 650px) {
  .experience {
    padding: 25px 10px;
  }

  .intro {
    margin-bottom: 20px;
  }

  .intro p {
    font-size: 10px;
  }

  .book-shell {
    padding: 7px;
  }

  .memory-page {
    padding: 26px 18px;
  }

  .memory-layout {
    gap: 12px;
  }

  .polaroid {
    padding: 7px 7px 29px;
  }

  .memory-copy h2 {
    font-size: 20px;
  }

  .memory-description {
    font-size: 10px;
    line-height: 2.1;
  }

  .memory-date {
    font-size: 12px;
  }

  .lock-plaque {
    bottom: 56px;
    padding: 10px;
  }

  .cover-top,
  .cover-bottom {
    left: 25px;
    right: 25px;
  }

  .cover-top {
    top: 26px;
  }

  .cover-bottom {
    bottom: 19px;
  }

  .cover-center {
    top: 13%;
  }

  .cover-center h2 {
    font-size: 34px;
  }
}

@media (max-width: 390px) {
  .memory-layout {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 9px;
  }

  .memory-copy h2 {
    font-size: 17px;
  }

  .memory-description {
    font-size: 9px;
  }

  .polaroid-caption {
    font-size: 11px;
  }

  .cover-center h2 {
    font-size: 29px;
  }

  .lock-plaque {
    width: 82%;
  }
}

/* Keep the inner album pages completely concealed until the password is accepted. */
#album:not(.is-unlocked) > .page:not(.cover-page) {
  position: absolute !important;
  inset: 0;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* A lighter shadow makes the page turn feel less heavy on touch screens. */
#album .page.--flipping {
  box-shadow: 0 4px 14px #0003;
}

#lockForm button:disabled,
#password:disabled {
  opacity: 0.7;
  cursor: default;
}

@media (max-width: 650px) {
  /* Prevent accidental text selection while swiping through the book. */
  #album.is-unlocked,
  #album.is-unlocked .page {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  #album.is-unlocked img {
    -webkit-user-drag: none;
  }
}

/* Before unlock, render only the physical front cover at the same page size. */
#album:not(.is-unlocked) {
  height: 560px;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#album:not(.is-unlocked) > .cover-page {
  width: min(100%, 420px);
  height: 560px;
  flex: 0 0 min(100%, 420px);
}

@media (max-width: 650px) {
  #album:not(.is-unlocked) {
    height: min(70dvh, 560px);
    min-height: 373px;
  }

  #album:not(.is-unlocked) > .cover-page {
    width: 100%;
    height: 100%;
    flex-basis: 100%;
  }
}

/* Only album navigation buttons can turn pages */
#album.is-unlocked {
  touch-action: pan-y;
}

#album.is-unlocked .page {
  -webkit-user-drag: none;
  user-select: none;
}

.ambient,
.album-shadow {
  transform: translateZ(0);
  will-change: transform;
}
@media (max-width: 650px) {
  /* حذف هاله‌های رنگی و سایه‌ی تار زیر آلبوم در گوشی */
  .ambient,
  .album-shadow {
    display: none !important;
  }

  /* حذف بافت چرمی کاور که به خاطر mix-blend-mode پردازش بالایی می‌خواهد */
  .cover-texture {
    display: none !important;
  }

  /* بهینه‌سازی رندر صفحات برای کارت گرافیک گوشی */
  .page {
    box-shadow: none !important;
    transform: translateZ(0);
    will-change: transform;
  }
}
