/* assets/front/front.css
 * ATHCM — wheel-centric (NEW)
 * - No “Selected Palette” panel
 * - Color Rule is an overlay INSIDE the wheel card (top-left)
 * - Kuler sliders/swatches render in the SAME wheel card, docked bottom-right
 *   (NO JS moving theme nodes; we style the populated theme where Kuler renders it)
 * - Results remain grouped cards
 *
 * IMPORTANT:
 * - Do NOT hide .colorwheel-theme globally. Kuler renders TWO nodes:
 *   1) an empty clone: <div class="colorwheel-theme"></div>
 *   2) a populated theme: <div class="colorwheel-theme">...swatches...</div>
 *   We hide ONLY the empty one via :empty.
 */

.athcm{
  --athcm-bg: #0b0f17;
  --athcm-surface: rgba(255,255,255,0.06);
  --athcm-border: rgba(255,255,255,0.12);
  --athcm-border-2: rgba(255,255,255,0.18);
  --athcm-text: rgba(255,255,255,0.92);
  --athcm-text-dim: rgba(255,255,255,0.70);
  --athcm-text-faint: rgba(255,255,255,0.55);
  --athcm-shadow: 0 14px 40px rgba(0,0,0,0.45);
  --athcm-shadow-soft: 0 10px 24px rgba(0,0,0,0.35);
  --athcm-radius: 14px;
  --athcm-focus: 0 0 0 3px rgba(255,255,255,0.10);

  --athcm-gap: 14px;
  --athcm-pad: 14px;

  /* Wheel sizing */
  --athcm-wheel-size: 600px;

  /* Rule overlay sizing */
  --athcm-rule-w: 250px;

  /* Dock sizing (for theme UI) */
  --athcm-dock-w: min(520px, 100%);

  /* Reserve space at the bottom INSIDE wheel card for the theme dock */
  --athcm-dock-reserve: 240px;

  color: var(--athcm-text);
}

.athcm *{ box-sizing: border-box; }
.athcm a{ color: inherit; text-decoration: none; }
.athcm-defs{ position:absolute; width:0; height:0; overflow:hidden; }

/* =============================================================================
   Layout: Wheel | Results
============================================================================= */
.athcm{
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(360px, 520px);
  gap: var(--athcm-gap);
  align-items: start;
}

