/*
Theme Name: MAKEUPLOVERS Studio
Theme URI: https://makeuplovers.ru/
Description: Дочерняя тема MAKEUPLOVERS на основе Chaplin. Сохраняет разметку, стили и бесконечную ленту Chaplin, добавляет блоковые шаблоны и кнопку возврата наверх.
Author: MAKEUPLOVERS
Version: 0.4.0
Requires at least: 5.5
Requires PHP: 7.4
Template: chaplin
Text Domain: makeuplovers-studio
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
  --mls-backtop-bg: #000;
  --mls-backtop-icon-color: #fff;
  --mls-backtop-hover-bg: #fff;
  --mls-backtop-hover-icon-color: #000;
}

.mls-back-to-top,
html body button.mls-back-to-top {
  position: fixed !important;
  z-index: 999;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid !important;
  box-sizing: border-box !important;
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  place-items: center;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--mls-backtop-bg) !important;
  color: var(--mls-backtop-icon-color) !important;
  font: inherit !important;
  font-size: 0 !important;
  line-height: 1 !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  box-shadow: 0 4px 16px rgb(0 0 0 / 22%);
  transition: opacity .18s ease, transform .18s ease, background-color .18s ease;
  cursor: pointer !important;
}
.mls-back-to-top > span { display: block; width: 24px; height: 24px; background-color: var(--mls-backtop-icon-color); -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; transform: rotate(-90deg); }
.mls-back-to-top[hidden] { display: none !important; }
.mls-back-to-top.is-visible { opacity: .88; pointer-events: auto; transform: translateY(0); }
.mls-back-to-top:hover, .mls-back-to-top:focus-visible { opacity: 1; text-decoration: none !important; background: var(--mls-backtop-hover-bg) !important; }
.mls-back-to-top:hover > span, .mls-back-to-top:focus-visible > span { background-color: var(--mls-backtop-hover-icon-color); }
.mls-back-to-top:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.mls-home-intro { margin: 0 auto 5rem; }
.mls-quick-start { padding: clamp(1.5rem, 4vw, 3.5rem); background: #f7f5f3; }
.mls-quick-start__columns { margin-top: 2rem; gap: 1rem; }
.mls-quick-start__columns > .wp-block-column { padding: 1.5rem; background: #fff; }
.mls-quick-start .wp-block-button__link { border-radius: 2px; }

.mls-popup[hidden] { display: none !important; }
.mls-popup { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 1rem; }
.mls-popup__backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 55%); }
.mls-popup__panel { position: relative; z-index: 1; width: min(100%, 620px); max-height: min(90vh, 820px); overflow: auto; padding: clamp(1.5rem, 5vw, 3rem); }
.mls-popup__close { position: absolute; top: .5rem; right: .75rem; width: 42px; height: 42px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 2rem; line-height: 1; cursor: pointer; }
.mls-popup__content { padding-top: .5rem; }
body.mls-popup-open { overflow: hidden; }
.mls-popup input[type="text"], .mls-popup input[type="email"], .mls-popup input[type="submit"], .mls-popup button { font: inherit; }
.mls-popup input[type="text"], .mls-popup input[type="email"] { max-width: 100%; min-height: 44px; }

.mls-notice-bar { padding: .65rem 1rem; text-align: center; background: #222; color: #fff; font-size: .9rem; }
.mls-notice-bar a { color: inherit; text-decoration: underline; }

.mls-reading-time .meta-icon svg { width: 1.8rem; height: 1.8rem; }
.mls-reading-time .meta-icon path { fill: none !important; }

.mls-brand-directory { margin: 2rem auto; }
.mls-brand-tools { display: grid; gap: 1.5rem; margin-bottom: 2rem; }
.mls-brand-search { min-height: 48px; padding: .75rem 1rem !important; border: 1px solid #d8d8d8 !important; }
.mls-brand-letters { display: flex; flex-wrap: wrap; gap: .45rem; }
.mls-brand-letters button { min-width: 40px; padding: .7rem .85rem; background: #f3f3f3; color: #222; font: inherit; }
.mls-brand-letters button.is-active { background: #222; color: #fff; }
.mls-brand-count { margin-bottom: 1rem; color: #666; }
.mls-brand-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.mls-brand-card { min-width: 0; padding: 1.5rem; border: 1px solid #e5e5e5; background: #fff; }
.mls-brand-card[hidden] { display: none !important; }
.mls-brand-card__summary h2 { margin: 0 0 .65rem; font-size: 1.25em; }
.mls-brand-card__summary p { margin: 0 0 1rem; color: #666; font-size: .9em; }
.mls-brand-open { display: inline-block; padding: .8em 1em; background: #222; color: #fff !important; font: inherit; font-size: .9em; text-decoration: none; }
.mls-brand-open:hover, .mls-brand-open:focus-visible { opacity: .82; }
.mls-brand-single { max-width: 80rem; margin: 0 auto; }
.mls-brand-single img { height: auto; }
.mls-brand-back { margin-top: 3rem; }
.mls-brand-empty { margin: 2rem 0; }
.mls-brand-poll { margin-top: 2rem; padding: 1.5rem; background: var(--mls-poll-bg); color: var(--mls-poll-text); }
.mls-brand-poll fieldset { padding: 0; border: 0; }
.mls-brand-poll legend { margin-bottom: 1rem; font-size: 1.2em; font-weight: 700; }
.mls-poll-option { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 44px; margin: .4rem 0; padding: .55rem .7rem; border: 1px solid rgb(0 0 0 / 12%); cursor: pointer; }
.mls-poll-option__label { flex: 1; }
.mls-poll-option__count { color: #666; font-size: .85em; }
.mls-poll-option__bar { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; width: var(--mls-poll-percent, 0%); background: var(--mls-poll-accent); transition: width .25s ease; }
.mls-brand-poll input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--mls-poll-accent); }
.mls-poll-submit { margin-top: .75rem; background: var(--mls-poll-accent); color: #fff; }
.mls-poll-submit:disabled { opacity: .6; }
.mls-poll-message { margin: .75rem 0 0; }
.mls-poll-admin-row { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; }
.mls-poll-admin-row > input[type="text"] { max-width: 30rem; }
.mls-poll-admin-row input[type="number"] { width: 7rem; }

@media (max-width: 900px) {
  .mls-brand-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .mls-brand-list { grid-template-columns: 1fr; }
  .mls-poll-admin-row { align-items: flex-start; flex-direction: column; }
}

/* The inherited Chaplin header leaves 5rem before every archive. Tighten only the home feed. */
body.home #site-header { margin-bottom: 1.5rem; }
body.home .archive-header { margin-bottom: 2rem; }

.header-titles .custom-logo-link,
.header-titles .custom-logo { background: transparent !important; box-shadow: none; }
.header-titles .custom-logo { display: block; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .mls-back-to-top { transition: none; }
}
