.scroll {
  position: relative;
  display: inline-block;
  --ink-color: #4a3728;
}

.scroll .paper {
  position: relative;
  padding: 2rem 3rem;
  background: linear-gradient(
    135deg,
    #f5e6d3 0%,
    #e8d4b8 25%,
    #f0dbc4 50%,
    #e5d0b5 75%,
    #f2dfc8 100%
  );
  border-radius: 4px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 0 50px rgba(139, 107, 75, 0.1);
  overflow: hidden;
}

/* DECAY LEVELS */

.pristine .paper {
  background: linear-gradient(
    135deg,
    #faf8f3 0%,
    #f5efe6 50%,
    #faf4eb 100%
  );
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(139, 107, 75, 0.05);
}

.aged .paper {
  background: linear-gradient(
    135deg,
    #f5e6d3 0%,
    #e8d4b8 25%,
    #f0dbc4 50%,
    #e5d0b5 75%,
    #f2dfc8 100%
  );
}

.weathered .paper {
  background: linear-gradient(
    135deg,
    #e8d4b8 0%,
    #d9c4a0 25%,
    #e0cda8 50%,
    #d4bf9d 75%,
    #dec9a3 100%
  );
  filter: contrast(1.1) brightness(0.95);
}

.crumbling .paper {
  background: linear-gradient(
    135deg,
    #d4c4a8 0%,
    #c4b090 25%,
    #cfbc9f 50%,
    #c0a888 75%,
    #c8b495 100%
  );
  filter: contrast(1.2) brightness(0.85);
}

.crumbling .paper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(0, 0, 0, 0.05) 2px, transparent 2px);
  background-size: 50px 50px, 30px 30px, 70px 70px;
  pointer-events: none;
}

/* TEXTURE OVERLAY */

.texture .paper::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* AGED EDGES */

.scroll .agedEdge {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-image: linear-gradient(
    135deg,
    rgba(139, 107, 75, 0.3) 0%,
    rgba(101, 77, 55, 0.5) 25%,
    rgba(139, 107, 75, 0.3) 50%,
    rgba(101, 77, 55, 0.5) 75%,
    rgba(139, 107, 75, 0.3) 100%
  ) 1;
  pointer-events: none;
  border-radius: 4px;
}

.crumbling .agedEdge {
  border-image: linear-gradient(
    135deg,
    rgba(101, 77, 55, 0.6) 0%,
    rgba(75, 55, 35, 0.8) 25%,
    rgba(101, 77, 55, 0.6) 50%,
    rgba(75, 55, 35, 0.8) 75%,
    rgba(101, 77, 55, 0.6) 100%
  ) 1;
}

/* CONTENT STYLES */

.scroll .content {
  position: relative;
  z-index: 1;
  font-family: 'IM Fell English', 'Palatino', 'Georgia', serif;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-color);
}

.scroll .paragraph {
  margin: 0 0 1rem 0;
  text-align: justify;
  text-indent: 2rem;
}

.scroll .paragraph:last-child {
  margin-bottom: 0;
}

.scroll .char {
  display: inline-block;
  opacity: 0.9;
}

/* FLOWING INK ANIMATION */

.flowingInk .char {
  animation: ink-flow 0.5s ease-out forwards;
}

.flowingInk .char:nth-child(3n) {
  animation-delay: 0.1s;
}

.flowingInk .char:nth-child(7n) {
  animation-delay: 0.2s;
}

@keyframes ink-flow {
  0% {
    opacity: 0;
    transform: translateY(-2px);
    filter: blur(1px);
  }
  100% {
    opacity: 0.9;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* WAX SEAL */

.scroll .waxSeal {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  background: radial-gradient(
    circle at 30% 30%,
    #c41e3a 0%,
    #8b1434 50%,
    #6b1028 100%
  );
  border-radius: 50%;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.scroll .waxSeal::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
}

/* INK COLOR VARIATIONS */

.scroll [style*='#1a1a1a'] .char {
  color: #2a2520;
}

.scroll [style*='#8b2942'] .char {
  color: #8b2942;
}

.scroll [style*='#c9a227'] .char {
  color: #a68b20;
}

/* SCROLL CURL EFFECT (top and bottom) */

.scroll .paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    transparent 100%
  );
  pointer-events: none;
}

/* HOVER EFFECT */

.scroll:hover .paper {
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 0 50px rgba(139, 107, 75, 0.15);
}
