/* ============================================
   CONSPIRACY CORKBOARD LINK TREE
   "I've connected all the subdomains..."
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Permanent+Marker&family=Patrick+Hand&family=Inter:wght@400;600;700&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  --cork: #c4956a;
  --cork-dark: #a87d55;
  --cork-light: #d4a97a;
  --cork-grain-1: #b8894f;
  --cork-grain-2: #c99e6b;
  --paper: #fffef0;
  --paper-shadow: rgba(0, 0, 0, 0.25);
  --pin-red: #d32f2f;
  --pin-blue: #1976d2;
  --pin-green: #388e3c;
  --pin-yellow: #f9a825;
  --pin-purple: #7b1fa2;
  --string-red: #c62828;
  --coffee-stain: rgba(139, 90, 43, 0.15);
  --tape: rgba(255, 255, 200, 0.6);
  --marker-red: #c0392b;
  --marker-blue: #2980b9;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  background: #2c2016;
}

/* ---- Cork Board Background ---- */
.corkboard {
  min-height: 100vh;
  padding: 40px 20px 60px;
  background:
    /* Cork texture via repeating gradients */
    repeating-conic-gradient(var(--cork-grain-1) 0% 5%, transparent 5% 20%) 0 0 / 80px 80px,
    repeating-conic-gradient(var(--cork-grain-2) 0% 8%, transparent 8% 25%) 40px 40px / 60px 60px,
    linear-gradient(135deg, var(--cork) 0%, var(--cork-dark) 50%, var(--cork-light) 100%);
  position: relative;
}

/* Wood frame border */
.corkboard::before {
  content: '';
  position: fixed;
  inset: 0;
  border: 18px solid #5c3a1e;
  border-image: linear-gradient(
    135deg,
    #7a4e2d 0%,
    #5c3a1e 25%,
    #8b6237 50%,
    #5c3a1e 75%,
    #7a4e2d 100%
  ) 18;
  pointer-events: none;
  z-index: 100;
}

/* ---- Header / Case File ---- */
.case-header {
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  z-index: 10;
}

.case-file-stamp {
  display: inline-block;
  border: 4px solid var(--marker-red);
  padding: 15px 40px;
  transform: rotate(-2deg);
  position: relative;
  background: var(--paper);
  box-shadow: 4px 4px 12px var(--paper-shadow);
}

.case-file-stamp::before {
  content: 'TOP SECRET';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(3deg);
  background: var(--marker-red);
  color: white;
  padding: 2px 18px;
  font-family: 'Special Elite', monospace;
  font-size: 0.75rem;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.case-file-stamp::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  background: var(--pin-red);
  border-radius: 50%;
  box-shadow:
    inset -2px -2px 4px rgba(0,0,0,0.3),
    2px 2px 4px rgba(0,0,0,0.2);
  z-index: 2;
}

.profile-name {
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: #2c2016;
  margin-bottom: 4px;
}

.profile-tagline {
  font-family: 'Patrick Hand', cursive;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: #555;
  margin-bottom: 8px;
}

