/* ==========================================================================
   MIRA HAIR STUDIO — страницы окрашивания
   /okrashivanie-volos-kirov/ и /slozhnoe-okrashivanie-kirov/
   Базовые компоненты hc-* — в cascade.css. Здесь только «веер прядей».
   Палитра только obsidian / gold / cream (токены styles.css).
   ========================================================================== */

/* --- Веер прядей: палитра колориста из реальных работ мастера --- */
.cl-swatch {
  --strand-w: 15%;
  --pivot: 1.1rem;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
}

.cl-swatch-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--cream-muted);
}

.cl-swatch-fan {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  aspect-ratio: 1 / 1.02;
}

/* Кольцо, на котором держатся пряди */
.cl-swatch-fan::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: calc(var(--pivot) - 9px);
  left: calc(50% - 9px);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  background: var(--obsidian);
  box-shadow: 0 0 0 4px rgba(15, 12, 10, 0.6);
  pointer-events: none;
}

.cl-strand {
  --x: 50%;
  --y: -30%;
  position: absolute;
  top: 0;
  left: calc(50% - var(--strand-w) / 2);
  width: var(--strand-w);
  height: 92%;
  transform-origin: 50% var(--pivot);
  rotate: calc((3 - var(--i, 3)) * 8.5deg);
  transition: translate 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Оттенки по порядку: от тёмного к светлому; --x/--y — кадр длины волос */
.cl-strand:nth-child(1) { --i: 0; --x: 45%; --y: -33%; }
.cl-strand:nth-child(2) { --i: 1; --x: 55%; --y: -25%; }
.cl-strand:nth-child(3) { --i: 2; --x: 64%; --y: -26%; --h: 220%; }
.cl-strand:nth-child(4) { --i: 3; --x: 40%; --y: -44%; --h: 200%; }
.cl-strand:nth-child(5) { --i: 4; --x: 42%; --y: -28%; }
.cl-strand:nth-child(6) { --i: 5; --x: 45%; --y: -50%; --h: 200%; }
.cl-strand:nth-child(7) { --i: 6; --x: 66%; --y: -40%; }

.cl-strand figure {
  position: relative;
  height: 100%;
  margin: 0;
  transform-origin: 50% var(--pivot);
  overflow: hidden;
  background: var(--obsidian-surface);
  /* Кончики прядей: неровный срез */
  clip-path: polygon(0 0, 100% 0, 100% 90%, 80% 100%, 55% 95%, 30% 100%, 0 93%);
}

.cl-strand img {
  position: absolute;
  top: var(--y);
  left: 0;
  width: 100%;
  height: var(--h, 165%);
  object-fit: cover;
  object-position: var(--x) 50%;
  display: block;
  transition: opacity 0.35s ease;
}

/* Пластиковый язычок образца с отверстием под кольцо */
.cl-strand figure::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--pivot) * 2.2);
  background: var(--obsidian-elevated);
  border-bottom: 1px solid var(--gold-dark);
  transition: border-color 0.35s ease;
}

/* Затемнение снизу, чтобы подпись читалась на светлом блонде */
.cl-strand figure::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(to top, rgba(15, 12, 10, 0.78), rgba(15, 12, 10, 0));
  pointer-events: none;
}

.cl-strand figcaption {
  position: absolute;
  z-index: 2;
  bottom: 12%;
  left: 50%;
  translate: -50% 0;
  writing-mode: vertical-rl;
  rotate: 180deg;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1.6vw, 1rem);
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream-primary);
  text-shadow: 0 1px 6px rgba(15, 12, 10, 0.9);
}

/* Интерактив включается из coloring.js */
.cl-swatch.is-interactive .cl-strand {
  cursor: pointer;
}

.cl-swatch.is-interactive .cl-strand:focus-visible {
  outline: none;
}

.cl-swatch.is-interactive .cl-strand:focus-visible figure::before,
.cl-strand[aria-pressed="true"] figure::before {
  border-bottom: 2px solid var(--gold-bright);
}

.cl-swatch.is-interactive .cl-strand:focus-visible figcaption {
  text-decoration: underline;
  text-decoration-color: var(--gold-bright);
  text-underline-offset: 0.3em;
}

@media (hover: hover) {
  .cl-swatch.is-interactive .cl-strand:hover {
    translate: 0 -2%;
  }
}

.cl-strand[aria-pressed="true"] {
  z-index: 2;
  translate: 0 -5%;
}

/* Остальные пряди приглушаем через фото: сама прядь непрозрачна и не просвечивает */
.cl-swatch.has-pick .cl-strand:not([aria-pressed="true"]) img {
  opacity: 0.5;
}

/* Карточка выбранного оттенка */
.cl-swatch-card {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-gold-accent);
}

.cl-swatch-card[hidden] {
  display: none;
}

.cl-swatch-tone {
  margin: 0 0 0.35rem;
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold-bright);
}

.cl-swatch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--cream-secondary);
}

.cl-swatch-meta strong {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--cream-primary);
}

@media (max-width: 900px) {
  .cl-swatch {
    max-width: 380px;
    margin: 0.5rem auto 0;
  }
}

@media (max-width: 380px) {
  .cl-swatch {
    --strand-w: 16%;
  }
}

/* Таблица техник без ссылок в первой колонке */
.cl-techniques tbody th {
  white-space: normal;
}

/* Уменьшенное движение: веер стоит раскрытым, без подъёма прядей */
@media (prefers-reduced-motion: reduce) {
  .cl-strand,
  .cl-strand[aria-pressed="true"],
  .cl-swatch.is-interactive .cl-strand:hover {
    translate: none;
  }
}
