/* ============================================================
   Craft component styles — shared by the homepage (/) craft
   preview and the full /craft listing page.

   Relies on the CSS variables already defined by each page's
   own <style> block (--heading, --body, --body-muted, --border,
   --card-bg, --card-hover-bg, --gooey-surface, --font-primary,
   --duration-smooth, --ease-smooth).
   ============================================================ */

/* ===== Craft Section ===== */
.craft-section {
  margin-top: 40px;
  width: 100%;
  max-width: 700px;
}

@media (max-width:768px) {
  .craft-section {
    max-width: 340px;
  }
}

@media (max-width:600px) {
  .craft-section {
    max-width: 290px;
  }
}

.craft-heading {
  font-size: 14px;
  font-weight: 500;
  color: var(--body-muted);
  margin-bottom: 16px;
}

.craft-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.craft-heading-row .craft-heading {
  margin-bottom: 0;
}

.craft-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
}

@media (max-width:768px) {
  .craft-grid {
    grid-template-columns: 1fr;
  }
}

/* Full-width craft cards (split button, pill menubar, dock) */
.craft-card-full {
  grid-column: 1 / -1;
}

/* A craft card is just a project-card used as a live preview */
.craft-card {
  cursor: default;
  pointer-events: auto;
  overflow: visible !important;
  /* allow gooey dropdown to overflow the card */
}

.craft-card:hover {
  transform: none;
  background-color: var(--card-bg);
}

/* The demo area inside the card — lets pointer events through */
.craft-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 9rem;
  pointer-events: auto;
  overflow: visible;
}

/* Split button preview clips to prevent width stretch */
.craft-preview-clip {
  overflow: hidden;
}

/* ── Scoped split-button styles ── */
.sb-container {
  display: inline-flex;
  align-items: center;
  overflow: visible;
  padding: 6px 0;
  /* no width transition — width is always auto, the pills animate in/out */
}

.sb-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.35rem;
  background: var(--border);
  border: none;
  border-radius: 9999px;
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  flex-shrink: 0;
  margin: 0 0.35rem;
  will-change: transform, opacity, filter;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-font-smoothing: antialiased;
}

.sb-pill:hover {
  transform: scale(1.13);
}

.sb-pill:active {
  transform: scale(0.95) !important;
  transition-duration: 0.08s;
}

.sb-pill.sb-animating {
  pointer-events: none;
}

/* icon + label spacing inside tag pills */
.sb-pill svg {
  flex-shrink: 0;
}

.sb-pill:not(.sb-back) {
  gap: 2px;
}

/* X close icon — rotates on hover */
.sb-close-icon {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sb-pill.sb-back:hover .sb-close-icon {
  transform: rotate(90deg);
}

.sb-pill.sb-back {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
}

.sb-pill.sb-back svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .sb-pill {
    padding: 0.5rem 0.9rem;
    font-size: 0.78rem;
    margin: 0 0.2rem;
  }

  .sb-pill:not(.sb-back) svg {
    width: 14px;
    height: 14px;
  }

  .sb-pill.sb-back {
    width: 2.1rem;
    height: 2.1rem;
  }

  .sb-pill.sb-back svg {
    width: 13px;
    height: 13px;
  }
}

/* ── Gooey craft cards ── */
.gooey-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 10.5rem;
  padding-top: 1.25rem;
  position: relative;
  overflow: visible;
}

/* tooltip card — trigger sits lower so popup has room above */
.gooey-preview-tooltip {
  align-items: flex-end;
  padding-top: 0;
  padding-bottom: 1.75rem;
}

/* tooltip card — trigger in top when direction is bottom */
.gooey-preview-tooltip.tt-dir-bottom {
  align-items: flex-start;
  padding-bottom: 0;
  padding-top: 1.25rem;
}

.lq-trigger-outer {
  position: relative;
  display: inline-flex;
  z-index: 10000;
}

.lq-trigger {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 10000;
  background: var(--gooey-surface);
  border: none;
  color: var(--body);
  transition: color 0.1s, transform 0.1s;
  -webkit-font-smoothing: antialiased;
}

.lq-trigger:hover {
  color: var(--body);
}

.lq-trigger:focus,
.lq-trigger:focus-visible {
  outline: none;
}

.lq-trigger:active {
  transform: scale(0.97);
}

