/* Everything else (color, spacing, buttons, tabs, boxes, labels) comes from
   Primer (https://primer.style) via the CDN link in index.html. This file is
   only the bespoke bits Primer doesn't have an opinion on: the puzzle's
   two-column build/solve layout, the tile canvases, and a few small icons
   and status treatments Primer CSS doesn't ship a component for. */

/* ---------- header ---------- */

.hero-title {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-links {
  gap: 0.75rem;
}

.hero-links .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------- difficulty nav ---------- */

.UnderlineNav-body {
  justify-content: center;
}

/* ---------- level panel ---------- */

.tab-panel {
  margin-bottom: 1.5rem;
}

.intro {
  max-width: 46rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1012px) {
  .puzzle-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  border-radius: 50%;
  background: var(--bgColor-accent-emphasis);
  color: var(--fgColor-onEmphasis);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.solve-panel .step-badge {
  background: var(--bgColor-success-emphasis);
}

/* ---------- tile palette ---------- */

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.palette-tile {
  padding: 0.3rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.palette-tile:not(:disabled):hover {
  border-color: var(--borderColor-accent-emphasis) !important;
  transform: translateY(-1px);
}

.palette-tile:disabled {
  opacity: 0.35;
  cursor: default;
}

.palette-tile canvas,
.slot canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* The build/solve "big picture" canvases (target preview, agent composite)
   have a fixed native pixel size (app.js's DISPLAY_BIG) - unlike the palette
   and slot thumbnails above, they must NOT stretch to fill their column, or
   they blow up to the full panel width. */
.preview canvas,
.comp-holder canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- your stack ---------- */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.slot {
  width: 92px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  gap: 0.35rem;
}

.slot.empty {
  font-size: 0.75rem;
  border-style: dashed !important;
}

.slot-controls {
  display: flex;
  gap: 0.15rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
}

.icon-btn .octicon {
  display: block;
}

.target-buttons {
  display: flex;
  gap: 0.6rem;
}

.target-buttons .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.placeholder {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-style: dashed !important;
}

/* ---------- solve panel ---------- */

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.phi-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.stage {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stage-col {
  min-width: 12rem;
}

.log-details summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  list-style: none; /* Firefox: suppresses the ::marker triangle */
}

.log-details summary::-webkit-details-marker,
.log-details summary::marker {
  display: none; /* Chrome/Safari: suppresses the native disclosure triangle */
  content: '';
}

.log-details summary .octicon {
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
}

.log-details[open] summary .octicon {
  transform: rotate(90deg);
}

.log {
  max-height: 9rem;
  overflow-y: auto;
}

/* ---------- misc ---------- */

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--borderColor-muted);
  border-top-color: var(--fgColor-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
