/* =============================================================================
 * Jazyl Студия — страница редактора (/studiya/<slug>) и витрина (/studiya).
 * Порядок работы: шаблон из ленты → правки в свёрнутых группах → превью в рамке телефона → «Скачать».
 * Карточки Студии (.st-cards) — в site.css: они есть и на главной.
 * ========================================================================== */

/* Шапка страницы */
.st-hero {
  padding: 120px 0 28px;
}

.st-hero--hub {
  padding-bottom: 8px;
}

.st-hero__row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.st-hero__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 20px;
  background: var(--violet-strong);
  color: #fff;
  transform: rotate(-6deg);
}

.st-hero__icon svg {
  width: 30px;
  height: 30px;
}

.st-hero__title {
  margin: 4px 0 0;
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.st-hero__lead {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

/* Номер шага: «1 Выберите шаблон» */
.st-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.st-step b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--coral);
  color: #2a0f06;
  font-size: 14px;
  transform: rotate(-6deg);
}

.st-step--last {
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 600;
}

/* 1. Лента шаблонов */
.st-editor {
  padding: 8px 0 40px;
}

.st-templates {
  margin-bottom: 28px;
}

.st-ribbon {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.st-template {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 120px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.st-ribbon--wide .st-template {
  width: 220px;
}

.st-template canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: transform 0.2s ease, outline-color 0.2s ease;
}

.st-template:hover canvas {
  transform: translateY(-3px);
}

.st-template[aria-pressed="true"] {
  color: var(--text);
}

.st-template[aria-pressed="true"] canvas {
  outline-color: var(--coral);
}

/* Рабочая зона: превью слева, правки справа */
.st-workspace {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.st-workspace--wide {
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
}

.st-stage {
  position: sticky;
  top: 90px;
}

/* Рамка телефона */
.st-device {
  padding: 12px;
  border-radius: 38px;
  background: #050409;
  box-shadow: 0 0 0 2px #2b2838, 0 30px 70px rgba(0, 0, 0, 0.5);
}

.st-device--wide {
  border-radius: 22px;
}

.st-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 28px;
}

.st-device--wide .st-canvas {
  border-radius: 12px;
}

.st-actions {
  margin-top: 18px;
}

.st-actions__row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.st-actions__row .btn {
  flex: 1;
}

.st-privacy {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
}

/* 2. Панель правок: свёрнутые группы */
.st-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.st-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.st-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.st-group summary::-webkit-details-marker {
  display: none;
}

.st-group summary::after {
  content: "+";
  color: var(--coral);
  font-size: 22px;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.st-group[open] summary::after {
  transform: rotate(45deg);
}

.st-group__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px 20px;
}

.st-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.st-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.st-hint,
.st-parsed {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
}

.st-hint b {
  color: var(--muted);
}

.st-parsed {
  color: var(--teal);
  font-weight: 600;
}

.st-input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.st-textarea {
  height: auto;
  padding: 12px 14px;
  font-family: "Inter", ui-monospace, monospace;
  line-height: 1.6;
  resize: vertical;
}

.st-input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}

.st-input::placeholder {
  color: var(--dim);
}

select.st-input {
  cursor: pointer;
}

.st-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.st-inline {
  display: flex;
  gap: 8px;
}

/* Переключатели и быстрые кнопки */
.st-seg,
.st-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.st-seg button,
.st-quick button,
.st-add {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.st-seg button:hover,
.st-quick button:hover,
.st-add:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.st-seg button[aria-pressed="true"],
.st-quick button[aria-pressed="true"] {
  border-color: var(--coral);
  background: rgba(240, 153, 123, 0.14);
  color: var(--text);
}

.st-add {
  align-self: flex-start;
  border-style: dashed;
}

/* Палитры: полоска фона, талон и точка-наклейка */
.st-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}

.st-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.st-swatch__bg {
  position: relative;
  display: block;
  height: 64px;
  border-radius: 14px;
  outline: 2px solid transparent;
  outline-offset: 3px;
}