@media (max-width: 1100px){
  .athcm{
    --athcm-wheel-size: 520px;
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Wheel Card
============================================================================= */
.athcm-wheel-wrap{
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 30% 20%, rgba(255,255,255,0.10), transparent 55%),
    radial-gradient(800px 500px at 80% 60%, rgba(255,255,255,0.06), transparent 50%),
    var(--athcm-bg);
  border: 1px solid var(--athcm-border);
  padding: 0px;
  box-shadow: var(--athcm-shadow);

  /* room for wheel stage + dock reserve + padding */
  min-height: calc(var(--athcm-wheel-size) + var(--athcm-dock-reserve) + (var(--athcm-pad) * 2));
}

.athcm-wheel{
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* =============================================================================
   KULER STAGE FIX (LOCKED-IN)
   - Make [data-athcm-wheel] a real "stage" container
   - Give it height so gradient can fill it
   - Center the wheel SVG in the stage
============================================================================= */
.athcm [data-athcm-wheel]{
  position: relative;
  width: 100%;
  /* stage includes dock reserve so wrap doesn't feel like it has "dead space" */
  min-height: calc(var(--athcm-wheel-size) + var(--athcm-dock-reserve));
  display: grid;
  place-items: center;
  overflow: visible;
}

/* Force wheel size (Kuler mounts SVG directly under [data-athcm-wheel]) */
.athcm [data-athcm-wheel] > svg.colorwheel{
  width: var(--athcm-wheel-size) !important;
  height: var(--athcm-wheel-size) !important;
  max-width: 100% !important;
  display: block !important;
  margin: 0 auto !important;

  position: relative;
  z-index: 5;
}

/* Blur gradient overlay — make it a true fill-layer behind the wheel */
.athcm [data-athcm-wheel] > .colorwheel-gradient{
  position: absolute;
  inset: 0;                 /* <— fills the whole stage */
  z-index: 1;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;

  filter: url(#athcm-blur);
  -webkit-filter: url(#athcm-blur);
  opacity: 0.85;
}

/* Keep Kuler mode toggle (if you ever enable it) unobtrusive */
.athcm [data-athcm-wheel] > .colorwheel-mode-toggle{
  display: block;
  margin: 12px auto 0 auto;
  border-radius: 12px;
  border: 1px solid var(--athcm-border);
  background: rgba(0,0,0,0.20);
  color: var(--athcm-text);
  padding: 8px 10px;
  outline: none;
  width: min(320px, 100%);
  position: relative;
  z-index: 6;
}

/* =============================================================================
   Color Rule overlay (top-left inside wheel card)
   - wrapper pointer-events:none so wheel drag passes through
   - panel contents pointer-events:auto so rules clickable
============================================================================= */
.athcm-rule-box--inwheel{
  position: absolute;
  z-index: 60;
  top: var(--athcm-pad);
  left: var(--athcm-pad);

  width: var(--athcm-rule-w);
  max-width: calc(100% - (var(--athcm-pad) * 2));

  pointer-events: none;
}
.athcm-rule-box--inwheel > *{ pointer-events: auto; }

.athcm-rule-box{
  border: 1px solid var(--athcm-border);
  border-radius: var(--athcm-radius);
  padding: 10px;
  background: rgba(255,255,255,0.06);
  box-shadow: var(--athcm-shadow-soft);
  backdrop-filter: blur(10px);
}

.athcm-rule-box h4{
  margin: 0 0 10px 0;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  color: var(--athcm-text);
}

.athcm-rules{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.athcm-rules li{
  border: 1px solid var(--athcm-border);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  background: rgba(0,0,0,0.18);
  color: var(--athcm-text);
  transition: transform .08s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.athcm-rules li:hover{
  border-color: var(--athcm-border-2);
  background: rgba(255,255,255,0.06);
}

.athcm-rules li:active{ transform: translateY(1px); }

.athcm-rules li.active{
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.22);
}

/* =============================================================================
   Palette Dock (bottom-right inside wheel card)
   - We do NOT move Kuler nodes.
   - Hide ONLY the empty clone via :empty
   - Dock the populated theme bottom-right
============================================================================= */

/* Keep the dock container for layout/ARIA, but it doesn't host theme */
.athcm-palette-dock{
  position: absolute;
  z-index: 40;
  right: var(--athcm-pad);
  bottom: var(--athcm-pad);
  left: auto;
  transform: none;

  width: min(360px, 92%);
  max-width: 92%;
  margin: 0;

  pointer-events: none;
}
.athcm-palette-dock > *{ pointer-events: auto; }

/* Hide only the empty clone theme */
.athcm [data-athcm-wheel] > .colorwheel-theme:empty{
  display: none !important;
}

/* Populated theme: dock bottom-right */
.athcm [data-athcm-wheel] > .colorwheel-theme:not(:empty){
  position: absolute;
  right: var(--athcm-pad);
  bottom: var(--athcm-pad);
  left: auto;
  transform: none;

  width: min(360px, 92%);
  max-width: 92%;
  margin: 0;

  display: grid;
  gap: 6px;

  z-index: 10; /* above gradient, below rule overlay */
  pointer-events: none;
}
.athcm [data-athcm-wheel] > .colorwheel-theme:not(:empty) *{
  pointer-events: auto;
}

/* More compact swatch row styling */
.athcm [data-athcm-wheel] > .colorwheel-theme:not(:empty) .colorwheel-theme-swatch{
  display: grid;
  grid-template-columns: 24px 1fr 60px;
  gap: 6px;
  align-items: center;

  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--athcm-border);
  background: rgba(0,0,0,0.28);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

/* Color chip */
.athcm [data-athcm-wheel] > .colorwheel-theme:not(:empty) .colorwheel-theme-color{
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}

/* Slider */
.athcm input.colorwheel-theme-slider[type="range"]{
  width: 100%;
  height: 18px;
  accent-color: #ffffff;
}

/* Value box */
.athcm input.colorwheel-theme-value{
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1;
  border-radius: 8px;

  border: 1px solid var(--athcm-border);
  background: rgba(0,0,0,0.35);
  color: var(--athcm-text);
  outline: none;

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.athcm input.colorwheel-theme-value:focus{
  border-color: rgba(255,255,255,0.26);
  box-shadow: var(--athcm-focus);
}

/* Hide Kuler mode dropdown (we use our own rule UI) */
.athcm .colorwheel-mode-toggle{
  display: none !important;
}

/* =============================================================================
   Results column
============================================================================= */
.athcm-right{ min-width: 0; }

.athcm-results{
  display: grid;
  gap: 10px;
}

.athcm-results p{
  margin: 0;
  padding: 12px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  color: var(--athcm-text-dim);
}

.athcm-groupwrap{
  border: 1px solid var(--athcm-border);
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;

  background:
    radial-gradient(120% 140% at 0% 0%,
      color-mix(in srgb, var(--athcm-group-hex, #ffffff) 18%, transparent),
      transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);

  display: grid;
  gap: 10px;
}

.athcm-item{
  border: 1px solid var(--athcm-border);
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 10px 22px rgba(0,0,0,0.30);
  padding: 10px;

  display: grid;
  grid-template-columns: 52px 52px 1fr;
  gap: 10px;
  align-items: center;

  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}

.athcm-item:hover{
  border-color: var(--athcm-border-2);
  background: rgba(255,255,255,0.08);
}

.athcm-item:active{ transform: translateY(1px); }

.athcm-swatches{
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: 52px;
}

.athcm-swatch{
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.20) inset, 0 8px 14px rgba(0,0,0,0.25);
}

.athcm-swatch--palette{
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}

.athcm-thumb{
  width: 52px;
  height: 52px;
  display: block;
  flex-shrink: 0;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.10);
}

.athcm-info{
  min-width: 0;
  display: grid;
  gap: 4px;
}

.athcm-title{
  font-weight: 650;
  font-size: 13px;
  line-height: 1.25;
  margin: 0;
  color: var(--athcm-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.athcm-meta{
  font-size: 12px;
  color: var(--athcm-text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
