/**
 * Palette Lab — Palettes Tab Styles
 * Agent B: css/explore.css
 *
 * Implements the polished mycolor.space aesthetic per DESIGN.md:
 * - Montserrat typography throughout
 * - Pure white #fff results area with generous whitespace
 * - Collapsible minimal fine-tune sliders (no boxes)
 * - Dual filter rows: Family filters + quieter Mood filters
 * - Subtle grey count line ("64 PALETTES" / "12 PALETTES")
 * - Pure color square swatches (~112px desktop, 4px radius, 5px gap), hex code under each
 * - No cards, borders, badges, emoji, or descriptions in palettes
 * - Mobile (<640px): swatches stack as wide bars (~65% width x 72px) with hex to the right
 * - Per-seed SHADES rows (50-950) with step and hex
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

/* ==========================================================================
   Root View & Full-Bleed Reset
   ========================================================================== */

.app-main:has(.explore-view) {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.explore-view {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background-color: #ffffff;
  color: #1b1b1b;
  width: 100%;
  margin: 0 auto;
  padding: 0 0 100px 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. FINE-TUNE Collapsible Sliders
   ========================================================================== */

.fine-tune-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 0 20px;
  box-sizing: border-box;
  text-align: center;
}

.fine-tune-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #888888;
  padding: 12px 24px;
  transition: color 0.15s ease;
  display: inline-block;
  user-select: none;
}

.fine-tune-toggle:hover {
  color: #1b1b1b;
}

.fine-tune-panel {
  max-width: 820px;
  margin: 16px auto 32px auto;
  padding: 0 16px;
  box-sizing: border-box;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.fine-tune-sliders-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  align-items: center;
  margin-bottom: 20px;
}

.fine-tune-slider-group {
  display: flex;
  flex-direction: column;
}

.fine-tune-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.fine-tune-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #555555;
}

.fine-tune-value {
  font-size: 12px;
  font-weight: 600;
  color: #1b1b1b;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.fine-tune-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: #dddddd;
  border-radius: 1px;
  outline: none;
  margin: 10px 0;
  cursor: pointer;
}

.fine-tune-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #00c9a7;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 201, 167, 0.4);
  transition: transform 0.1s ease;
}

.fine-tune-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #00c9a7;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 201, 167, 0.4);
  transition: transform 0.1s ease;
}

.fine-tune-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.fine-tune-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.fine-tune-reset {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #888888;
  padding: 6px 12px;
  transition: color 0.15s ease;
}

.fine-tune-reset:hover {
  color: #00c9a7;
}

/* ==========================================================================
   2. Palettes Section (#palettes)
   ========================================================================== */

.explore-palettes-section {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 0 20px;
  box-sizing: border-box;
}

/* 1st Row: Family Filter Text Links (centered, active underlined in teal) */
.palettes-filter-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

@media (max-width: 640px) {
  .palettes-filter-nav {
    gap: 14px;
    margin-bottom: 12px;
  }
}

.palettes-filter-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #888888;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.palettes-filter-link:hover {
  color: #1b1b1b;
}

.palettes-filter-link.is-active {
  color: #1b1b1b;
  border-bottom-color: #00c9a7;
  font-weight: 700;
}

/* 2nd Row: Quieter Mood Filter Text Links */
.palettes-mood-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .palettes-mood-nav {
    gap: 12px;
    margin-bottom: 14px;
  }
}

.palettes-mood-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #999999;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.palettes-mood-link:hover {
  color: #1b1b1b;
}

.palettes-mood-link.is-active {
  color: #1b1b1b;
  border-bottom-color: #00c9a7;
  font-weight: 700;
}

/* Palette set controls: refresh the deterministic 20-palette set without
   changing the quiet filter-link language above. */
.palettes-set-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.palettes-set-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.palettes-set-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.palettes-set-button-primary {
  background: #00c9a7;
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(0, 201, 167, 0.2);
}

