/* ------------------------------------------------------------------
   5KEPINDOU homepage replica – custom layer
   Loaded after the compiled utility stylesheet.
------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

/* Right-aligned account dropdown */
#header-auth-user details > div {
  right: 0;
  left: auto;
}

/* Daily quota modal */
#quota-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}
#quota-modal .quota-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}
#quota-modal .quota-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 26rem);
  transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Sticky header offset for in-page anchors */
[id] {
  scroll-margin-top: 5.25rem;
}

/* Keep the native disclosure triangle out of the custom FAQ / nav markers */
summary::-webkit-details-marker {
  display: none;
}
summary::marker {
  content: "";
}

/* Lock the page while the mobile drawer is open */
body.nav-open {
  overflow: hidden;
}

/* Pegboard preset buttons */
.board-btn.is-active {
  border-color: #c4b4ff;
  background-color: #f5f3ff;
  color: #7008e7;
  box-shadow: inset 0 0 0 1px #ddd6ff;
}
.board-btn.is-active:hover {
  border-color: #a685ff;
}

/* The original 1fr chain cannot shrink below ~328px without pushing the page
   sideways; only balance the tracks on those ultra-narrow viewports. */
@media (max-width: 327px) {
  .flow-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.2fr);
  }
}

/* Upload dropzone */
#dropzone {
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
#dropzone.is-dragover {
  border-color: #8d54ff;
  background-color: #f5f3ff;
}
#dropzone.has-file {
  border-color: #c4b4ff;
  background-color: #faf5ff;
}
#dropzone:focus-within {
  border-color: #a685ff;
}

/* Hero preview cross-fade while a pattern is being generated */
#hero-preview {
  transition: opacity 0.25s ease;
}
#hero-preview.is-loading {
  opacity: 0.5;
}

/* Generated stats row */
#color-stats li span:last-child {
  font-variant-numeric: tabular-nums;
}

/* Toast */
.site-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(92vw, 30rem);
  transform: translate(-50%, 0.75rem);
  border-radius: 0.9rem;
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.site-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 767px) {
  .site-toast {
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
  }
}

/* Busy state for the generate button */
#generate-btn[data-busy="true"] {
  cursor: progress;
  opacity: 0.8;
}

/* Print: keep the artwork and drop the chrome */
@media print {
  header,
  footer,
  nav[aria-label="分区"],
  #toast,
  #sample-btn,
  #studio-form {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .home-bg {
    background: #fff;
  }
}