.case-subtitle {
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  color: var(--marker-red);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ---- Red String SVG (connects cards) ---- */
.string-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.string-layer line {
  stroke: var(--string-red);
  stroke-width: 1.5;
  opacity: 0.5;
  stroke-dasharray: 8 4;
}

/* ---- Cards Grid ---- */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 50px 40px;
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

/* ---- Individual Link Card ---- */
.link-card {
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: pin-in 0.6s ease-out both;
  cursor: pointer;
}

.link-card:nth-child(1) { transform: rotate(-1.5deg); animation-delay: 0.1s; }
.link-card:nth-child(2) { transform: rotate(2deg); animation-delay: 0.2s; }
.link-card:nth-child(3) { transform: rotate(-0.5deg); animation-delay: 0.3s; }
.link-card:nth-child(4) { transform: rotate(1.8deg); animation-delay: 0.4s; }
.link-card:nth-child(5) { transform: rotate(-2.5deg); animation-delay: 0.5s; }
.link-card:nth-child(6) { transform: rotate(1deg); animation-delay: 0.6s; }

@keyframes pin-in {
  0% {
    opacity: 0;
    transform: translateY(-40px) rotate(0deg) scale(0.8);
  }
  60% {
    opacity: 1;
    transform: translateY(5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Restore rotation after animation */
.link-card:nth-child(1) { animation-name: pin-in-1; }
.link-card:nth-child(2) { animation-name: pin-in-2; }
.link-card:nth-child(3) { animation-name: pin-in-3; }
.link-card:nth-child(4) { animation-name: pin-in-4; }
.link-card:nth-child(5) { animation-name: pin-in-5; }
.link-card:nth-child(6) { animation-name: pin-in-6; }

@keyframes pin-in-1 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(-1.5deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(-1.5deg) scale(1); }
}
@keyframes pin-in-2 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(2deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(2deg) scale(1); }
}
@keyframes pin-in-3 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(-0.5deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(-0.5deg) scale(1); }
}
@keyframes pin-in-4 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(1.8deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(1.8deg) scale(1); }
}
@keyframes pin-in-5 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(-2.5deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(-2.5deg) scale(1); }
}
@keyframes pin-in-6 {
  0% { opacity: 0; transform: translateY(-40px) rotate(0deg) scale(0.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(1deg) scale(1.02); }
  100% { opacity: 1; transform: rotate(1deg) scale(1); }
}

.link-card:hover {
  transform: rotate(0deg) scale(1.05) translateY(-4px) !important;
  z-index: 20;
}

/* The paper note */
.card-paper {
  background: var(--paper);
  padding: 25px 22px 20px;
  box-shadow:
    3px 3px 10px var(--paper-shadow),
    -1px -1px 3px rgba(255, 255, 255, 0.3);
  position: relative;
  text-decoration: none;
  display: block;
  color: inherit;
  transition: box-shadow 0.3s ease;
  /* Torn edge effect on bottom */
  clip-path: polygon(
    0% 0%, 100% 0%, 100% calc(100% - 8px),
    98% calc(100% - 4px), 95% 100%, 92% calc(100% - 6px),
    88% calc(100% - 2px), 84% 100%, 80% calc(100% - 5px),
    76% calc(100% - 1px), 72% 100%, 68% calc(100% - 7px),
    64% calc(100% - 2px), 60% 100%, 56% calc(100% - 4px),
    52% calc(100% - 8px), 48% 100%, 44% calc(100% - 3px),
    40% calc(100% - 6px), 36% 100%, 32% calc(100% - 5px),
    28% calc(100% - 1px), 24% 100%, 20% calc(100% - 7px),
    16% calc(100% - 3px), 12% 100%, 8% calc(100% - 4px),
    4% 100%, 2% calc(100% - 6px), 0% 100%
  );
}

.link-card:hover .card-paper {
  box-shadow:
    6px 6px 20px var(--paper-shadow),
    -2px -2px 6px rgba(255, 255, 255, 0.2);
}

/* Pushpin */
.pushpin {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  z-index: 15;
  box-shadow:
    inset -3px -3px 6px rgba(0, 0, 0, 0.3),
    inset 2px 2px 4px rgba(255, 255, 255, 0.3),
    2px 3px 6px rgba(0, 0, 0, 0.3);
}

.pushpin::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: #888;
  border-radius: 0 0 2px 2px;
}

