/* Floating Customize panel (themes.shared.customizer). Styled on its own so it
   looks the same over every theme; only loaded in demo mode and for admins. */
.cz {
  --cz-ink: #15140f;
  --cz-muted: #6b6960;
  --cz-line: rgba(21, 20, 15, .12);
  --cz-surface: #fff;
  position: fixed;
  inset-block-end: 20px;
  inset-inline-start: 20px;
  z-index: 1040;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  color: var(--cz-ink);
}

/* Laravel Debugbar (local/dev only) docks a full-width strip at the bottom with a huge z-index and
   covered the lower half of the button, so clicks there never reached it. Sit above it instead. */
body:has(.phpdebugbar) .cz {
  inset-block-end: 52px;
}

.dark-mode .cz {
  --cz-ink: #f4f1e8;
  --cz-muted: #a8a59a;
  --cz-line: rgba(244, 241, 232, .16);
  --cz-surface: #1c1b16;
}

.cz span,
.cz strong,
.cz small,
.cz p {
  color: inherit;
}

.cz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--cz-ink);
  color: var(--cz-surface);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  user-select: none;
}

.cz-toggle span {
  color: var(--cz-surface);
}

.cz-toggle::-webkit-details-marker {
  display: none;
}

.cz :focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.cz-panel {
  position: absolute;
  inset-block-end: calc(100% + 10px);
  inset-inline-start: 0;
  width: 310px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 14px 12px 12px;
  border: 1px solid var(--cz-line);
  border-radius: 16px;
  background: var(--cz-surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  overscroll-behavior: contain;
}

.cz-group {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.cz-title {
  float: none;
  width: auto;
  margin: 2px 4px 8px;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cz-muted);
}

.cz-themes {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cz-theme {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px;
  border-radius: 10px;
  color: var(--cz-ink);
  text-decoration: none;
}

.cz-theme:hover {
  background: var(--cz-line);
  color: var(--cz-ink);
}

.cz-theme.is-active {
  box-shadow: inset 0 0 0 2px var(--cz-ink);
}

.cz-theme img {
  flex: none;
  width: 56px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  object-position: top;
  background: var(--cz-line);
}

.cz-theme strong,
.cz-theme small {
  display: block;
}

.cz-theme small {
  color: var(--cz-muted);
  font-size: 12px;
}

.cz-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cz-seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--cz-line);
}

.cz-seg label,
.cz-fonts label,
.cz-swatch {
  margin: 0;
  font-weight: inherit !important;
}

.cz-seg label {
  flex: 1;
}

.cz-seg input,
.cz-fonts input,
.cz-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cz-seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 4px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.cz-seg input:checked + span {
  background: var(--cz-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}

.cz-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
}

.cz-swatch > span {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  cursor: pointer;
}

.cz-swatch > span.is-default {
  background: conic-gradient(var(--site-accent, #358f80) 0 50%, var(--cz-surface) 50% 100%);
  box-shadow: inset 0 0 0 2px var(--site-accent, #358f80);
}

.cz-swatch input:checked + span {
  outline: 2px solid var(--cz-ink);
  outline-offset: 2px;
}

.cz-fonts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cz-fonts span {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--cz-line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.cz-fonts input:checked + span {
  border-color: var(--cz-ink);
  box-shadow: inset 0 0 0 1px var(--cz-ink);
}

:is(.cz-seg, .cz-fonts, .cz-swatch) input:focus-visible + span {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.cz-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--cz-line);
  text-align: center;
}

.cz-apply {
  display: grid;
  gap: 6px;
  margin: 0;
}

.cz-primary {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--cz-ink);
  color: var(--cz-surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cz-link {
  padding: 6px;
  border: 0;
  background: none;
  color: var(--cz-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.cz-note {
  margin: 0;
  color: var(--cz-muted) !important;
  font-size: 12px;
}

.cz-error {
  margin: 0 0 8px;
  color: #b91c1c !important;
  font-size: 13px;
}

@media (max-width: 575.98px) {
  .cz {
    inset-block-end: 12px;
    inset-inline-start: 12px;
  }

  .cz-toggle {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .cz-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cz-panel {
    animation: cz-in .16s ease-out;
  }

  @keyframes cz-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}
