/* ── Фото: инструменты, холст, свойства и слои ─────────────────────────── */

.photo__body {
  grid-template-columns: auto minmax(0, 1fr) 296px;
}

.photo__rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
  width: 76px;
  max-height: 100%;
  padding: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}

/* Команд в верхней полосе много: кнопки меню стоят плотнее. */
.photo__bar .menu-anchor > .btn {
  padding: 0 8px;
}

/* Холст и строка состояния под ним. */
.photo__stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--slate-800);
}

.photo__canvas {
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.photo__canvas[data-tool='move'],
.photo__canvas[data-tool='transform'],
.photo__canvas[data-tool='crop'] {
  cursor: default;
}

.photo__canvas[data-tool='text'] {
  cursor: text;
}

.photo__canvas.has-brush {
  cursor: none;
}

.photo__canvas.is-panning {
  cursor: grab;
}

.photo__screen,
.photo__overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.photo__overlay {
  pointer-events: none;
}

/* Окружность кисти под указателем. */
.photo__cursor {
  --radius: 10px;

  position: absolute;
  top: calc(var(--radius) * -1);
  left: calc(var(--radius) * -1);
  width: calc(var(--radius) * 2);
  height: calc(var(--radius) * 2);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* «Бегущие муравьи»: чёрно-белый пунктир по границе выделения. */
.photo__ants path {
  fill: none;
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.photo__ants path + path {
  stroke: #000;
  stroke-dasharray: 5 5;
  animation: photo-ants 0.8s linear infinite;
}

.photo__ants.is-still path + path {
  animation: none;
}

@keyframes photo-ants {
  to {
    stroke-dashoffset: -10;
  }
}

/* Оси симметрии: тонкая направляющая через середину документа. */
.photo__axes line {
  stroke: var(--bronze);
  stroke-width: 1.5;
  stroke-dasharray: 8 6;
  vector-effect: non-scaling-stroke;
}

/* Накладка инструментов: рамки, ручки и черновики. */
.photo__frame {
  fill: none;
  stroke: var(--patina);
  stroke-width: 1;
}

.photo__draft {
  fill: rgba(92, 196, 174, 0.12);
  stroke: var(--patina);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

polyline.photo__draft {
  fill: none;
}

.photo__handle {
  fill: #fff;
  stroke: var(--patina-deep);
  stroke-width: 1.5;
}

.photo__guide {
  stroke: #fff;
  stroke-width: 1.5;
}

.photo__guide--shadow {
  stroke: rgba(0, 0, 0, 0.6);
  stroke-width: 3.5;
}

.photo__mark {
  stroke: #fff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 1px #000);
}

.photo__shade {
  fill: rgba(13, 15, 17, 0.6);
}

.photo__third {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
}

.photo__status {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 32px; /* постоянная: иначе холст менял бы размер, когда в строке появляются координаты */
  padding: 0 14px;
  border-top: 1px solid var(--slate-950);
  background: var(--slate-900);
}

.photo__status .workspace__hint:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo__info {
  display: flex;
  flex: none;
  gap: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Справа - свойства и слои, вкладками. */
.photo__side {
  min-height: 0;
}

.photo__inspector {
  width: auto;
}

.photo__sections {
  display: grid;
  gap: 20px;
}

.photo__sections[hidden] {
  display: none;
}

/* Основной и фоновый цвета стоят рядом; код цвета здесь не показан - он виден в подсказке образца. */
.photo__colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.photo__colors .paint__main {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding-right: 8px;
}

.photo__colors .paint__code {
  display: none;
}

.photo__icons {
  gap: 2px;
}

.photo__text {
  height: auto;
  padding: 6px 8px;
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}

.photo__readout {
  margin: 0;
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
}

/* Панель настройки коррекции. */
.photo__adjust .row > .btn {
  flex: 1;
}

.photo__histogram {
  width: 100%;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--slate-950);
  color: var(--bone-dim);
  image-rendering: pixelated;
}

/* Слои. */
.photo__layers {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.photo__layer-look {
  display: grid;
  gap: 10px;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--slate-800);
}

.photo__layers .layers__row {
  height: 44px;
  padding-left: 4px;
}

.photo__thumb {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--slate-600);
  border-radius: 4px;
  background: repeating-conic-gradient(#d9d9d9 0 25%, #f4f4f4 0 50%) 0 0 / 10px 10px;
}

/* У группы на месте миниатюры - папка. */
.photo__thumb--group {
  display: grid;
  place-items: center;
  border-color: transparent;
  background: none;
  color: var(--bone-dim);
}

.layers__row.is-active .photo__thumb--group {
  color: var(--patina);
}

.photo__thumb--group .icon {
  width: 20px;
  height: 20px;
}

.photo__layers .layers__row.is-active .photo__thumb:not(.photo__thumb--group) {
  border-color: var(--patina);
}

/* Окна. */
.photo__form {
  display: grid;
  gap: 14px;
}

.photo__anchor {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  gap: 3px;
}

.photo__anchor-cell {
  height: 22px;
  padding: 0;
  border: 1px solid var(--slate-600);
  border-radius: 4px;
  background: var(--slate-950);
}

.photo__anchor-cell:hover {
  border-color: var(--slate-500);
}

.photo__anchor-cell.is-on {
  border-color: var(--patina);
  background: var(--patina);
}

/* Файлы над окном редактора. */
.photo__drop {
  position: absolute;
  inset: 8px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--patina);
  border-radius: var(--radius-lg);
  background: rgba(21, 24, 27, 0.8);
  color: var(--patina);
  font-size: var(--text-lg);
  pointer-events: none;
}

.photo__drop[hidden] {
  display: none;
}

/* На невысоком экране инструменты встают в два ряда значков: так они видны все, без прокрутки. */
@media (max-height: 880px) {
  .photo__rail {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    width: auto;
  }

  .photo__rail .tool {
    padding: 9px 0;
  }

  .photo__rail .tool__name {
    display: none;
  }
}

/* ── Покадровая анимация: лента кадров под холстом ── */

.photo__center {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
}

.photo__frames {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
}

.photo__frames[hidden] {
  display: none;
}

.photo__frames-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.photo__frames-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.photo__frames-count {
  min-width: 96px;
  margin: 0 6px;
  color: var(--bone-dim);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.photo__frames-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  color: var(--bone-dim);
  font-size: var(--text-sm);
}

.photo__frames-field .stepper {
  height: 30px;
}

.photo__frames-field .stepper__input {
  width: 34px;
}

.photo__frames-step .icon {
  transform: rotate(-90deg);
}

.photo__frames-step--back .icon {
  transform: rotate(90deg);
}

/* Высота ленты постоянная: холст не прыгает, когда кадры появляются и пропадают. */
.photo__strip {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  height: 92px;
  padding: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  /* Полоса прокрутки - как в панелях: тонкая, тёмная, без белой дорожки. */
  scrollbar-width: thin;
  scrollbar-color: var(--slate-600) transparent;
  border-radius: var(--radius-sm);
  background: var(--slate-900);
}

.photo__cell {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 3px 3px 1px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--bone-faint);
  font-size: var(--text-xs);
  cursor: pointer;
}

.photo__cell:hover {
  border-color: var(--slate-600);
  color: var(--bone);
}

.photo__cell.is-active {
  border-color: var(--patina);
  background: var(--patina-wash);
  color: var(--bone);
}

.photo__cell-thumb {
  display: block;
  height: 56px;
  border-radius: 3px;
  background: repeating-conic-gradient(#d9d9d9 0% 25%, #f4f4f4 0% 50%) 50% / 12px 12px;
}

.photo__cell-number {
  display: flex;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.photo__cell-hold {
  color: var(--bronze);
}

.photo__cell--add {
  justify-content: center;
  width: 56px;
  height: 64px;
  border: 1px dashed var(--slate-600);
}

@media (max-width: 1100px) {
  .photo__body {
    grid-template-columns: auto minmax(0, 1fr) 248px;
  }

  .photo__bar .btn .icon + .btn__label {
    display: none;
  }
}

/* Маска слоя: её миниатюра стоит после имени. Обведено то, по чему сейчас красят, - слой или маска. */
.layers__mask {
  flex: none;
  display: grid;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

.layers__mask .photo__thumb {
  width: 30px;
  height: 30px;
  background: #000;
}

.photo__layers .layers__row .layers__mask.is-on .photo__thumb {
  border-color: var(--patina);
  box-shadow: 0 0 0 1px var(--patina);
}

.photo__layers .layers__row.is-active.is-on-mask .layers__pick .photo__thumb:not(.photo__thumb--group) {
  border-color: var(--slate-600);
}

.photo__layers .layers__row.is-active:not(.is-on-mask) .layers__pick canvas.photo__thumb {
  box-shadow: 0 0 0 1px var(--patina);
}
