/* Matto Photo — стили темы */

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
:where(a, button, input, textarea):focus-visible { outline: 1px solid var(--wp--preset--color--contrast); outline-offset: 3px; }
.wp-site-blocks > footer { margin-block-start: 0; }
.wp-site-blocks > main, .wp-site-blocks > .matto-main { margin-block-start: 0; }

.matto-center { text-align: center; }
.matto-center.wp-block-buttons, .matto-center .wp-block-buttons { justify-content: center; }
.matto-muted { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); }
.matto-lead { font-family: var(--wp--preset--font-family--serif); font-style: italic; font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.5; }
.matto-label { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--wp--preset--color--muted); margin-bottom: .75rem !important; }
.matto-main { padding-top: clamp(1rem, 3vw, 2rem); padding-bottom: clamp(4rem, 10vw, 7rem); }
.home .matto-main { padding-bottom: 0; }
.matto-page-title { margin-bottom: clamp(1.5rem, 4vw, 3rem) !important; }

/* ---------- Шапка: всегда закреплена ---------- */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 50;
	background: var(--wp--preset--color--base);
	transition: box-shadow .3s ease;
}
.matto-scrolled .wp-site-blocks > header.wp-block-template-part { box-shadow: 0 1px 0 var(--wp--preset--color--line); }
.matto-header { padding: calc(1.1rem + env(safe-area-inset-top, 0px)) var(--wp--style--root--padding-right) 1.1rem var(--wp--style--root--padding-left); }
.matto-header__row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	column-gap: 1.5rem;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-inline: auto;
}
.matto-header__row > * { margin: 0 !important; }
.matto-hcontact { justify-self: start; font-size: .72rem; font-weight: 400; letter-spacing: .18em; text-transform: uppercase; line-height: 2; }
.matto-hcontact a { text-decoration: none; }
.matto-hcontact a:hover { color: var(--wp--preset--color--muted); }
.matto-logo-wrap { text-align: center; }
.matto-logo-wrap .wp-block-site-logo { margin: 0 auto; }
.matto-logo-wrap .wp-block-site-logo img { max-width: min(220px, 50vw); height: auto; }
.matto-logo-wrap:has(.wp-block-site-logo img) .wp-block-site-title { display: none; }
.matto-logo { margin: 0; font-family: var(--wp--preset--font-family--serif); font-weight: 400; font-size: clamp(1.45rem, 2.4vw, 2.1rem); line-height: 1.2; white-space: nowrap; }
.matto-logo a { text-decoration: none; color: inherit; }
.matto-social--header { justify-self: end; }

/* Иконки соцсетей */
.matto-social.is-style-logos-only { gap: .35rem !important; }
.matto-social.is-style-logos-only .wp-social-link { color: var(--wp--preset--color--contrast) !important; }
.matto-social.is-style-logos-only .wp-social-link a { padding: 8px !important; }
.matto-social .wp-social-link svg { width: 21px; height: 21px; }
.matto-social .wp-social-link:hover { opacity: .55; transform: none; }

@media (max-width: 781px) {
	.matto-header { padding-top: calc(.8rem + env(safe-area-inset-top, 0px)); padding-bottom: .8rem; }
	.matto-header__row { grid-template-columns: 1fr auto auto; column-gap: .35rem; }
	.matto-logo-wrap { order: 1; text-align: left; }
	.matto-logo-wrap .wp-block-site-logo { margin: 0; }
	.matto-social--header { order: 2; }
	.matto-hcontact { order: 3; font-size: .64rem; letter-spacing: .14em; padding-left: .6rem; border-left: 1px solid var(--wp--preset--color--line); }
}

/* ---------- Коллаж: компьютер ---------- */
.matto-collage {
	display: grid;
	grid-template-columns: repeat(24, minmax(0, 1fr));
	grid-template-rows: repeat(24, clamp(12px, 2.1vw, 30px));
	gap: 0 !important;
	margin-bottom: clamp(1rem, 4vw, 3rem);
}
.matto-collage > .wp-block-image { margin: 0 !important; min-width: 0; min-height: 0; position: relative; }
.matto-collage > .wp-block-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.matto-collage > :nth-child(1) { grid-column: 2 / 8;   grid-row: 3 / 21;  z-index: 2; }
.matto-collage > :nth-child(2) { grid-column: 7 / 11;  grid-row: 8 / 17;  z-index: 3; }
.matto-collage > :nth-child(3) { grid-column: 10 / 14; grid-row: 14 / 25; z-index: 4; }
.matto-collage > :nth-child(4) { grid-column: 12 / 19; grid-row: 1 / 23;  z-index: 1; }
.matto-collage > :nth-child(5) { grid-column: 17 / 21; grid-row: 9 / 21;  z-index: 3; }
.matto-collage > :nth-child(6) { grid-column: 20 / 24; grid-row: 4 / 13;  z-index: 2; }
.matto-collage > :nth-child(1) img { object-position: 50% 35%; }
.matto-collage > :nth-child(2) img { object-position: 50% 42%; }
.matto-collage > :nth-child(3) img { object-position: 50% 40%; }
.matto-collage > :nth-child(4) img { object-position: 50% 45%; }
.matto-collage > :nth-child(5) img { object-position: 50% 38%; }
.matto-collage > :nth-child(6) img { object-position: 50% 30%; }