.pushpin.red { background: radial-gradient(circle at 35% 35%, #ef5350, #b71c1c); }
.pushpin.blue { background: radial-gradient(circle at 35% 35%, #42a5f5, #0d47a1); }
.pushpin.green { background: radial-gradient(circle at 35% 35%, #66bb6a, #1b5e20); }
.pushpin.yellow { background: radial-gradient(circle at 35% 35%, #ffee58, #f57f17); }
.pushpin.purple { background: radial-gradient(circle at 35% 35%, #ab47bc, #4a148c); }

/* Tape strips (randomly on some cards) */
.tape-strip {
  position: absolute;
  background: var(--tape);
  border: 1px solid rgba(200, 200, 150, 0.4);
  z-index: 14;
}

.tape-strip.top-left {
  top: -6px;
  left: -8px;
  width: 50px;
  height: 18px;
  transform: rotate(-25deg);
}

.tape-strip.top-right {
  top: -4px;
  right: -10px;
  width: 45px;
  height: 18px;
  transform: rotate(20deg);
}

/* Card Content */
.card-title {
  font-family: 'Permanent Marker', cursive;
  font-size: 1.3rem;
  color: #2c2016;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-description {
  font-family: 'Patrick Hand', cursive;
  font-size: 1.05rem;
  color: #555;
  margin-bottom: 14px;
  line-height: 1.4;
}

.card-url {
  font-family: 'Special Elite', monospace;
  font-size: 0.78rem;
  color: #888;
  word-break: break-all;
  border-top: 1px dashed #ccc;
  padding-top: 8px;
}

/* Investigator note (sticky note style) */
.investigator-note {
  position: absolute;
  bottom: 15px;
  right: -15px;
  background: #fff9a5;
  padding: 6px 10px;
  font-family: 'Patrick Hand', cursive;
  font-size: 0.75rem;
  color: var(--marker-red);
  transform: rotate(5deg);
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);
  max-width: 160px;
  z-index: 16;
  line-height: 1.3;
}

.investigator-note::before {
  content: '📌 ';
}

/* Coffee stain on random cards */
.coffee-stain {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    transparent 55%,
    var(--coffee-stain) 56%,
    var(--coffee-stain) 62%,
    transparent 63%
  );
  pointer-events: none;
  z-index: 13;
}

.coffee-stain.stain-1 {
  width: 80px;
  height: 75px;
  bottom: -10px;
  left: -15px;
  transform: rotate(15deg);
}

.coffee-stain.stain-2 {
  width: 65px;
  height: 60px;
  top: 10px;
  right: -5px;
  transform: rotate(-20deg);
}

/* ---- Footer ---- */
.footer-note {
  text-align: center;
  margin-top: 60px;
  position: relative;
  z-index: 10;
}

.footer-paper {
  display: inline-block;
  background: var(--paper);
  padding: 12px 30px;
  transform: rotate(1deg);
  box-shadow: 3px 3px 8px var(--paper-shadow);
  position: relative;
}

.footer-paper::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: var(--pin-red);
  border-radius: 50%;
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.3),
    2px 2px 4px rgba(0, 0, 0, 0.2);
}

.footer-text {
  font-family: 'Patrick Hand', cursive;
  font-size: 0.95rem;
  color: #666;
}

.footer-text em {
  color: var(--marker-red);
  font-style: normal;
  font-family: 'Special Elite', monospace;
}

/* ---- Loading State ---- */
.loading {
  text-align: center;
  padding: 100px 20px;
  font-family: 'Special Elite', monospace;
  color: var(--paper);
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.loading::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ---- Error State ---- */
.error-card {
  background: #fff0f0;
  border: 2px dashed var(--marker-red);
  padding: 30px;
  text-align: center;
  max-width: 500px;
  margin: 60px auto;
  transform: rotate(-1deg);
  position: relative;
  z-index: 10;
}

.error-card h2 {
  font-family: 'Permanent Marker', cursive;
  color: var(--marker-red);
  margin-bottom: 10px;
}

.error-card p {
  font-family: 'Patrick Hand', cursive;
  color: #555;
  font-size: 1.1rem;
}

/* ---- Ambient Decorations ---- */
.doodle {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  font-size: 4rem;
}

.doodle-1 { top: 10%; left: 5%; transform: rotate(-15deg); }
.doodle-2 { top: 60%; right: 8%; transform: rotate(10deg); }
.doodle-3 { bottom: 15%; left: 12%; transform: rotate(-8deg); }
.doodle-4 { top: 30%; right: 3%; transform: rotate(20deg); }

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .corkboard {
    padding: 30px 15px 50px;
  }

  .corkboard::before {
    border-width: 10px;
  }

  .links-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .case-file-stamp {
    padding: 12px 24px;
  }

  .investigator-note {
    position: relative;
    bottom: auto;
    right: auto;
    transform: rotate(1deg);
    margin-top: 10px;
    display: inline-block;
  }

  .link-card:nth-child(n) {
    transform: rotate(0deg) !important;
  }

  .link-card:hover {
    transform: scale(1.02) translateY(-2px) !important;
  }
}

/* ---- Scanline flicker effect (subtle) ---- */
.corkboard::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.01) 2px,
    rgba(0, 0, 0, 0.01) 4px
  );
  pointer-events: none;
  z-index: 99;
}