.lq-content {
  z-index: 10000;
  min-width: 180px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  transform-origin: top right;
  overflow: hidden;
  mask: url(#gooeyMask);
  -webkit-mask: url(#gooeyMask);
}

.lq-tooltip-content {
  z-index: 10000;
  position: fixed;
  overflow: hidden;
  min-width: 160px;
  mask: url(#gooeyMaskTooltip);
  -webkit-mask: url(#gooeyMaskTooltip);
}

.lq-item-list {
  background: var(--gooey-surface);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lq-menu-group {
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 1px;
}

.lq-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  background: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  width: 100%;
  white-space: nowrap;
  transition: background 0.1s;
  -webkit-font-smoothing: antialiased;
}

.lq-menu-item:hover {
  background: var(--border);
}

.lq-menu-item:focus {
  outline: none;
}

.lq-menu-item svg {
  flex-shrink: 0;
  color: var(--body);
}

.lq-separator {
  height: 1px;
  background: var(--border);
  margin: 2px 8px;
}

.lq-tooltip-body {
  padding: 13px 16px;
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 450;
  line-height: 1.55;
  color: var(--body);
  max-width: 200px;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

.lq-tooltip-body strong {
  font-weight: 600;
  color: var(--heading);
}

/* tooltip arrow — default points up (▲) for tooltip-above-trigger */
.lq-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--gooey-surface);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  transform: translateX(-50%);
}

.lq-arrow.lq-arrow-visible {
  opacity: 1;
}

/* when tooltip opens below trigger, arrow points up from panel */
.lq-arrow.lq-arrow-down {
  border-top: none;
  border-bottom: 8px solid var(--gooey-surface);
}

/* magnification config */
.craft-magnify-config {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--border);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 500;
  color: var(--body-muted);
  transition: background var(--duration-smooth) var(--ease-smooth);
}

.mag-label {
  color: var(--body-muted);
  font-weight: 450;
}

.mag-value {
  color: var(--heading);
  font-weight: 600;
  min-width: 28px;
  text-align: center;
}

.mag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity var(--duration-smooth) var(--ease-smooth);
}

.mag-btn:active {
  transform: scale(0.85);
}

.mag-dec {
  background: var(--border);
  color: var(--body-muted);
}

.mag-dec:hover {
  opacity: 0.7;
}

.mag-inc {
  background: var(--gooey-surface);
  color: var(--body);
}

.mag-inc:hover {
  opacity: 0.7;
}

@media (max-width:600px) {
  .craft-magnify-config {
    padding: 3px 6px;
    gap: 4px;
    font-size: 10px;
  }

  .mag-btn {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }

  .mag-value {
    min-width: 24px;
  }
}

/* side-toggle button */
.craft-side-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 500;
  color: var(--body-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color var(--duration-smooth) var(--ease-smooth),
    background var(--duration-smooth) var(--ease-smooth);
}

.craft-side-toggle:hover {
  color: var(--heading);
  background: var(--border);
}

.craft-side-toggle svg {
  width: 10px;
  height: 10px;
}

/* ── Pill menubar slider ── */
.pms-nav {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.37rem;
  background: var(--border);
  border-radius: 9999px;
  padding: 4px;
  overflow: hidden;
  /* keeps the sliding shade fully contained inside the pill, never spilling past its edge */
}

/* the sliding "active" shade — third tone, sits above the rest bg,
   below the hover shade & labels — smooth, no-overshoot glide so it
   never balloons past the target button while animating */
.pms-slider {
  position: absolute;
  top: 4px;
  left: 0;
  z-index: 1;
  height: calc(100% - 8px);
  width: 0;
  background: var(--card-bg);
  border-radius: 9999px;
  transform: translateX(4px);
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, width;
  pointer-events: none;
}

/* sized to match .sb-pill, with a touch of extra width to give the
   subtle hover bounce room to breathe */
.pms-item {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.6rem 1.5rem;
  background: none;
  border: none;
  border-radius: 9999px;
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--body-muted);
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  -webkit-font-smoothing: antialiased;
  transition: color 0.2s var(--ease-smooth),
    background-color 0.2s var(--ease-smooth),
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pms-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* second tone — hover shade, only for non-active items.
   Use a semi-transparent tint so it works on both light (transparent nav bg)
   and dark themes without the solid card color looking jarring. */
.pms-item:hover:not(.active) {
  color: var(--heading);
  background: rgba(128, 128, 128, 0.13);
}

/* first tone (rest) is the .pms-nav background itself; this is the
   text-only resting state of each item */
.pms-item.active {
  color: var(--heading);
  font-weight: 600;
}

.pms-item:active {
  transform: scale(0.95) !important;
  transition-duration: 0.08s;
}

/* tighten up progressively to match .craft-section's own breakpoints,
   so the 3-item nav never outgrows its narrower mobile container */
@media (max-width: 768px) {
  .pms-nav {
    gap: 0.3rem;
  }

  .pms-item {
    padding: 0.55rem 1.1rem;
    font-size: 0.82rem;
  }

  .pms-item svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 600px) {
  .pms-nav {
    gap: 0.22rem;
  }

  .pms-item {
    padding: 0.48rem 0.75rem;
    font-size: 0.74rem;
  }

  .pms-item svg {
    width: 13px;
    height: 13px;
  }
}

@media (max-width: 480px) {
  .pms-nav {
    gap: 0.18rem;
  }

  .pms-item {
    padding: 0.42rem 0.62rem;
    font-size: 0.7rem;
  }

  .pms-item svg {
    width: 12px;
    height: 12px;
  }
}

@keyframes lqEnter {
  0% {
    opacity: 0;
    filter: blur(4px);
    transform: scale(0.96);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes lqExit {
  0% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }

  100% {
    opacity: 0;
    filter: blur(4px);
    transform: scale(0.96);
  }
}

.lq-enter {
  animation: lqEnter 0.12s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.lq-exit {
  animation: lqExit 0.1s cubic-bezier(0.19, 1, 0.22, 1) both;
}

/* ── Copy-to-clipboard button ── */
.cpy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.35rem;
  background: var(--border);
  border: none;
  border-radius: 9999px;
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  -webkit-font-smoothing: antialiased;
  transition: background var(--duration-smooth) var(--ease-smooth),
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cpy-btn:hover {
  transform: scale(1.05);
}

.cpy-btn:active {
  transform: scale(0.95) !important;
  transition-duration: 0.08s;
}

.cpy-btn.copied {
  color: var(--heading);
}

.cpy-icon-wrap {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cpy-icon {
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  transition: opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cpy-icon-check {
  opacity: 0;
  transform: scale(0.4) rotate(-60deg);
  filter: blur(3px);
  color: var(--heading);
}

.cpy-icon-copy {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: blur(0px);
}

.cpy-btn.copied .cpy-icon-check {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: blur(0px);
}

.cpy-btn.copied .cpy-icon-copy {
  opacity: 0;
  transform: scale(0.4) rotate(60deg);
  filter: blur(3px);
}

/* label text fade-swap */
.cpy-label {
  position: relative;
  display: inline-block;
  transition: opacity 0.18s var(--ease-smooth), transform 0.18s var(--ease-smooth);
}

.cpy-btn.cpy-label-exit .cpy-label {
  opacity: 0;
  transform: translateY(-5px);
}

.cpy-btn.cpy-label-enter .cpy-label {
  opacity: 0;
  transform: translateY(5px);
}

@media (max-width: 768px) {
  .cpy-btn {
    padding: 0.55rem 1.1rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 600px) {
  .cpy-btn {
    padding: 0.5rem 0.95rem;
    font-size: 0.78rem;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .cpy-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.78rem;
  }
}

/* ── macOS-style Dock magnification row ──
   Follows the real Dock's look: a slim shelf tray with icons sized
   much larger than the tray itself, no per-icon background box, and
   neighbours shift apart (via JS margin) so magnified icons never
   overlap. */
.dock-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--border);
  border-radius: 16px;
}

.dock-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, margin;
}

.dock-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 22%;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  transition: filter 0.1s var(--ease-smooth);
}

.dock-item:active img {
  filter: brightness(0.85);
}

/* ── Dock hover tooltip — macOS pill style ── */
.dock-tooltip {
  position: fixed;
  z-index: 10050;
  background: var(--gooey-surface);
  color: var(--heading);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 5px 13px;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) scale(0.85);
  transition: opacity 0.15s var(--ease-smooth), transform 0.15s var(--ease-smooth);
  -webkit-font-smoothing: antialiased;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.dock-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--gooey-surface);
  transform: translateX(-50%);
}