/* ---------- Коллаж: телефон ---------- */
@media (max-width: 781px) {
	.matto-collage { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(27, 6vw); margin-top: .5rem; }
	.matto-collage > :nth-child(4) { grid-column: 4 / 11; grid-row: 1 / 14;  z-index: 1; }
	.matto-collage > :nth-child(1) { grid-column: 1 / 6;  grid-row: 9 / 18;  z-index: 3; }
	.matto-collage > :nth-child(2) { grid-column: 9 / 13; grid-row: 11 / 18; z-index: 3; }
	.matto-collage > :nth-child(3) { grid-column: 5 / 10; grid-row: 16 / 25; z-index: 4; }
	.matto-collage > :nth-child(5) { grid-column: 9 / 13; grid-row: 20 / 26; z-index: 5; }
	.matto-collage > :nth-child(6) { grid-column: 1 / 5;  grid-row: 19 / 27; z-index: 2; }
}

/* ---------- Обо мне ---------- */
.matto-about { margin-top: clamp(3rem, 8vw, 6rem) !important; gap: clamp(2rem, 6vw, 5.5rem) !important; align-items: center !important; }
.matto-about__text { text-align: right; }
.matto-about h1 { margin: 0 0 .25rem; }
.matto-about .matto-muted { margin-top: 0; letter-spacing: .04em; }
.matto-portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 18%; }
body:not(.editor-styles-wrapper) .matto-about__photo:not(:has(img)) { display: none; }
/* пока нет портрета — текст по центру страницы, выровнен влево */
.matto-about:not(:has(.matto-about__photo img)) .matto-about__text { flex-basis: 100% !important; max-width: 44rem; margin-inline: auto; text-align: left; }
@media (max-width: 781px) {
	.matto-about { margin-top: 3.5rem !important; gap: 2rem !important; }
	.matto-about__text { text-align: left; }
	.matto-about__photo { order: -1; }
	.matto-portrait { width: 78%; margin-inline: auto !important; }
	.matto-portrait img { aspect-ratio: 4 / 5; }
	.matto-about h1 { font-size: 2.4rem; }
}

/* ---------- Сетка фото разной высоты ---------- */
.wp-block-gallery.matto-masonry {
	display: block !important;
	column-count: 3;
	column-gap: clamp(1rem, 2.5vw, 2rem);
	margin-top: clamp(4.5rem, 12vw, 9rem) !important;
}
.wp-block-gallery.matto-masonry > .wp-block-image {
	display: block;
	width: 100% !important;
	margin: 0 0 clamp(1rem, 2.5vw, 2rem) !important;
	break-inside: avoid;
}
.wp-block-gallery.matto-masonry > .wp-block-image img { width: 100% !important; height: auto !important; object-fit: initial !important; }
/* пустую галерею прячем только на сайте, в редакторе она видна */
body:not(.editor-styles-wrapper) .wp-block-gallery.matto-masonry:not(:has(img)) { display: none !important; }
.editor-styles-wrapper .wp-block-gallery.matto-masonry:not(:has(img)) { display: block !important; column-count: 1; }
@media (max-width: 781px) {
	.wp-block-gallery.matto-masonry { column-count: 2; column-gap: 10px; }
	.wp-block-gallery.matto-masonry > .wp-block-image { margin-bottom: 10px !important; }
}

/* ---------- Как проходит съёмка ---------- */
.matto-section { margin-top: clamp(4.5rem, 12vw, 9rem) !important; }
.matto-section__title { text-align: center; margin-bottom: clamp(2rem, 4vw, 3rem) !important; }
.matto-steps { gap: clamp(1.5rem, 4vw, 3.5rem) !important; }
.matto-steps > .wp-block-column { border-top: 1px solid var(--wp--preset--color--line); padding-top: 1.5rem; }
.matto-step-num { font-family: var(--wp--preset--font-family--serif); font-style: italic; font-size: 2.5rem; line-height: 1; color: var(--wp--preset--color--accent); margin: 0 0 1rem !important; }
.matto-steps h3 { margin: 0 0 .75rem; }
.matto-steps p { margin: 0; }

