/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Accessibility - Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #667eea;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Header */
header {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  margin-bottom: 20px;
}

header h1 {
  font-size: 1.8em;
  margin-bottom: 5px;
}

header p {
  font-size: 1em;
  opacity: 0.9;
}

/* Main content */
main {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Filter section */
#filters {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #f0f0f0;
}

#filters h2 {
  font-size: 1.3em;
  margin-bottom: 15px;
  color: #667eea;
}

#tag-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#tag-buttons button {
  padding: 8px 16px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

#tag-buttons button:hover {
  background: #667eea;
  color: white;
}

#tag-buttons button.active {
  background: #667eea;
  color: white;
}

#tag-buttons button.show-all {
  background: #333;
  color: white;
  border-color: #333;
  font-weight: 600;
}

#tag-buttons button.show-all:hover {
  background: #555;
  border-color: #555;
}

/* Experiment cards */
#experiments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 1.1em;
  background: #f9f9f9;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

.experiment-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  background: #fafafa;
  transition: transform 0.2s, box-shadow 0.2s;
}

.experiment-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.experiment-card.hidden {
  display: none;
}

.experiment-card h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.5em;
}

.experiment-card h3 a {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
}

.experiment-card h3 a:hover {
  color: #764ba2;
}

.experiment-card .description {
  color: #555;
  margin-bottom: 15px;
  line-height: 1.6;
}

.experiment-card .card-link {
  display: block;
  margin-top: 15px;
  padding: 10px 20px;
  background: #667eea;
  color: white;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  border-radius: 5px;
  transition: background 0.2s, transform 0.1s;
}

.experiment-card .card-link:hover {
  background: #764ba2;
  transform: translateY(-2px);
}

.experiment-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 15px;
}

.experiment-card .tag {
  font-size: 0.8em;
  padding: 3px 10px;
  background: #e0e7ff;
  color: #4c51bf;
  border-radius: 12px;
}

.experiment-card .metadata {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
}

.experiment-card .metadata span {
  display: inline-block;
  margin-right: 15px;
}

.experiment-card img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin: 10px 0;
}

.experiment-card h4 {
  color: #555;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.experiment-card ul,
.experiment-card ol {
  margin-left: 20px;
  margin-bottom: 15px;
}

.experiment-card li {
  margin-bottom: 5px;
}

.experiment-card p {
  margin-bottom: 10px;
  color: #555;
}

.experiment-card a {
  color: #667eea;
  text-decoration: none;
}

.experiment-card a:hover {
  text-decoration: underline;
}

/* Back navigation link in header */
header nav {
  margin-top: 15px;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-block;
  color: white;
  text-decoration: none;
  font-size: 0.9em;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  transition: background 0.3s;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.print-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  background: white;
  color: #4c51bf;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.print-link:hover {
  background: #f5f5ff;
  color: #764ba2;
  border-color: #cbd5ff;
}

/* Experiment detail page styles */
.experiment-detail {
  max-width: 800px;
  margin: 0 auto;
}

.experiment-meta {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.experiment-meta .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.experiment-meta .tag {
  font-size: 0.85em;
  padding: 5px 12px;
  background: #e0e7ff;
  color: #4c51bf;
  border-radius: 12px;
}

.experiment-meta .metadata {
  font-size: 0.95em;
  color: #666;
}

.experiment-meta .metadata span {
  display: inline-block;
  margin-right: 20px;
}

.experiment-materials,
.experiment-content,
.experiment-references {
  margin-bottom: 40px;
}

.experiment-materials h2,
.experiment-content h2,
.experiment-references h2 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 1.6em;
}

.experiment-materials ul,
.experiment-references ul {
  list-style: disc;
  margin-left: 30px;
  line-height: 1.8;
}

.experiment-materials li,
.experiment-references li {
  margin-bottom: 8px;
  color: #555;
}

.experiment-content h2 {
  margin-top: 30px;
}

.experiment-content p {
  margin-bottom: 15px;
  line-height: 1.7;
  color: #555;
}

.experiment-content ul,
.experiment-content ol {
  margin-left: 30px;
  margin-bottom: 20px;
  line-height: 1.8;
}

.experiment-content li {
  margin-bottom: 8px;
}

.experiment-content a {
  color: #667eea;
  text-decoration: none;
}

.experiment-content a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  color: #666;
  font-size: 0.9em;
}

footer a {
  color: #667eea;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  header {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
  }

  header h1 {
    font-size: 1.5em;
  }

  header p {
    font-size: 0.9em;
  }

  main {
    padding: 20px;
  }

  #experiments {
    grid-template-columns: 1fr;
  }
}
