/* SuperDirt sample library — integrated with iHearYouCanCode docs layout */

body.docs-page.superdirt-page {
  align-items: stretch;
}

body.docs-page.superdirt-page .superdirt-layout {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}

.superdirt-sidebar {
  flex: 0 0 220px;
  border-right: 1px solid var(--border);
  padding: 32px 20px 48px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  background: var(--bg);
}

.superdirt-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9999b0;
  margin-bottom: 12px;
}

.superdirt-sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
}

.superdirt-sidebar-list a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.superdirt-sidebar-list a:hover {
  color: var(--accent);
  background: #0077cc0a;
}

.superdirt-content {
  flex: 1;
  min-width: 0;
  padding: 52px 32px 100px;
}

.superdirt-section {
  margin-bottom: 48px;
}

.superdirt-section:not(:last-child) {
  border-bottom: 1px solid var(--border);
  padding-bottom: 40px;
}

.superdirt-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.superdirt-intro {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.superdirt-credit {
  margin: 20px 0 24px;
}

.superdirt-credit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.superdirt-credit-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid #0077cc44;
  border-radius: var(--radius);
  background: #0077cc0a;
  transition: background 0.15s, border-color 0.15s;
}

.superdirt-credit-links a:hover {
  background: #0077cc18;
  border-color: var(--accent);
}

.superdirt-credit-links .material-symbols-outlined {
  font-size: 18px;
}

.superdirt-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 28px;
}

.superdirt-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 120px;
}

.superdirt-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.superdirt-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.superdirt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
  position: sticky;
  top: calc(var(--nav-h) + 8px);
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.superdirt-search-wrap {
  flex: 1 1 260px;
  position: relative;
}

.superdirt-search-wrap .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--muted);
  pointer-events: none;
}

#superdirt-search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: 14px/1.4 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#superdirt-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #0077cc22;
}

.superdirt-filter-hint {
  font-size: 13px;
  color: var(--muted);
}

.superdirt-category {
  margin-bottom: 40px;
  scroll-margin-top: calc(var(--nav-h) + 72px);
}

.superdirt-category-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #0077cc22;
}

.superdirt-category-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.superdirt-category-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.superdirt-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.sample-folder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sample-folder:hover {
  border-color: #0077cc55;
}

.sample-folder.is-open {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sample-folder.is-hidden {
  display: none;
}

.folder-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background 0.15s;
}

.folder-header:hover {
  background: #0077cc0a;
}

.folder-name {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.folder-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.folder-chevron {
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.2s;
}

.sample-folder.is-open .folder-chevron {
  transform: rotate(180deg);
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  display: none;
}

.sample-folder.is-open .file-list {
  display: block;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 12px;
}

.file-list li:last-child {
  border-bottom: none;
}

.file-list li.is-hidden {
  display: none;
}

.file-name {
  flex: 1;
  min-width: 0;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.file-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #0077cc0a;
}

.file-btn.is-playing {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.file-btn .material-symbols-outlined {
  font-size: 16px;
}

.superdirt-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
  display: none;
}

.superdirt-empty.is-visible {
  display: block;
}

@media (max-width: 900px) {
  body.docs-page.superdirt-page .superdirt-layout {
    flex-direction: column;
  }

  .superdirt-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex: none;
    padding: 24px 20px;
  }

  .superdirt-content {
    padding: 40px 20px 72px;
  }

  .superdirt-toolbar {
    top: var(--nav-h);
  }

  .superdirt-folder-grid {
    grid-template-columns: 1fr;
  }
}