/* ---------- Призыв ---------- */
.matto-cta { margin-top: clamp(4.5rem, 12vw, 9rem) !important; padding-block: clamp(3rem, 7vw, 5rem); background: var(--wp--preset--color--soft); text-align: center; }
.matto-cta p { max-width: 34rem; margin-inline: auto; }
.matto-cta .wp-block-buttons { justify-content: center; margin-top: 1.75rem; }

/* ---------- Контакты ---------- */
.matto-contacts { gap: clamp(2.5rem, 7vw, 6.5rem) !important; align-items: flex-start !important; padding-top: clamp(1.5rem, 5vw, 3rem); }
.matto-cinfo h1 { margin: 0 0 1.25rem; }
.matto-cinfo .matto-lead { margin: 0 0 1rem; }
.matto-clist { margin-top: 2.5rem !important; }
.matto-clist > * + * { margin-top: 0 !important; }
.matto-crow { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--wp--preset--color--line); }
.matto-crow:last-child { border-bottom: 1px solid var(--wp--preset--color--line); }
.matto-crow > * { margin: 0 !important; }
.matto-clabel { font-size: .8rem; color: var(--wp--preset--color--muted); padding-top: .15rem; }
.matto-crow a { text-decoration: none; }
.matto-crow a:hover { color: var(--wp--preset--color--muted); }
.matto-crow a[href*="t.me"]::before, .matto-crow a[href*="instagram.com"]::before {
	content: ""; display: inline-block; width: 16px; height: 16px; margin-right: .6rem; vertical-align: -2px;
	background: currentColor; -webkit-mask: var(--matto-icon) center / contain no-repeat; mask: var(--matto-icon) center / contain no-repeat;
}
.matto-crow a[href*="t.me"] { --matto-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.9 4.3 18.7 19.4c-.2 1-.9 1.3-1.7.8l-4.9-3.6-2.4 2.3c-.3.3-.5.5-1 .5l.3-5 9.1-8.2c.4-.4-.1-.6-.6-.2L6.2 13 1.4 11.5c-1-.3-1-1 .2-1.5L20.6 2.8c.9-.3 1.6.2 1.3 1.5z'/%3E%3C/svg%3E"); }
.matto-crow a[href*="instagram.com"] { --matto-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 8.2a3.2 3.2 0 1 1 0-6.4 3.2 3.2 0 0 1 0 6.4zM17.3 5.5a1.2 1.2 0 1 0 0 2.4 1.2 1.2 0 0 0 0-2.4zM12 3.8c2.7 0 3 0 4 .1 2.7.1 4 1.4 4.1 4.1.1 1 .1 1.4.1 4s0 3-.1 4c-.1 2.7-1.4 4-4.1 4.1-1 .1-1.4.1-4 .1s-3 0-4-.1c-2.7-.1-4-1.4-4.1-4.1-.1-1-.1-1.4-.1-4s0-3 .1-4C4 5.3 5.3 4 8 3.9c1 0 1.3-.1 4-.1zM12 2c-2.7 0-3.1 0-4.1.1C4.2 2.2 2.2 4.2 2.1 7.9 2 8.9 2 9.3 2 12s0 3.1.1 4.1c.2 3.7 2.1 5.7 5.8 5.8 1 .1 1.4.1 4.1.1s3.1 0 4.1-.1c3.7-.2 5.7-2.1 5.8-5.8.1-1 .1-1.4.1-4.1s0-3.1-.1-4.1C21.8 4.2 19.8 2.2 16.1 2.1 15.1 2 14.7 2 12 2z'/%3E%3C/svg%3E"); }
.matto-cform { background: var(--wp--preset--color--soft); padding: clamp(1.75rem, 4vw, 3rem) !important; }
.matto-cform h2 { font-size: 1.75rem; margin: 0 0 1.75rem; }
@media (max-width: 781px) {
	.matto-contacts { gap: 2.5rem !important; }
	.matto-crow { grid-template-columns: 1fr; gap: .2rem; }
	.matto-cform { margin-inline: calc(-1 * var(--wp--style--root--padding-left)) !important; padding: 2rem var(--wp--style--root--padding-left) !important; }
}

/* ---------- Форма ---------- */
.matto-form p { margin: 0 0 1.4rem; }
.matto-form label { display: block; font-size: .78rem; letter-spacing: .08em; color: var(--wp--preset--color--muted); margin-bottom: .2rem; }
.matto-form input[type="text"], .matto-form textarea {
	width: 100%; border: 0; border-bottom: 1px solid var(--wp--preset--color--line); border-radius: 0;
	background: transparent; padding: .55rem 0; font: inherit; color: inherit;
}
.matto-form input[type="text"]:focus, .matto-form textarea:focus { outline: none; border-bottom-color: var(--wp--preset--color--contrast); }
.matto-form textarea { resize: vertical; }
.matto-form__consent label { display: flex; gap: .65rem; align-items: flex-start; letter-spacing: 0; line-height: 1.5; }
.matto-form__consent input { margin-top: .25rem; accent-color: var(--wp--preset--color--contrast); }
.matto-form button { cursor: pointer; }
.matto-form__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.matto-form__error { color: #9B3B2F; font-size: .9rem; margin-bottom: 1.5rem; }
.matto-form__done h2 { margin: 0 0 .75rem; }

/* ---------- Подвал ---------- */
.matto-footer { border-top: 1px solid var(--wp--preset--color--line); padding: clamp(3rem, 7vw, 4.5rem) var(--wp--style--root--padding-right) clamp(2rem, 5vw, 3rem) var(--wp--style--root--padding-left); }
.matto-fgrid, .matto-fbottom { max-width: var(--wp--style--global--wide-size, 1200px); margin-inline: auto; }
.matto-fgrid { display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.matto-fgrid > *, .matto-fbrand > *, .matto-fcontact > *, .matto-fbottom > * { margin: 0 !important; }
.matto-flogo { font-family: var(--wp--preset--font-family--serif); font-size: 1.75rem; line-height: 1.1; }
.matto-flogo a { text-decoration: none; color: inherit; }
.matto-fbrand .matto-muted { margin-top: .75rem !important; max-width: 18rem; }
.matto-fcontact { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.matto-fcontact .wp-block-button__link { padding: .85rem 1.75rem; font-size: .72rem; }
.matto-fcontact .matto-social { margin-left: -8px !important; }
.matto-footer a { text-decoration: none; }
.matto-fbottom { margin-top: clamp(2.5rem, 6vw, 4rem) !important; padding-top: 1.5rem; border-top: 1px solid var(--wp--preset--color--line); display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: center; font-size: .78rem; color: var(--wp--preset--color--muted); }
.matto-fbottom a { color: inherit; }
.matto-fbottom a:hover { color: var(--wp--preset--color--contrast); }
.matto-fbottom .trp-language-switcher, .matto-fbottom .trp-shortcode-switcher__wrapper { margin-left: auto !important; }
@media (max-width: 781px) {
	.matto-fgrid { grid-template-columns: 1fr; gap: 2.25rem; }
	.matto-fbottom { flex-direction: column; align-items: flex-start; }
	.matto-fbottom .trp-language-switcher, .matto-fbottom .trp-shortcode-switcher__wrapper { margin-left: 0 !important; }
}

/* ---------- Кнопка «Наверх» ---------- */
.matto-totop {
	position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: calc(clamp(1rem, 3vw, 2rem) + env(safe-area-inset-bottom, 0px)); z-index: 40;
	display: grid; place-items: center; width: 44px; height: 44px;
	color: var(--wp--preset--color--contrast); background: var(--wp--preset--color--base); border: 1px solid var(--wp--preset--color--line);
	opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.matto-far .matto-totop { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .matto-totop, .wp-site-blocks > header.wp-block-template-part { transition: none; } }

/* ---------- Сетка фото: порядок слева направо (JS раскладывает, см. theme.js) ---------- */
.wp-block-gallery.matto-masonry.is-js-masonry {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-auto-rows: 4px;
	column-gap: clamp(1rem, 2.5vw, 2rem) !important;
	row-gap: 0 !important;
	column-count: auto;
	align-items: start;
}
.wp-block-gallery.matto-masonry.is-js-masonry > .wp-block-image { margin: 0 !important; }
@media (max-width: 781px) {
	.wp-block-gallery.matto-masonry.is-js-masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px !important; }
}

/* ---------- В редакторе: ровная сетка 4 в ряд, удобно перетаскивать ---------- */
.editor-styles-wrapper .wp-block-gallery.matto-masonry {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px !important;
	column-count: auto !important;
}
.editor-styles-wrapper .wp-block-gallery.matto-masonry > .wp-block-image { width: 100% !important; margin: 0 !important; }
.editor-styles-wrapper .wp-block-gallery.matto-masonry > .wp-block-image img { aspect-ratio: 3 / 4; object-fit: cover !important; height: auto !important; }
