/* Nervy Archives - Collage & Cut-and-Paste Zine Elements */

/* Torn Paper Effect for Cards */
.entry-card {
  position: relative;
  overflow: visible;
}

/* Torn/Ripped Paper Edges */
.torn-edge {
  position: relative;
  clip-path: polygon(
    0% 0%, 2% 1%, 4% 0%, 6% 1.5%, 8% 0.5%, 10% 2%, 12% 0.5%, 14% 1%,
    16% 0%, 18% 1.5%, 20% 0%, 22% 2%, 24% 0.5%, 26% 1.5%, 28% 0%,
    30% 1%, 32% 0.5%, 34% 1.5%, 36% 0%, 38% 2%, 40% 0.5%, 42% 1%,
    44% 0%, 46% 1.5%, 48% 0%, 50% 2%, 52% 0.5%, 54% 1%, 56% 0%,
    58% 1.5%, 60% 0%, 62% 2%, 64% 0.5%, 66% 1.5%, 68% 0%, 70% 1%,
    72% 0.5%, 74% 1.5%, 76% 0%, 78% 2%, 80% 0.5%, 82% 1%, 84% 0%,
    86% 1.5%, 88% 0%, 90% 2%, 92% 0.5%, 94% 1%, 96% 0%, 98% 1.5%, 100% 0%,
    100% 100%, 0% 100%
  );
}

/* Layered / Stacked Paper Effect */
.layered-card {
  position: relative;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  box-shadow:
    8px 8px 0px rgba(0, 0, 0, 0.1),
    16px 16px 0px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.layered-card:hover {
  transform: translateY(-4px);
  box-shadow:
    12px 12px 0px rgba(0, 0, 0, 0.15),
    20px 20px 0px rgba(0, 0, 0, 0.08);
}

/* Collage Overlay - Tape Effect */
.tape-overlay {
  position: absolute;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    2px 2px 4px rgba(0, 0, 0, 0.2);
  transform: rotate(var(--rotation, -2deg));
  pointer-events: none;
}

/* Tape across corners - like scotch tape */
.tape-top {
  --rotation: -3deg;
  width: 50px;
  height: 8px;
  top: -4px;
  left: 30px;
}

.tape-bottom {
  --rotation: 2deg;
  width: 50px;
  height: 8px;
  bottom: -4px;
  right: 40px;
}

/* Rotated Elements (Like Cut-Out Photos) */
.rotate-slight {
  transform: rotate(-1.5deg);
}

.rotate-slight-rev {
  transform: rotate(1.5deg);
}

.rotate-medium {
  transform: rotate(-3deg);
}

.rotate-medium-rev {
  transform: rotate(3deg);
}

/* Collage Grid - Overlapping Layout */
.collage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  padding: 20px;
  position: relative;
}

.collage-item {
  position: relative;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  padding: 15px;
  transform: rotate(calc(var(--index) * -1.5deg));
  z-index: calc(100 - var(--index));
}

.collage-item:nth-child(odd) {
  transform: rotate(calc(var(--index) * 1.5deg));
}

/* Cut-Out / Magazine Clipping Style */
.clipping-style {
  position: relative;
  background: var(--surface-color);
  padding: 12px;
  border: 1px dashed var(--border-color);
  box-shadow:
    -2px 2px 4px rgba(0, 0, 0, 0.1),
    2px -2px 4px rgba(0, 0, 0, 0.05);
}

.clipping-style::before,
.clipping-style::after {
  content: '';
  position: absolute;
  background: repeating-linear-gradient(
    90deg,
    var(--border-color),
    var(--border-color) 2px,
    transparent 2px,
    transparent 6px
  );
}

.clipping-style::before {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  opacity: 0.3;
}

/* Torn Edges - Varied Widths */
.torn-irregular {
  position: relative;
  background: var(--surface-color);
  border-left: 3px solid var(--border-color);
  border-right: 2px solid var(--border-color);
  box-shadow:
    -3px 0 5px rgba(0, 0, 0, 0.1),
    3px 0 5px rgba(0, 0, 0, 0.05);
}

/* Pinned / Thumbtack Effect */
.pin {
  position: absolute;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 30% 30%, var(--accent-color), #6a3f7a);
  border-radius: 50%;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset -1px -1px 2px rgba(0, 0, 0, 0.2),
    inset 1px 1px 2px rgba(255, 255, 255, 0.3);
  z-index: 10;
}

/* Multiple Colored Sections (Color Blocking) */
.color-blocked {
  display: flex;
  flex-direction: column;
}

