/* Shared toolbar styles for the sub-pages (droplets, ripple, starburst, boids, sand, viz).
   Static, no build step. Per-page tweaks (e.g. sand's compact sizing) are done by
   overriding the --tb-* custom properties on .toolbar in that page's own <style>. */

.toolbar {
  --tb-pad: 12px 20px;
  --tb-gap: 12px;
  --tb-btn-pad: 8px 16px;
  --tb-btn-font: 14px;
  --tb-icon: 16px;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--tb-gap);
  padding: var(--tb-pad);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  /* Never wrap; scroll horizontally when the buttons don't fit (mobile). */
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar {
  display: none;
}
.toolbar > * {
  flex-shrink: 0;
}

.toolbar button,
.toolbar a.button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--tb-btn-pad);
  font-family: inherit;
  font-size: var(--tb-btn-font);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.toolbar button:hover,
.toolbar a.button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.toolbar button svg,
.toolbar a.button svg {
  width: var(--tb-icon);
  height: var(--tb-icon);
  flex-shrink: 0;
}

.toolbar .back-button {
  /* Icon-only — keep it square-ish rather than the wide default button padding. */
  padding: 8px 10px;
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.3);
}
.toolbar .back-button:hover {
  background: rgba(255, 107, 107, 0.3);
  border-color: rgba(255, 107, 107, 0.5);
}

.toolbar .page-title {
  margin-right: auto;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* The hamburger toggle is only shown on mobile (see media query). */
.toolbar .menu-toggle {
  display: none;
  padding: 8px 10px;
}

/* On desktop the tools flow inline in the bar (the wrapper is transparent). */
.toolbar-tools {
  display: contents;
}

/* ---- Mobile: keep the title visible, collapse the tools into a menu ---- */
@media (max-width: 768px) {
  /* Let the dropdown panel escape the bar instead of being clipped/scrolled. */
  .toolbar {
    overflow: visible;
  }

  .toolbar .menu-toggle {
    display: flex;
  }

  /* Tools become a dropdown panel anchored under the toolbar. */
  .toolbar-tools {
    display: none;
    position: absolute;
    top: 100%;
    right: 8px;
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
  .toolbar.menu-open .toolbar-tools {
    display: flex;
  }

  /* Vertical dividers make no sense stacked in a column. */
  .toolbar-tools .sep {
    display: none;
  }
}