.palettes-set-button-primary:hover:not(:disabled) {
  background: #00b99a;
}

.palettes-set-button-ghost {
  background: #ffffff;
  border-color: #d8d8d8;
  color: #555555;
}

.palettes-set-button-ghost:hover:not(:disabled) {
  border-color: #00c9a7;
  color: #00a383;
}

.palettes-set-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.palettes-set-indicator {
  color: #999999;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Grey Count Line ("64 PALETTES" / "12 PALETTES") */
.palettes-count-line {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #888888;
  text-align: center;
  margin: 6px 0 36px 0;
}

.palettes-empty-msg {
  font-size: 13px;
  font-weight: 500;
  color: #888888;
  text-align: center;
  padding: 48px 20px;
  letter-spacing: 0.05em;
}

/* Palettes list & entries */
.palettes-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.explore-palette-entry {
  padding: 0;
  text-align: center;
  box-sizing: border-box;
}

.palette-set-enter {
  animation: paletteSetIn 180ms ease-out both;
  animation-delay: var(--palette-enter-delay, 0ms);
}

@keyframes paletteSetIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.explore-palette-title,
.explore-section-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: #1b1b1b;
  margin: 0 0 24px 0;
  letter-spacing: -0.01em;
  text-align: center;
}

/* Hairline dividers between palettes (max-width 920px, centered) */
.explore-hairline {
  width: 100%;
  max-width: 920px;
  height: 1px;
  background-color: #eeeeee;
  margin: 44px auto 44px auto;
}

.palettes-bottom-controls {
  display: flex;
  justify-content: center;
  padding: 4px 0 50px;
}

/* ==========================================================================
   3. Swatches & Swatch Rows
   ========================================================================== */

.explore-swatches-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

/* ==========================================================================
   4. Shades Section (#shades)
   ========================================================================== */

.explore-shades-section {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 80px 20px;
  box-sizing: border-box;
}

.shades-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.explore-shade-entry {
  padding: 0;
  text-align: center;
  box-sizing: border-box;
}

.explore-shades-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

/* ==========================================================================
   5. Mobile Responsiveness (< 640px)
   ========================================================================== */

@media (max-width: 640px) {
  .palettes-set-controls {
    gap: 8px;
  }

  .palettes-set-button {
    min-height: 44px;
    padding: 0 14px;
    font-size: 10px;
    letter-spacing: 0.11em;
  }

  .palettes-set-indicator {
    flex-basis: 100%;
    text-align: center;
  }

  .explore-palette-entry,
  .explore-shade-entry {
    padding: 0;
  }

  /* Titles left-aligned with the bars */
  .explore-palette-title,
  .explore-section-title {
    text-align: left;
    width: 100%;
    max-width: 340px;
    margin: 0 auto 16px auto;
    font-size: 19px;
  }

  /* Palette swatches stack vertically as wide bars (~65% width x 72px) with hex to the right */
  .explore-swatches-row {
    flex-direction: column;
    align-items: flex-start;
    max-width: 340px;
    margin: 0 auto;
    gap: 5px;
  }

  /* Shades swatches stack vertically as clean bars on phone, hex never truncated */
  .explore-shades-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 340px;
    margin: 0 auto;
    gap: 5px;
    width: 100%;
  }

  .explore-shades-row .swatch-unit {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    margin-bottom: 3px;
  }

  .explore-shades-row .swatch-color {
    width: 65% !important;
    height: 48px !important;
    border-radius: var(--radius-swatch);
  }

  .explore-shades-row .swatch-meta {
    flex: 1;
    margin-top: 0;
    padding-left: 14px;
    align-items: flex-start;
    text-align: left;
  }

  .explore-shades-row .swatch-label-top {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
  }

  .explore-shades-row .swatch-hex {
    font-size: 13px;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .explore-hairline {
    margin: 32px auto 32px auto;
  }

  .palettes-bottom-controls {
    padding-bottom: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .palette-set-enter {
    animation: none;
  }
}