.dock-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

/* ── Extra top padding on mobile so dock clears the magnification
   config button — tooltip won't collide with it ── */
.craft-preview-dock {
  padding-top: 2.5rem;
}

@media (max-width: 600px) {
  .craft-preview-dock {
    padding-top: 3rem;
  }
}

@media (max-width: 768px) {
  .dock-row {
    gap: 8px;
    padding: 7px 14px;
    border-radius: 15px;
  }

  .dock-item {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 600px) {
  .dock-row {
    gap: 6px;
    padding: 6px 12px;
    border-radius: 14px;
  }

  .dock-item {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .dock-row {
    gap: 5px;
    padding: 6px 10px;
    border-radius: 13px;
  }

  .dock-item {
    width: 38px;
    height: 38px;
  }
}

/* ── Stepper / counter ── */
.stp-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--border);
  border-radius: 9999px;
  padding: 4px;
}

.stp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  background: var(--card-bg);
  border: none;
  border-radius: 9999px;
  color: var(--body);
  cursor: pointer;
  outline: none;
  transition: background var(--duration-smooth) var(--ease-smooth),
    color var(--duration-smooth) var(--ease-smooth),
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stp-btn:hover {
  background: var(--card-hover-bg);
  color: var(--heading);
}

.stp-btn:active {
  transform: scale(0.9) !important;
  transition-duration: 0.08s;
}

.stp-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.stp-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.stp-value-wrap {
  position: relative;
  width: 3rem;
  height: 2.2rem;
  overflow: hidden;
}

.stp-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 768px) {
  .stp-btn {
    width: 2.1rem;
    height: 2.1rem;
  }

  .stp-value-wrap {
    width: 2.8rem;
    height: 2.1rem;
  }

  .stp-value {
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .stp-btn {
    width: 2rem;
    height: 2rem;
  }

  .stp-btn svg {
    width: 13px;
    height: 13px;
  }

  .stp-value-wrap {
    width: 2.6rem;
    height: 2rem;
  }

  .stp-value {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .stp-btn {
    width: 1.85rem;
    height: 1.85rem;
  }

  .stp-btn svg {
    width: 12px;
    height: 12px;
  }

  .stp-value-wrap {
    width: 2.4rem;
    height: 1.85rem;
  }

  .stp-value {
    font-size: 0.85rem;
  }
}