/* Footnote reference styling */
.footnote-ref {
  cursor: pointer;
  color: #ac4142;
  text-decoration: none;
  position: relative;
  padding: 0;
  border-radius: 3px;
  transition: background-color 0.2s;
  display: inline-block;
}

/* Touch feedback */
.footnote-ref:active {
  background-color: rgba(172, 65, 66, 0.1);
}

/* Tooltip styling */
.footnote-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 400px;
  max-width: calc(100vw - 40px);
  font-size: 16px;
  color: #333;
  z-index: 1000;
  margin-bottom: 8px;
}

/* List styling in tooltips */
.footnote-tooltip ul,
.footnote-tooltip ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.footnote-tooltip li {
  margin: 4px 0;
}

/* Adjust positioning for wider tooltips that might go off-screen */
.footnote-ref:nth-child(1) .footnote-tooltip {
  transform: translateX(-20%);  /* Adjust for first footnotes that might go off-screen left */
}

.footnote-ref:last-child .footnote-tooltip {
  transform: translateX(-80%);  /* Adjust for last footnotes that might go off-screen right */
}

/* Arrow at bottom of tooltip */
.footnote-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #fff;
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
}

/* Show tooltip when active class is present */
.footnote-ref.active {
  z-index: 10000;
}

.footnote-ref.active .footnote-tooltip {
  display: block;
}

/* Show tooltip on hover (for desktop) */
@media (hover: hover) {
  .footnote-ref:hover {
    background-color: rgba(172, 65, 66, 0.05);
    z-index: 10000;
  }

  .footnote-ref:hover .footnote-tooltip {
    display: block;
  }
}

/* Mobile overlay */
.footnote-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.footnote-overlay.active {
  display: block;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .footnote-tooltip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    max-height: 50vh;
    overflow-y: auto;
    z-index: 1000;
  }

  /* Hide arrow on mobile */
  .footnote-tooltip::after {
    display: none;
  }

  /* Ensure the tooltip animates smoothly */
  .footnote-tooltip {
    transition: transform 0.3s ease-out;
    transform: translateY(100%);
  }

  .footnote-ref.active .footnote-tooltip {
    transform: translateY(0);
  }

  /* Adjust list spacing on mobile */
  .footnote-tooltip ul,
  .footnote-tooltip ol {
    margin: 12px 0 12px 24px;
  }

  .footnote-tooltip li {
    margin: 8px 0;
  }
}

/* Original footnotes section */
.footnotes {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
} 