/*
 * The site's sheet: a bottom panel on phones, a dialog on desktop. Used by the
 * cookbook screen (inc/Views/Cookbook/book.php), the «В подборку» picker
 * (js/cookbook-save.js) and «Сообщить об ошибке» (js/dv-feedback.js); opened
 * by js/dv-sheet.js outside the book. Its head, footer, sections, choice chips,
 * inputs, the list of ticks and the «new collection» form. Loaded before
 * css/cookbook.css.
 * The --facet-* tokens come from category.css where it is loaded; the
 * fallbacks are the same values for pages without it.
 */

.dv-label {
  display: block;
  margin: 0 0 .35rem;
  font-size: .75rem;
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-main-gray);
}


.dv-btn-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 2.75rem;
  padding: .55rem 1rem;
  border-radius: 4px;
  font-size: .9375rem;
}


/*
 * ---- Sheet: bottom panel on phones, dialog on desktop ---------------------
 * Scoped to .dv-sheet-backdrop: the archive toolbar has a .dv-sheet of its own.
 */

.dv-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(15 31 36 / .45);
}

.dv-sheet-backdrop[hidden] {
  display: none;
}

/*
 * category.css (loaded on author pages too) slides the archive's .dv-sheet in
 * from below on phones and keeps it off-screen until its toolbar opens it;
 * the book's sheet shares the class but is shown by its own backdrop.
 */
.dv-sheet-backdrop > .dv-sheet {
  transform: none;
  transition: none;
}

.dv-sheet-backdrop > .dv-sheet {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 32rem;
  max-height: 88vh;
  overflow: auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-radius: 1rem 1rem 0 0;
  background: #fff;
  box-shadow: 0 10px 30px rgb(15 31 36 / .14);
}

@media (min-width: 640px) {
  .dv-sheet-backdrop {
    align-items: center;
  }

  .dv-sheet-backdrop > .dv-sheet {
    border-radius: var(--br-radius);
  }
}

.dv-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dv-sheet-head h3 {
  margin: 0;
  font-size: 1.125rem;
}

.dv-sheet-head p {
  margin: .15rem 0 0;
  font-size: .8125rem;
  color: var(--color-dark-blue-muted);
}

.dv-icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  /* Same soft border as .btn-line (style.css). */
  border: 1px solid #e3ebee;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.dv-icon-btn:hover {
  background: #f5f9fa;
  border-color: #9dc3cd;
}

.dv-icon-btn .svg-icon {
  width: 1rem;
  height: 1rem;
}


.dv-hint {
  font-size: .75rem;
  color: var(--color-dark-blue-muted);
}

.dv-sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}


body.dv-sheet-open {
  overflow: hidden;
}

/* The site's floating share / to-top buttons would cover the sheet's footer on phones. */
body.dv-sheet-open .scrolltop-wrap {
  display: none;
}


.dv-sheet-body {
  display: grid;
  gap: 1rem;
}

.dv-check-list {
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--facet-line, #e3ebee);
  border-radius: 8px;
}

.dv-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--facet-line-strong, #cfe1e6);
  border-radius: 8px;
  background: #fff;
  color: var(--facet-ink, #12384a);
  font-size: 14px;
}

.dv-input:focus {
  border-color: var(--facet-accent, #14657f);
  outline: 0;
}

.dv-input[readonly] {
  background: var(--facet-shelf, #f5f9fa);
}

.dv-new-col,
.dv-share-link {
  display: flex;
  gap: .5rem;
}

.dv-new-col .dv-input,
.dv-share-link .dv-input {
  flex: 1;
}

.dv-sheet-foot__end {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/*
 * Rows of the list of ticks are the archive filters' .dv-pop__row (category.css).
 * Pages without category.css get the same look from here, scoped to the list.
 */
.dv-check-list .dv-pop__row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 400;
  cursor: pointer;
}

.dv-check-list .dv-pop__row:hover {
  background: #f7fafb;
}

.dv-check-list .dv-pop__row:has(.dv-pop__check:checked) {
  background: #f3f9fa;
}

.dv-check-list .dv-pop__check {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--facet-accent, #14657f);
}

.dv-check-list .dv-pop__name {
  color: var(--facet-ink, #12384a);
  font-size: 15px;
  font-weight: 400;
}

.dv-check-list .dv-pop__count {
  margin-left: auto;
  color: var(--facet-faint, #9db2ba);
  font-size: 13px;
}

/* Sections and choice chips of a sheet. */
.cat-item[aria-current],
.cat-item[aria-pressed="true"] {
  background: var(--tint-main-color);
  border-color: var(--main-color);
  box-shadow: inset 0 0 0 1px var(--main-color);
  color: var(--color-dark-blue);
}

.dv-sheet-sec {
  display: grid;
  gap: .5rem;
}

.dv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.dv-chips .cat-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid #e3ebee;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

/* The chip rule above would hide the chosen state: put it back on top. */
.dv-chips .cat-item[aria-pressed="true"] {
  border-color: var(--main-color);
  background: var(--tint-main-color);
}

.dv-chips .cat-item .svg-icon {
  width: 1.1em;
  height: 1.1em;
  fill: var(--main-color);
}

.dv-sheet-backdrop textarea {
  min-height: 5.5rem;
  padding: .6rem .75rem;
  border: 1px solid var(--color-blue-gray);
  border-radius: var(--br-radius-sm);
  resize: vertical;
  font: inherit;
}
