/* «У меня получилось!» (readers' photos of a recipe) and «Пожаловаться» — templates/community/*.
   Loaded on the recipe page, the photo form, the complaint page and «Мои результаты». Site tokens only;
   logical properties (RTL). */

/* ---------------------------------------------------------------- hero counter */
.recipe-bakes-jump {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

@media (hover: hover) {
  .recipe-bakes-jump:hover {
    border-color: var(--field);
  }
}

/* ---------------------------------------------------------------- the section */
.bakes {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.bakes__head {
  display: grid;
  gap: var(--space-2);
}

.bakes .bakes__head h2 {
  margin: 0;
}

.bakes__count {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}

.bakes__list {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 2px 2px var(--space-2);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.bakes__item {
  flex: 0 0 auto;
  width: clamp(120px, 38vw, 180px);
  scroll-snap-align: start;
}

.bakes__open {
  display: grid;
  gap: var(--space-2);
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-md);
}

.bakes__open picture,
.bakes__img {
  display: block;
  width: 100%;
}

.bakes__img {
  aspect-ratio: 4 / 5;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.bakes__name {
  overflow: hidden;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bakes__open:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.bakes__empty {
  margin: 0;
  padding: var(--space-4);
  border: 1.5px dashed var(--field);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.45;
}

.bakes__note {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--wait-soft);
  color: var(--wait);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.bakes__cta {
  justify-self: start;
  max-width: 100%;
}

/* ---------------------------------------------------------------- «Пожаловаться» link */
.report-line {
  margin: calc(var(--space-2) * -1) 0 0;
  padding-inline: var(--space-2);
}

.report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--target-min);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.report-link svg {
  flex: 0 0 auto;
}

@media (hover: hover) {
  .report-link:hover {
    color: var(--ink);
  }
}

/* ---------------------------------------------------------------- dialogs (viewer, sheet) */
.bake-viewer,
.bake-sheet {
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
}

.bake-viewer::backdrop,
.bake-sheet::backdrop {
  background: var(--scrim);
}

html:has(.bake-viewer[open]),
html:has(.bake-sheet[open]) {
  overflow: hidden;
}

/* The viewer: the whole photo on the dark scrim, the name and the comment under it. */
.bake-viewer {
  max-width: min(720px, 100%);
  max-height: 100dvh;
  margin: auto;
  background: transparent;
}

.bake-viewer__inner {
  position: relative;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
}

.bake-viewer__figure {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.bake-viewer__figure img {
  display: block;
  width: 100%;
  max-height: 68dvh;
  object-fit: contain;
  background: var(--scrim);
}

.bake-viewer__caption {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4) var(--space-1);
}

.bake-viewer__name {
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}

.bake-viewer__comment {
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.bake-viewer__report {
  justify-self: start;
}

.bake-viewer__close,
.bake-viewer__step,
.bake-sheet__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target);
  height: var(--target);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--fs-2xl);
  line-height: 1;
  cursor: pointer;
}

.bake-viewer__close,
.bake-viewer__step {
  border: 1px solid color-mix(in srgb, var(--on-scrim) 36%, transparent);
  background: var(--scrim);
  color: var(--on-scrim);
}

.bake-viewer__close {
  position: absolute;
  z-index: 2;
  top: var(--space-5);
  inset-inline-end: var(--space-5);
}

.bake-viewer__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  color: var(--on-scrim);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.bake-viewer__counter {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--scrim);
}

.bake-viewer__nav[hidden] {
  display: none;
}

.bake-viewer__close:focus-visible,
.bake-viewer__step:focus-visible {
  outline: 3px solid var(--on-scrim);
  outline-offset: 2px;
}

/* The complaint sheet: a bottom sheet on phones, a centred dialog on wide screens. */
.bake-sheet {
  max-width: 560px;
  max-height: min(92dvh, 820px);
  margin: auto auto 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.bake-sheet__inner {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) calc(var(--space-4) + var(--safe-bottom));
}

.bake-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.bake-sheet__head h2 {
  margin: 0;
  font-size: var(--fs-xl);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.bake-sheet__close {
  flex: none;
  border: 0;
  background: var(--accent-soft);
  color: var(--ink);
}

@media (min-width: 700px) {
  .bake-sheet {
    margin: auto;
    border-radius: var(--radius-xl);
  }
}

/* ---------------------------------------------------------------- complaint form */
.report-form {
  display: grid;
  gap: var(--space-3);
}

.report-form__hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.report-form__reasons {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.report-form__legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}

.form-grid .report-form__reason {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  cursor: pointer;
}

.report-form__reason input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.report-form__reason:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.report-form__error {
  margin: 0;
  color: var(--accent-deep);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.report-form__submit {
  width: 100%;
}

/* ---------------------------------------------------------------- pages: the photo form, «Мои результаты» */
.bake-page {
  display: grid;
  gap: var(--space-3);
  max-width: 640px;
  margin-inline: auto;
}

.bake-page h1 {
  margin: 0;
}

.bake-page__lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* The back link of the photo form and the complaint page names the recipe: long titles wrap. */
.back-link:has(.back-link__label) {
  max-width: 100%;
}

.back-link__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bake-form {
  display: grid;
  gap: var(--space-4);
}

.bake-form__photo {
  display: grid;
  gap: 6px;
}

.bake-form__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.form-grid .bake-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 1.5px dashed var(--field);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.bake-drop:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.bake-drop__hint {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  text-align: center;
}

.bake-drop__hint[hidden],
.bake-drop__preview[hidden] {
  display: none;
}

.bake-drop__preview {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

/* The native input stays in the tab order and reachable by screen readers, invisible on top. */
.form-grid .bake-drop__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.bake-form__note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.bake-form__submit {
  width: 100%;
}

.my-bakes {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.my-bakes__row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.my-bakes__row picture,
.my-bakes__img {
  display: block;
  width: 88px;
}

.my-bakes__img {
  aspect-ratio: 4 / 5;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.my-bakes__main {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.my-bakes__title {
  font-weight: var(--fw-bold);
  overflow-wrap: anywhere;
}

.my-bakes__status {
  justify-self: start;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.my-bakes__status--published {
  background: var(--ok-soft);
  color: var(--ok);
}

.my-bakes__status--pending,
.my-bakes__status--hidden {
  background: var(--wait-soft);
  color: var(--wait);
}

.my-bakes__status--rejected {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.my-bakes__reason {
  color: var(--muted);
  font-size: var(--fs-sm);
  white-space: pre-line;
}

.my-bakes__delete {
  margin: 0;
}

.my-bakes__delete-btn {
  min-width: var(--target-min);
  min-height: var(--target-min);
  padding: 0 var(--space-1);
  margin-inline-start: calc(var(--space-1) * -1);
  border: 0;
  background: none;
  color: var(--accent-deep);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
