/* style.css — Component library page styling for /style/ */

/* Component grid layout */
#component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

/* Component card */
.style-comp {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.style-comp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.style-comp-head h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink);
}

.style-comp-badge {
  background: var(--slime);
  color: var(--card);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.style-comp p.small {
  margin: 8px 0 0 0;
  color: var(--ink);
  opacity: 0.85;
  line-height: 1.4;
}

/* Variant wrapper */
.style-variant {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
  border-opacity: 0.2;
}

.style-variant-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.style-variant-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.style-copy {
  background: transparent;
  border: 1px solid var(--slime);
  color: var(--slime);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.style-copy:hover {
  background: var(--slime);
  color: var(--card);
}

.style-preview {
  background: var(--paper);
  border: 1px dashed var(--ink);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.style-code {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 12px;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace;
  font-size: 0.85rem;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.style-notes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  border-opacity: 0.2;
  color: var(--ink);
  opacity: 0.7;
  font-size: 0.85rem;
}

/* Category filter styling */
#component-filters {
  padding: 16px;
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.tool-field label {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}

.tool-field input,
.tool-field select {
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
}

.tool-field input:focus,
.tool-field select:focus {
  outline: 2px solid var(--slime);
  outline-offset: 2px;
}

/* Component preview examples */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-label input[type="checkbox"]:checked .checkmark {
  background: var(--slime);
  border-color: var(--slime);
}

.checkmark::after {
  content: '';
  opacity: 0;
}

.checkbox-label input[type="checkbox"]:checked .checkmark::after {
  opacity: 1;
  content: '✓';
  color: var(--card);
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 16px;
}

.counter-card {
  text-align: center;
}

.counter-card .title {
  font-size: 2rem;
  margin: 0 0 8px 0;
  color: var(--slime);
}

.card .small {
  margin: 0;
  color: var(--ink);
  opacity: 0.8;
}

/* Utility button styles */
.btn-copy {
  font-size: 1.1rem;
  cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  #component-grid {
    grid-template-columns: 1fr;
  }

  .style-variant {
    padding-top: 12px;
  }

  .style-code {
    font-size: 0.75rem;
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .style-comp,
  .style-variant,
  .style-copy,
  .btn-ghost {
    transition: none;
  }
}

/* Component category summary section */
#component-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0;
  text-align: center;
}

.category-stat {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
}

.category-stat .number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slime);
  line-height: 1;
}

.category-stat .label {
  font-size: 0.75rem;
  color: var(--ink);
  opacity: 0.85;
  margin-top: 4px;
}

/* Component notes enhancement */
.style-notes {
  font-style: italic;
  border-left: 3px solid var(--slime);
  padding-left: 12px;
  background: var(--paper);
}

/* Interactive component indicators */
.style-interactive::after {
  content: ' 🎮';
  font-size: 0.8em;
  opacity: 0.7;
}

/* Copy button group styling */
.style-variant-head {
  gap: 8px;
}

.style-copy {
  min-width: 36px;
}

/* Code block enhancements for better readability */
.style-code {
  tab-size: 2;
  hyphens: auto;
}

/* Hover states for code snippets */
.style-code:hover {
  background: var(--slime);
  color: var(--card);
}

/* Component list view (mobile) */
@media (max-width: 480px) {
  .style-comp-head h3 {
    font-size: 1rem;
  }

  .style-variant-label {
    font-size: 0.85rem;
  }

  .style-code {
    font-size: 0.7rem;
    padding: 6px;
  }
}