/* Custom styles for collapsible sections (details/summary) */

details {
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 12px;
  margin: 16px 0;
  background-color: #f6f8fa;
}

details[open] {
  background-color: #ffffff;
}

summary {
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 8px;
  margin: -12px;
  margin-bottom: 12px;
  border-radius: 6px 6px 0 0;
  background-color: #f6f8fa;
  position: relative;
  padding-left: 32px;
}

details[open] summary {
  border-bottom: 1px solid #e1e4e8;
  margin-bottom: 12px;
  background-color: #f6f8fa;
}

summary:hover {
  background-color: #e1e4e8;
}

/* Remove default marker */
summary::-webkit-details-marker {
  display: none;
}

summary::marker {
  display: none;
}

/* Add custom emoji/icon that changes on open/close */
summary::before {
  content: "▶";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #586069;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  transform: translateY(-50%) rotate(90deg);
}

/* Smooth transitions */
details {
  transition: background-color 0.2s ease;
}

/* Content padding */
details[open] > *:not(summary) {
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Style for code blocks inside details */
details pre {
  margin-top: 12px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  details {
    border-color: #30363d;
    background-color: #0d1117;
  }

  details[open] {
    background-color: #161b22;
  }

  summary {
    background-color: #161b22;
  }

  details[open] summary {
    border-bottom-color: #30363d;
    background-color: #161b22;
  }

  summary:hover {
    background-color: #21262d;
  }

  summary::before {
    color: #8b949e;
  }
}