.st-swatch__ticket {
  position: absolute;
  inset: 14px 12px 22px 12px;
  border-radius: 6px;
}

.st-swatch__dot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 10px;
  border-radius: 999px;
  transform: rotate(-10deg);
}

.st-swatch[aria-pressed="true"] {
  color: var(--text);
}

.st-swatch[aria-pressed="true"] .st-swatch__bg {
  outline-color: var(--coral);
}

/* «Есть окошки»: строки дней */
.st-days {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.st-day {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.st-day__parsed {
  grid-column: 1 / -1;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
}

.st-x {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  font-size: 22px;
  cursor: pointer;
}

.st-x:hover {
  color: var(--coral);
  background: rgba(255, 255, 255, 0.05);
}

/* «Анонс месяца»: календарь в форме */
.st-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  max-width: 420px;
}

.st-cal__head {
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.st-cal__day {
  aspect-ratio: 1;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.st-cal__day[aria-pressed="true"] {
  border-color: var(--coral);
  background: var(--coral);
  color: #2a0f06;
}

/* Под редактором: как это работает */
.st-how {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.st-how li {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
}

.st-how span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 9px;
  background: var(--violet-strong);
  color: #fff;
  font-weight: 800;
  transform: rotate(-6deg);
}

.st-how b {
  display: block;
  font-size: 17px;
}

.st-how p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.st-promo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  border-radius: 24px;
  background: var(--violet-strong);
}

.st-promo b {
  font-size: 20px;
}

.st-promo p {
  max-width: 560px;
  margin: 6px 0 0;
  color: #e3e0fb;
  line-height: 1.55;
}

/* Телефон и планшет */
@media (max-width: 960px) {
  .st-workspace,
  .st-workspace--wide {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Телефон: превью — компактная полоса, закреплённая под шапкой сайта;
     настройки прокручиваются под ней, картинку видно всё время */
  .st-stage {
    position: sticky;
    top: 68px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 -24px;
    padding: 10px 24px;
    background: rgba(13, 12, 20, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }

  .st-device {
    flex: none;
    padding: 5px;
    border-radius: 18px;
    box-shadow: 0 0 0 1px #2b2838;
  }

  .st-canvas {
    width: auto;
    height: 30vh;
    max-width: 48vw;
    border-radius: 13px;
  }

  .st-actions {
    flex: 1;
    min-width: 0;
    margin: 0;
  }

  .st-actions .btn {
    padding-inline: 10px;
    white-space: normal;
  }

  .st-actions__row {
    flex-direction: column;
  }

  .st-privacy {
    display: none;
  }

  /* Сертификат 2:1 — превью на всю ширину, кнопки под ним в ряд */
  .st-workspace--wide .st-stage {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .st-workspace--wide .st-canvas {
    width: 100%;
    height: auto;
    max-width: none;
    max-height: 26vh;
    object-fit: contain;
  }

  .st-workspace--wide .st-actions {
    display: flex;
    gap: 8px;
  }

  .st-workspace--wide .st-actions > .btn {
    flex: 1;
  }

  .st-workspace--wide .st-actions__row {
    flex: 1;
    flex-direction: row;
    margin-top: 0;
  }

  .st-workspace--wide .st-actions__row .btn[hidden] + .btn,
  .st-workspace--wide .st-actions__row .btn {
    flex: 1;
  }

  .st-how {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .st-hero {
    padding-top: 96px;
  }

  .st-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .st-day {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .st-day__date {
    grid-column: 1 / -1;
  }

  .st-group summary {
    padding: 14px 16px;
  }

  .st-group__body {
    padding: 0 16px 16px;
  }

  .st-promo {
    padding: 24px 20px;
  }

  .st-promo .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

/* У .container на узком экране отступы 16px — полоса превью от края до края */
@media (max-width: 480px) {
  .st-stage {
    margin: 0 -16px;
    padding: 8px 16px;
  }
}