.color-block {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.color-block:nth-child(1) {
  background: rgba(215, 38, 56, 0.15);
  border-left: 6px solid var(--primary-color);
}

.color-block:nth-child(2) {
  background: rgba(138, 198, 209, 0.15);
  border-left: 6px solid var(--secondary-color);
}

.color-block:nth-child(3) {
  background: rgba(255, 224, 102, 0.15);
  border-left: 6px solid var(--accent-color);
}

/* Overlapping Text Box */
.text-overlay {
  position: absolute;
  background: rgba(244, 233, 240, 0.9);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

[data-theme="dark"] .text-overlay {
  background: rgba(42, 42, 62, 0.95);
}

/* Entry Card with Collage Treatment */
.entry-card.collage {
  position: relative;
  background: linear-gradient(135deg, var(--surface-color) 0%, var(--surface-color) 95%, var(--accent-color) 95%, var(--accent-color) 100%);
  border: none;
  padding: 0;
  overflow: hidden;
}

.entry-card.collage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(45deg, rgba(215, 38, 56, 0.05) 25%, transparent 25%, transparent 75%, rgba(215, 38, 56, 0.05) 75%),
    linear-gradient(45deg, rgba(138, 198, 209, 0.05) 25%, transparent 25%, transparent 75%, rgba(138, 198, 209, 0.05) 75%);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  pointer-events: none;
}

/* Staggered Stack Effect */
.stack-items {
  position: relative;
  padding: 20px;
}

.stack-item {
  position: relative;
  background: var(--surface-color);
  padding: 15px;
  margin-bottom: 0;
  border: 2px solid var(--border-color);
  transform: translateX(calc(var(--stack-index, 0) * 4px)) rotate(calc(var(--stack-index, 0) * 0.5deg));
  transition: all 0.3s ease;
}

.stack-item:nth-child(1) { --stack-index: -1; }
.stack-item:nth-child(2) { --stack-index: 0; }
.stack-item:nth-child(3) { --stack-index: 1; }

.stack-items:hover .stack-item {
  transform: translateX(calc(var(--stack-index, 0) * 8px)) rotate(calc(var(--stack-index, 0) * 1deg));
}

/* Glitch/Cut Effect Text */
.cut-text {
  position: relative;
  display: inline-block;
}

.cut-text::before,
.cut-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.cut-text::before {
  animation: glitch-anim 0.3s infinite;
  color: var(--primary-color);
  z-index: -1;
  text-shadow: -2px 0 var(--secondary-color);
}

.cut-text::after {
  animation: glitch-anim 0.3s infinite reverse;
  color: var(--accent-color);
  z-index: -2;
  text-shadow: 2px 0 var(--secondary-color);
}

@keyframes glitch-anim {
  0% {
    clip-path: rect(0, 900px, 0, 0);
  }
  20% {
    clip-path: rect(10px, 900px, 30px, 0);
  }
  40% {
    clip-path: rect(5px, 900px, 10px, 0);
  }
  60% {
    clip-path: rect(30px, 900px, 50px, 0);
  }
  80% {
    clip-path: rect(10px, 900px, 40px, 0);
  }
  100% {
    clip-path: rect(0, 0, 0, 0);
  }
}

/* Sketch/Doodle Border */
.doodle-border {
  position: relative;
  border: 2px solid var(--border-color);
  padding: 15px;
}

.doodle-border::before,
.doodle-border::after {
  content: '✦ ✦ ✦';
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--primary-color);
  opacity: 0.4;
}

.doodle-border::before {
  top: -15px;
  letter-spacing: 20px;
}

.doodle-border::after {
  bottom: -15px;
  letter-spacing: 20px;
}

/* Shadow/Depth Effect - Like Paper Underneath */
.depth-effect {
  position: relative;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.08),
    0 12px 24px rgba(0, 0, 0, 0.06);
}

.depth-effect::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05), transparent);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

/* Wave/Bent Paper Effect */
.bent-paper {
  position: relative;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  transform: perspective(1000px) rotateX(2deg) rotateY(-1deg);
  transform-style: preserve-3d;
}

/* Animation for entries appearing */
@keyframes collage-appear {
  0% {
    opacity: 0;
    transform: rotate(15deg) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

.collage-appear {
  animation: collage-appear 0.5s ease-out forwards;
}

.collage-appear:nth-child(1) { animation-delay: 0s; }
.collage-appear:nth-child(2) { animation-delay: 0.1s; }
.collage-appear:nth-child(3) { animation-delay: 0.2s; }
.collage-appear:nth-child(4) { animation-delay: 0.3s; }
.collage-appear:nth-child(n+5) { animation-delay: 0.4s; }

/* Responsive adjustments for collage elements */
@media (max-width: 768px) {
  .collage-grid {
    grid-template-columns: 1fr;
  }

  .layered-card {
    box-shadow:
      4px 4px 0px rgba(0, 0, 0, 0.1),
      8px 8px 0px rgba(0, 0, 0, 0.05);
  }

  .text-overlay {
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}

/* Print-friendly collage styles */
@media print {
  .tape-overlay,
  .pin {
    display: none;
  }

  .collage-item,
  .layered-card {
    box-shadow: none;
    border-color: #000;
  }
}
