/* ==========================================================================
   Persona 2026 — inner pages, popups and legacy reskin
   (loaded after persona.css; uses its tokens)
   ========================================================================== */

/* ---------- page header ---------- */
.p-pagehead { padding: clamp(28px, 4vw, 48px) 0 clamp(32px, 4vw, 56px); background: var(--p-white); }
.p-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 clamp(20px, 3vw, 32px); padding: 0; list-style: none; font-size: var(--p-fs-sm); color: var(--p-muted); }
.p-crumbs li + li::before { content: "/"; margin: 0 10px; color: var(--p-mint); }
.p-crumbs a { color: var(--p-muted); }
.p-crumbs a:hover { color: var(--p-pine); }
.p-crumbs [aria-current] { color: var(--p-ink); }
.p-pagehead__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; }
.p-pagehead__title { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem); max-width: 22ch; }
.p-pagehead .p-lead { margin: 18px 0 0; }
.p-pagehead__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.p-page { padding: 0 0 var(--p-section); }
.p-page__section { margin-top: clamp(48px, 6vw, 88px); }
.p-page__section > .p-h2 { margin-bottom: clamp(24px, 3vw, 36px); }
.p-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 40px clamp(32px, 5vw, 80px); align-items: start; }
.p-layout__side { position: sticky; top: calc(var(--p-header-h) + 24px); }
@media (max-width: 1023px) {
    .p-layout { grid-template-columns: minmax(0, 1fr); }
    .p-layout__side { position: static; }
}

/* ---------- side navigation (service categories) ---------- */
.p-sidenav { border-top: 2px solid var(--p-teal); }
.p-sidenav details { border-bottom: 1px solid var(--p-line); }
.p-sidenav summary {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 16px 0; cursor: pointer; list-style: none;
    font-weight: 600; color: var(--p-pine); line-height: 1.35;
}
.p-sidenav summary::-webkit-details-marker { display: none; }
.p-sidenav summary::after {
    content: ""; flex: none; width: 8px; height: 8px;
    border-right: 2px solid var(--p-teal); border-bottom: 2px solid var(--p-teal);
    transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
.p-sidenav details[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.p-sidenav ul { margin: 0 0 14px; padding: 0; list-style: none; }
.p-sidenav li a {
    display: block; padding: 8px 12px; margin-left: -12px; border-radius: 10px;
    font-size: var(--p-fs-sm); color: var(--p-ink); line-height: 1.4;
}
.p-sidenav li a:hover { background: var(--p-mist); color: var(--p-pine); }
.p-sidenav li a[aria-current] { background: var(--p-mist); color: var(--p-pine); font-weight: 600; }

/* ---------- rich text from the admin editor ---------- */
.p-prose { font-size: var(--p-fs-base); line-height: 1.7; color: var(--p-ink); max-width: 72ch; }
.p-prose--wide { max-width: none; }
.p-prose > *:first-child { margin-top: 0 !important; }
.p-prose > *:last-child { margin-bottom: 0 !important; }
.p-prose h1, .p-prose h2, .p-prose h3, .p-prose h4 {
    margin: 1.8em 0 .6em; color: var(--p-heading); font-family: var(--p-font); line-height: 1.25; letter-spacing: -0.01em;
}
.p-prose h1, .p-prose h2 { font-size: var(--p-fs-lg); font-weight: 500; }
.p-prose h3, .p-prose h4 { color: var(--p-pine); }
.p-prose h3, .p-prose h4 { font-size: var(--p-fs-md); font-weight: 600; }
.p-prose p, .p-prose ul, .p-prose ol, .p-prose table, .p-prose figure { margin: 0 0 1.1em; }
.p-prose ul, .p-prose ol { padding-left: 1.3em; }
.p-prose ul { list-style: disc; }
.p-prose ol { list-style: decimal; }
.p-prose li { margin: .35em 0; padding: 0; }
.p-prose li::before { content: none; }
.p-prose li::marker { color: var(--p-teal); }
.p-prose a { color: var(--p-lagoon); text-decoration: underline; text-underline-offset: 3px; }
.p-prose a:hover { color: var(--p-pine); }
.p-prose strong, .p-prose b { font-weight: 600; }
.p-prose img { max-width: 100%; height: auto !important; border-radius: 16px; }
.p-prose iframe, .p-prose video { max-width: 100%; border-radius: 16px; border: 0; }
.p-prose blockquote {
    width: auto; margin: 1.4em 0; padding: 4px 0 4px 22px;
    border-left: 3px solid var(--p-teal); font: inherit; font-size: var(--p-fs-md); color: var(--p-pine);
}
.p-prose blockquote::before, .p-prose blockquote::after { content: none; }
.p-prose table { width: 100%; border-collapse: collapse; font-size: var(--p-fs-sm); }
.p-prose th, .p-prose td { padding: 10px 12px; border-bottom: 1px solid var(--p-line); text-align: left; vertical-align: top; }
.p-prose th { color: var(--p-pine); font-weight: 600; }
.p-prose hr { border: 0; border-top: 1px solid var(--p-line); margin: 2em 0; }
.p-prose, .p-prose * { font-family: var(--p-font) !important; }
.p-prose [style*="font-size"] { font-size: inherit !important; }
.p-prose [style*="color"]:not(a) { color: inherit !important; }
.p-prose [style*="background"] { background: none !important; }

/* ---------- call-to-action band ---------- */
.p-band {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
    margin: clamp(32px, 4vw, 48px) 0; padding: clamp(24px, 3vw, 36px);
    background: var(--p-mist); border-radius: var(--p-radius-photo);
}
.p-band__text { margin: 0; max-width: 36em; font-size: var(--p-fs-md); font-weight: 500; color: var(--p-pine); line-height: 1.45; }

/* ---------- tabs ---------- */
.p-tabs__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 clamp(28px, 3vw, 40px); padding: 0; list-style: none; }
.p-chip {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
    border-radius: 999px; border: 1px solid var(--p-line); background: var(--p-white);
    font: 500 var(--p-fs-sm)/1.2 var(--p-font); color: var(--p-ink); cursor: pointer;
    transition: background-color .2s, color .2s, border-color .2s;
}
.p-chip:hover { border-color: var(--p-teal); color: var(--p-pine); }
.p-chip[aria-selected="true"], .p-chip[aria-pressed="true"] { background: var(--p-pine); border-color: var(--p-pine); color: var(--p-white); }
.p-tabs__panel[hidden] { display: none; }

/* ---------- filter (specialists) ---------- */
.p-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 clamp(28px, 3vw, 40px); }
.p-filter-select { display: none; }
@media (max-width: 767px) {
    .p-filter { display: none; }
    .p-filter-select { display: block; margin-bottom: 28px; }
}

/* ---------- form controls ---------- */
.p-scope .p-field {
    -webkit-appearance: none; appearance: none;
    width: 100%; min-height: 52px; padding: 12px 18px;
    border: 1px solid var(--p-line); border-radius: var(--p-radius-field); background: var(--p-white);
    font: 400 var(--p-fs-base)/1.3 var(--p-font); color: var(--p-ink);
    transition: border-color .2s, box-shadow .2s;
}
.p-scope .p-field:focus { outline: none; border-color: var(--p-teal); box-shadow: 0 0 0 3px rgba(67, 173, 148, .2); }
.p-scope select.p-field {
    padding-right: 44px; cursor: pointer;
    background: var(--p-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23187761' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 18px center / 12px 8px;
}

/* form rows (label above field, error below) */
.p-formrow { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.p-formrow__label { font-size: var(--p-fs-sm); font-weight: 500; color: var(--p-ink); }
.p-formrow__error { min-height: 0; font-size: var(--p-fs-xs); color: #b3261e; }
.p-formrow__error:empty { display: none; }
.p-scope .p-formrow.has-error .p-field { border-color: #d9776e; }

/* ---------- specialists grid ---------- */
.p-docgrid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: clamp(28px, 3vw, 40px) clamp(16px, 2vw, 28px);
    margin: 0; padding: 0; list-style: none;
}
.p-docgrid > li[hidden] { display: none; }
.p-doc__actions { margin-top: 14px; }
.p-doc__book { font: 600 var(--p-fs-sm)/1.2 var(--p-font); color: var(--p-pine); text-decoration: underline; text-decoration-color: var(--p-mint); text-decoration-thickness: 2px; text-underline-offset: 5px; cursor: pointer; }
.p-doc__book:hover { text-decoration-color: var(--p-teal); }

/* ---------- specialist profile ---------- */
.p-profile { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px clamp(32px, 6vw, 96px); align-items: start; padding: clamp(28px, 4vw, 48px) 0 clamp(40px, 5vw, 64px); }
.p-profile__photo { aspect-ratio: 4 / 5; border-radius: var(--p-radius-photo); overflow: hidden; background: #e4ece9; max-width: 460px; }
.p-profile__photo img { width: 100%; height: 100%; object-fit: cover; }
.p-profile .p-h1 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem); }
.p-profile__meta { display: grid; gap: 6px; margin: 20px 0 28px; padding: 0; list-style: none; color: var(--p-muted); }
.p-profile__meta li:first-child { color: var(--p-pine); font-weight: 600; font-size: var(--p-fs-md); }
.p-profile__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.p-profile .p-crumbs ol { margin-bottom: 20px; }
.p-profile .p-socials a { border-color: var(--p-line); color: var(--p-pine); }
.p-profile .p-socials a:hover { background: var(--p-mist); }
@media (max-width: 899px) {
    .p-profile { grid-template-columns: 1fr; }
    .p-profile__photo { max-width: 360px; order: -1; }
}

.p-schedule { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.p-schedule li { padding: 14px 10px; border-radius: 14px; background: var(--p-white); text-align: center; }
.p-schedule b { display: block; font-weight: 600; color: var(--p-pine); margin-bottom: 4px; }
.p-schedule span { font-size: var(--p-fs-sm); color: var(--p-ink); }
.p-schedule .is-off { background: transparent; border: 1px dashed var(--p-mint); }
.p-schedule .is-off span { color: var(--p-muted); }
@media (max-width: 767px) { .p-schedule { grid-template-columns: repeat(2, 1fr); } }

/* ---------- price list ---------- */
.p-price__search { max-width: 480px; margin-bottom: 32px; }
.p-price__block { margin-bottom: 40px; }
.p-price__block[hidden], .p-price__row[hidden] { display: none; }
.p-price__block .p-h3 { margin-bottom: 8px; }
.p-price__row { display: flex; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--p-line); }
.p-price__name { flex: 1; }
.p-price__value { flex: none; font-weight: 600; color: var(--p-pine); white-space: nowrap; }
.p-price__empty[hidden] { display: none; }

/* ---------- services catalogue ---------- */
.p-catalog { display: grid; gap: clamp(40px, 5vw, 64px); }
.p-catalog__group { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px clamp(32px, 5vw, 80px); padding-top: 28px; border-top: 2px solid var(--p-teal); }
.p-catalog__group .p-prose { color: var(--p-muted); font-size: var(--p-fs-sm); margin-top: 14px; }
.p-catalog__group ul { margin: 0; padding: 0; list-style: none; columns: 2 240px; column-gap: 32px; }
.p-catalog__group li { break-inside: avoid; border-bottom: 1px solid var(--p-line); }
.p-catalog__group li a, .p-catalog__group li span { display: block; padding: 12px 0; color: var(--p-ink); }
.p-catalog__group li a:hover { color: var(--p-pine); }
@media (max-width: 899px) { .p-catalog__group { grid-template-columns: 1fr; } }

/* ---------- articles listing ---------- */
.p-articles--page { row-gap: clamp(36px, 4vw, 56px); }
.p-articles--page > li:first-child { grid-column: span 2; }
.p-articles--page > li:first-child .p-article__img { aspect-ratio: 16 / 9; }
.p-articles--page > li:first-child .p-article__title { font-size: var(--p-fs-lg); }
.p-article__desc { margin: 10px 0 0; font-size: var(--p-fs-sm); color: var(--p-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 899px) { .p-articles--page > li:first-child { grid-column: auto; } }

.p-pager { margin-top: clamp(40px, 5vw, 64px); }
.p-pager ul.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.p-pager li { margin: 0; padding: 0; }
.p-pager li a, .p-pager li span {
    display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px;
    border-radius: 999px; border: 1px solid var(--p-line); background: var(--p-white);
    color: var(--p-ink); font-weight: 500; line-height: 1; width: auto;
}
.p-pager li a:hover { border-color: var(--p-teal); color: var(--p-pine); }
.p-pager li.active a { background: var(--p-pine); border-color: var(--p-pine); color: var(--p-white); }
.p-pager li.disabled { display: none; }

.p-article-page__date { margin: 16px 0 0; color: var(--p-muted); }
.p-article-page__cover { margin: 0 0 clamp(32px, 4vw, 48px); max-width: 960px; border-radius: var(--p-radius-photo); overflow: hidden; }
.p-article-page__cover img { display: block; width: 100%; height: auto; }

/* ---------- subscribe band ---------- */
.p-subscribe { margin-top: clamp(48px, 6vw, 80px); }
.p-subscribe form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; padding: clamp(24px, 3vw, 40px); background: var(--p-mist); border-radius: var(--p-radius-photo); margin: 0; }
.p-subscribe__title { flex: 1 1 320px; margin: 0; font-size: var(--p-fs-md); font-weight: 500; color: var(--p-pine); line-height: 1.45; }
.p-subscribe__row { flex: 1 1 380px; display: flex; gap: 10px; align-items: flex-start; }
.p-subscribe .form-group { flex: 1; margin: 0; }
.p-subscribe .help-block, .p-subscribe .error-text { position: static; opacity: 1; display: block; margin-top: 6px; font-size: var(--p-fs-xs); color: #b3261e; }
@media (max-width: 599px) { .p-subscribe__row { flex-direction: column; align-items: stretch; } }

/* ---------- reviews page ---------- */
.p-reviewlist { columns: 2 380px; column-gap: clamp(24px, 3vw, 48px); margin: 0; padding: 0; list-style: none; }
.p-reviewlist > li { break-inside: avoid; margin: 0 0 clamp(24px, 3vw, 40px); padding: clamp(24px, 3vw, 32px); background: var(--p-mist); border-radius: var(--p-radius-photo); }
.p-reviewlist img { display: block; width: 100%; height: auto; border-radius: 16px; margin-bottom: 18px; }
.p-reviewlist .p-review__author { margin-top: 16px; }
.p-reviewlist time { display: block; margin-bottom: 10px; font-size: var(--p-fs-sm); color: var(--p-muted); }
.p-reviewlist p { margin: 0; line-height: 1.65; }

/* ---------- contacts page ---------- */
.p-contacts { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px clamp(32px, 5vw, 80px); align-items: stretch; }
.p-contacts dl { display: grid; gap: 22px; margin: 0; align-content: start; }
.p-contacts dt { font-size: var(--p-fs-sm); color: var(--p-muted); margin-bottom: 4px; }
.p-contacts dd { margin: 0; }
.p-contacts dd a { color: var(--p-pine); font-weight: 600; font-size: var(--p-fs-md); }
.p-contacts dd small { display: block; color: var(--p-muted); font-size: var(--p-fs-sm); }
.p-contacts__hours p { display: flex; gap: 10px; margin: 0; }
.p-map { position: relative; min-height: 420px; border-radius: var(--p-radius-photo); overflow: hidden; background: var(--p-mist); }
.p-map .map { position: absolute; inset: 0; }
@media (max-width: 899px) { .p-contacts { grid-template-columns: 1fr; } }

.p-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.p-gallery a { display: block; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: var(--p-mist); }
.p-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.p-gallery a:hover img { transform: scale(1.04); }
.p-gallery figcaption { margin-top: 8px; font-size: var(--p-fs-sm); color: var(--p-muted); }

.p-split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px clamp(32px, 5vw, 80px); align-items: start; }
@media (max-width: 899px) { .p-split { grid-template-columns: 1fr; } }
.p-split--single { grid-template-columns: minmax(0, 560px); }
.p-split--single > div:first-child { display: none; }
.p-card-form { padding: clamp(24px, 3vw, 40px); background: var(--p-mist); border-radius: var(--p-radius-photo); }
.p-card-form .p-h3 { margin-bottom: 18px; }

/* ---------- statistics (pregnancy rates) ---------- */
.p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; margin: clamp(32px, 4vw, 56px) 0; padding: clamp(24px, 3vw, 40px); background: var(--p-pine); border-radius: var(--p-radius-photo); color: var(--p-white); }
.p-stats__title { grid-column: 1 / -1; margin: 0; font-size: var(--p-fs-md); font-weight: 500; color: var(--p-mint); }
.p-stats__value { display: block; font-size: clamp(2.25rem, 1.6rem + 2vw, 3.25rem); font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.p-stats__value small { font-size: .45em; margin-left: 4px; letter-spacing: 0; }
.p-stats__label { display: block; margin-top: 10px; color: rgba(255, 255, 255, .82); font-size: var(--p-fs-sm); }

/* ---------- donors ---------- */
.p-donors { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2vw, 28px); margin: 0; padding: 0; list-style: none; }
.p-donors > li { display: flex; flex-direction: column; gap: 14px; padding: clamp(24px, 3vw, 32px); border-radius: var(--p-radius-photo); background: var(--p-mist); }
.p-donors .p-h3 { margin: 0; }
.p-donors__text { flex: 1; margin: 0; color: var(--p-muted); }
.p-donors .p-btn { width: 100%; white-space: normal; text-align: center; }
@media (max-width: 899px) { .p-donors { grid-template-columns: 1fr; } }

/* ---------- contact band above the footer ---------- */
.p-contactband { padding: clamp(48px, 6vw, 80px) 0; background: var(--p-mist); }
.p-contactband__inner { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px clamp(32px, 6vw, 96px); align-items: center; }
.p-contactband__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.p-contactband__list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; color: var(--p-muted); }
.p-contactband__list a { color: var(--p-pine); }
.p-contactband__tel { display: block; font-size: var(--p-fs-md); font-weight: 600; }
@media (max-width: 899px) { .p-contactband__inner { grid-template-columns: 1fr; } }

/* certificates: portrait documents shown whole */
.p-gallery--docs a { aspect-ratio: 3 / 4; background: var(--p-mist); }
.p-gallery--docs img { object-fit: contain; padding: 10px; }

/* ---------- patient page: legacy step blocks with forms ---------- */
.p-patient > *:not(.patient-step-wrapper) { max-width: 72ch; line-height: 1.7; }
.p-patient .patient-step-wrapper { margin-top: clamp(32px, 4vw, 48px); }
.p-patient .patient-step-title { margin: 0 0 20px; font-size: var(--p-fs-lg); font-weight: 500; color: var(--p-heading); background: none; -webkit-text-fill-color: currentColor; }
.p-patient .patient-step-block {
    position: relative; margin: 0 0 16px; padding: clamp(24px, 3vw, 32px) clamp(24px, 3vw, 32px) clamp(24px, 3vw, 32px) 88px;
    background: var(--p-mist); border-radius: var(--p-radius-photo);
}
.p-patient .patient-step {
    position: absolute; left: 28px; top: 28px; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center; background: var(--p-teal); color: var(--p-white); font-weight: 600;
}
.p-patient .patient-step span { color: inherit; font-size: var(--p-fs-sm); }
.p-patient .patient-block-title { margin: 6px 0 14px; font-size: var(--p-fs-md); font-weight: 600; color: var(--p-pine); }
.p-patient .blockquote { width: auto; padding: 0; margin: 0 0 16px; font-size: var(--p-fs-base); color: var(--p-muted); }
.p-patient .blockquote::before { content: none; }
.p-patient .input-line { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; }
.p-patient .input-field { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.p-patient .input-field .label, .p-patient .input-field label {
    order: -1; position: static !important; transform: none !important; top: auto !important;
    font-size: var(--p-fs-sm) !important; font-weight: 500; color: var(--p-ink) !important;
}
.p-patient :is(input[type="text"], input[type="tel"], select, textarea) {
    width: 100%; min-height: 52px; padding: 12px 16px !important;
    border: 1px solid var(--p-line) !important; border-radius: var(--p-radius-field);
    background: var(--p-white); font: 400 var(--p-fs-base)/1.3 var(--p-font); color: var(--p-ink);
}
.p-patient :is(.error-text, .help-block) { position: static; opacity: 1; margin: 0; font-size: var(--p-fs-xs); color: #b3261e; }
.p-patient .button-wrapper { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.p-patient .button { min-width: 0; padding: 0 8px; }
.p-patient .button-black { background: transparent !important; border: 2px solid var(--p-pine) !important; color: var(--p-pine) !important; }
@media (max-width: 599px) {
    .p-patient .patient-step-block { padding-left: 24px; padding-top: 84px; }
}

/* ==========================================================================
   Legacy reskin — pages that keep their old markup take the new type,
   colours and controls.
   ========================================================================== */
.wrapper, .fancybox-container { font-family: var(--p-font); }
.wrapper :where(.inner-page-title, .section-title, .title, [class*="-title"], .button, .button .text, blockquote, .breadcrumbs-list, .content-block, p, li, a, span, div, input, select, textarea, label),
.fancybox-container :where(.popup-title, .popup-text, .button, .button .text, input, select, textarea, label, p, div, span, a) {
    font-family: var(--p-font) !important;
}
.wrapper .inner-page-title, .wrapper .section-title {
    color: var(--p-heading); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1;
    background: none; -webkit-text-fill-color: currentColor;
}
.wrapper .button { min-height: 52px; height: auto; border-radius: 999px; font-weight: 600; }
.wrapper .button .text, .fancybox-container .button .text { text-transform: none; letter-spacing: .01em; }
.wrapper .button-green, .fancybox-container .button-green { background: var(--p-pine); border-color: var(--p-pine); color: var(--p-white); }
.wrapper .button-green:hover, .fancybox-container .button-green:hover { background: var(--p-pine-deep); }
.wrapper .button-green-simple, .fancybox-container .button-green-simple {
    background: var(--p-pine) !important; border: 2px solid var(--p-pine) !important; color: var(--p-white) !important;
}
.wrapper .button-green-simple:hover, .fancybox-container .button-green-simple:hover { background: var(--p-pine-deep) !important; }
.wrapper .breadcrumbs-list a { color: var(--p-muted); }
.wrapper .content-block { color: var(--p-ink); line-height: 1.7; }
.wrapper .content-block a { color: var(--p-lagoon); }

/* ---------- popups (fancybox) ---------- */
.fancybox-container .fancybox-bg { background: rgba(15, 50, 42, .55); }
.fancybox-container.fancybox-is-open .fancybox-bg { opacity: 1; }
.fancybox-container .fancybox-content.simple-popup {
    width: min(520px, calc(100vw - 32px)); max-width: none; padding: clamp(28px, 4vw, 44px);
    border-radius: var(--p-radius-photo); background: var(--p-white);
    box-shadow: 0 30px 80px -30px rgba(15, 50, 42, .5);
}
.fancybox-container .simple-popup .popup-title {
    margin: 0 48px 10px 0; font-size: var(--p-fs-lg); font-weight: 500; line-height: 1.2; letter-spacing: -0.015em;
    color: var(--p-pine); background: none; -webkit-text-fill-color: currentColor; text-align: left;
}
.fancybox-container .simple-popup .popup-text { margin: 0 0 20px; color: var(--p-muted); font-size: var(--p-fs-sm); line-height: 1.55; text-align: left; }
.fancybox-container .simple-popup .close-popup-button {
    position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; background: var(--p-mist); z-index: 2;
}
.fancybox-container .simple-popup .close-popup-button .icon { display: grid; place-items: center; width: 18px; height: 18px; margin: 0; }
.fancybox-container .simple-popup .close-popup-button svg { width: 25px; height: 25px; flex: none; transform: scale(.72); }
.fancybox-container .simple-popup .close-popup-button path { fill: var(--p-pine); }
.fancybox-container .simple-popup .fancybox-close-small { display: none; }
.fancybox-container .simple-popup .input-line { display: block; margin: 0; }
.fancybox-container .simple-popup .input-field {
    display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px;
}
.fancybox-container .simple-popup .input-field .label, .fancybox-container .simple-popup .input-field label {
    order: -1; position: static !important; transform: none !important; top: auto !important; left: auto !important;
    font-size: var(--p-fs-sm) !important; font-weight: 500; color: var(--p-ink) !important; pointer-events: auto;
}
.fancybox-container .simple-popup :is(input[type="text"], input[type="tel"], input[type="email"], select, textarea) {
    width: 100%; min-height: 52px; padding: 12px 16px !important;
    border: 1px solid var(--p-line) !important; border-radius: var(--p-radius-field);
    background: var(--p-white); font: 400 var(--p-fs-base)/1.3 var(--p-font); color: var(--p-ink);
}
.fancybox-container .simple-popup textarea { min-height: 120px; resize: vertical; }
.fancybox-container .simple-popup :is(input, select, textarea):focus {
    outline: none; border-color: var(--p-teal) !important; box-shadow: 0 0 0 3px rgba(67, 173, 148, .2);
}
.fancybox-container .simple-popup :is(.error-text, .help-block) {
    position: static; opacity: 1; margin: 0; font-size: var(--p-fs-xs); color: #b3261e;
}
.fancybox-container .simple-popup .has-error :is(input, select, textarea) { border-color: #d9776e !important; }
.fancybox-container .simple-popup .button-wrapper { margin-top: 8px; }
.fancybox-container .simple-popup .button { width: 100%; min-height: 52px; }

/* never let long words push a grid column wider than the screen */
.p-layout > *, .p-split > *, .p-contacts > *, .p-catalog__group > *, .p-profile > * { min-width: 0; }
.p-sidenav li a, .p-prose { overflow-wrap: break-word; }

/* wide tables from the editor scroll sideways instead of widening the page */
.p-prose table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.p-stats { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.p-tabs__panel { min-width: 0; max-width: 100%; }

/* ==========================================================================
   Academy (МАР)
   ========================================================================== */
.p-academy__intro { padding-bottom: clamp(48px, 6vw, 88px); }
.p-academy__regalia { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.p-academy__courses--tight { padding-top: 0; }
.p-academy__after-band { padding-top: 0; }
[id="courses"], .p-course { scroll-margin-top: calc(var(--p-header-h) + 24px); }

.p-courses { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.p-courses > li[hidden] { display: none; }
.p-course {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) auto;
    gap: 20px clamp(24px, 3vw, 48px);
    align-items: start;
    padding: clamp(22px, 2.5vw, 32px);
    border: 1px solid var(--p-line);
    border-radius: var(--p-radius-photo);
    background: var(--p-white);
    transition: border-color .2s;
}
.p-course:target { border-color: var(--p-teal); box-shadow: 0 0 0 3px rgba(67, 173, 148, .2); }
.p-course__cat { margin: 0 0 6px; font-size: var(--p-fs-sm); color: var(--p-teal); font-weight: 600; }
.p-course__title { margin: 0; font-size: var(--p-fs-md); font-weight: 600; line-height: 1.35; color: var(--p-pine); }
.p-course__teacher { margin: 12px 0 0; font-size: var(--p-fs-sm); color: var(--p-muted); }
.p-course__teacher a { color: var(--p-pine); font-weight: 500; text-decoration: underline; text-decoration-color: var(--p-mint); text-underline-offset: 3px; }
.p-course__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin: 0; }
.p-course__facts dt { font-size: var(--p-fs-xs); color: var(--p-muted); }
.p-course__facts dd { margin: 2px 0 0; font-size: var(--p-fs-sm); line-height: 1.45; }
.p-course__wide { grid-column: 1 / -1; }
.p-course__buy { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.p-course__price { margin: 0; font-size: var(--p-fs-lg); font-weight: 600; color: var(--p-pine); white-space: nowrap; letter-spacing: -0.01em; }
@media (max-width: 1023px) {
    .p-course { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .p-course__buy { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 599px) {
    .p-course { grid-template-columns: minmax(0, 1fr); }
    .p-course__buy { flex-wrap: wrap; }
}

.p-academy__band { padding: clamp(28px, 4vw, 56px); background: var(--p-pine); border-radius: var(--p-radius-photo); }
.p-academy__band .p-prose { color: rgba(255, 255, 255, .9); }
.p-academy__band .p-prose :is(h1, h2, h3, h4, strong, b, a) { color: var(--p-white) !important; }
.p-academy__band .p-prose li::marker { color: var(--p-mint); }
.p-academy__band .p-prose blockquote { border-color: var(--p-mint); color: var(--p-white); }

.p-academy__gallery { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }

.p-partners { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.p-partners li > * { display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 20px; border-radius: 18px; background: var(--p-white); }
.p-partners li > * { overflow: hidden; }
.p-partners img { max-width: 100%; max-height: 96px; object-fit: contain; }
.p-partners a:hover { box-shadow: inset 0 0 0 2px var(--p-teal); }

/* ==========================================================================
   Error page
   ========================================================================== */
.p-errorpage { padding: clamp(56px, 9vw, 120px) 0 clamp(72px, 10vw, 140px); }
.p-scope .p-errorpage__code {
    margin: 0 0 8px; font-size: clamp(5rem, 3rem + 10vw, 11rem); font-weight: 600; line-height: .9;
    letter-spacing: -0.04em; color: var(--p-mint);
}
.p-errorpage__title { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem); }
.p-errorpage .p-lead { margin: 18px 0 32px; }
.p-errorpage__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.p-errorpage__links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 40px 0 0; padding: 28px 0 0; list-style: none; border-top: 1px solid var(--p-line); max-width: 720px; }

/* ==========================================================================
   School: lesson schedule
   ========================================================================== */
.p-lessons { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.p-lessons > li[hidden] { display: none; }
.p-lesson {
    display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 16px 28px; align-items: center;
    padding: 18px 24px; border: 1px solid var(--p-line); border-radius: 20px; background: var(--p-white);
}
.p-lesson__date { display: grid; margin: 0; line-height: 1.2; color: var(--p-muted); font-size: var(--p-fs-sm); }
.p-lesson__date b { font-size: 2rem; font-weight: 600; color: var(--p-pine); letter-spacing: -0.02em; }
.p-lesson__who { display: flex; align-items: center; gap: 16px; }
.p-lesson__who img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: top; background: #e4ece9; flex: none; }
.p-lesson__name { margin: 0; font-weight: 600; color: var(--p-pine); }
.p-lesson__role { margin: 2px 0 0; font-size: var(--p-fs-sm); color: var(--p-muted); }
@media (max-width: 599px) {
    .p-lesson { grid-template-columns: 80px minmax(0, 1fr); }
    .p-lesson .p-btn { grid-column: 1 / -1; }
    .p-lesson__who img { width: 48px; height: 48px; }
}

/* ==========================================================================
   Sitemap
   ========================================================================== */
.p-sitemap { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 40px clamp(24px, 4vw, 56px); }
.p-sitemap section { border-top: 2px solid var(--p-teal); padding-top: 20px; }
.p-sitemap .p-h3 { margin-bottom: 12px; }
.p-sitemap ul { margin: 0; padding: 0; list-style: none; }
.p-sitemap li a, .p-sitemap li span { display: block; padding: 7px 0; color: var(--p-ink); font-size: var(--p-fs-sm); line-height: 1.4; }
.p-sitemap li a:hover { color: var(--p-pine); text-decoration: underline; text-decoration-color: var(--p-mint); }
.p-sitemap__wide { grid-column: 1 / -1; }
.p-sitemap__cols { columns: 4 220px; column-gap: 32px; }
.p-sitemap__cols li { break-inside: avoid; }

/* ==========================================================================
   Search popup
   ========================================================================== */
.fancybox-container .fancybox-content.p-search { width: min(640px, calc(100vw - 32px)); }
.p-search__form { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.p-search__field { flex: 1; margin: 0; }
.p-search__results { margin-top: 24px; max-height: min(60vh, 520px); overflow-y: auto; }
.p-search__results ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--p-line); }
.p-search__results li a { display: block; padding: 14px 4px; border-bottom: 1px solid var(--p-line); color: var(--p-ink); }
.p-search__results li a:hover { background: var(--p-mist); }
.p-search__type { display: block; font-size: var(--p-fs-xs); color: var(--p-teal); font-weight: 600; margin-bottom: 2px; }
.p-search__title { font-weight: 500; color: var(--p-pine); }
@media (max-width: 479px) { .p-search__form { flex-direction: column; align-items: stretch; } }

/* admin texts may end with floated images: keep them inside the text block so the next block starts below */
.p-prose { display: flow-root; }

/* ==========================================================================
   Sectioned text page (Science): intro card, table of contents, numbered sections, documents
   ========================================================================== */
.p-science__intro {
    position: relative; overflow: hidden;
    margin: 0 0 clamp(40px, 5vw, 72px); padding: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 56px);
    background: var(--p-mist); border-radius: var(--p-radius-photo);
    font-size: var(--p-fs-md); line-height: 1.5;
}
.p-science__intro::before {
    content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
    border-radius: 50%; border: 1px solid var(--p-mint); pointer-events: none;
}
.p-science__intro p:first-child { font-size: clamp(1.25rem, 1rem + .8vw, 1.625rem); line-height: 1.4; color: var(--p-pine); max-width: 60ch; }
.p-science__intro p:first-child strong { font-weight: 600; }
.p-science__intro p + p {
    margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--p-mint);
    font-size: var(--p-fs-base); color: var(--p-muted); max-width: 72ch;
}
.p-science__intro p + p strong { color: var(--p-ink); }

.p-science__layout { grid-template-columns: 280px minmax(0, 1fr); }
.p-science__toc { border-top: 2px solid var(--p-teal); padding-top: 18px; }
.p-science__toc-title { margin: 0 0 10px; font-size: var(--p-fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--p-muted); }
.p-science__toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.p-science__toc li { counter-increment: toc; }
.p-science__toc a {
    display: flex; gap: 12px; padding: 9px 12px; margin-left: -12px; border-radius: 10px;
    font-size: var(--p-fs-sm); line-height: 1.4; color: var(--p-ink);
}
.p-science__toc a::before { content: counter(toc, decimal-leading-zero); flex: none; color: var(--p-teal); font-weight: 600; font-variant-numeric: tabular-nums; }
.p-science__toc a:hover, .p-science__toc a[aria-current] { background: var(--p-mist); color: var(--p-pine); }

.p-science__section { padding: clamp(28px, 3vw, 40px) 0; border-top: 1px solid var(--p-line); scroll-margin-top: calc(var(--p-header-h) + 24px); }
.p-science__section:first-child { padding-top: 0; border-top: 0; }
.p-science__label {
    display: flex; align-items: baseline; gap: 14px; margin: 0 0 20px;
    font-size: var(--p-fs-lg); font-weight: 500; line-height: 1.25; color: var(--p-heading);
}
.p-science__num { flex: none; font-size: var(--p-fs-sm); font-weight: 600; color: var(--p-pine); font-variant-numeric: tabular-nums; }
.p-science__body { max-width: 78ch; }
.p-science__body p, .p-science__docs p { text-align: left !important; }
.p-science__body h3 { margin: 1.6em 0 .5em; font-size: var(--p-fs-md); color: var(--p-pine); }
/* research team: one card per person */
.p-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.p-person { padding: 18px 20px; border: 1px solid var(--p-line); border-radius: var(--p-radius-field); background: var(--p-white); font-size: var(--p-fs-sm); line-height: 1.5; }
.p-person h3 { margin: 0 0 10px !important; font-size: var(--p-fs-base) !important; font-weight: 600; color: var(--p-pine); }
.p-person p { margin: 0 0 4px; color: var(--p-muted); }
.p-person p:last-child { margin-bottom: 0; }
.p-person a { overflow-wrap: anywhere; }
.p-science__body ol li, .p-science__body ul li { margin: .6em 0; }
.p-science__body a { overflow-wrap: anywhere; }
/* photos placed in a row */
.p-science__body p:has(> img) { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.p-science__body p:has(> img) br { display: none; }
.p-science__body img { float: none !important; width: 100% !important; margin: 0; aspect-ratio: 16 / 9; object-fit: cover; }

/* documents: every link becomes a file card */
.p-science__docs p { display: grid; gap: 12px; margin: 0 0 12px; }
.p-science__docs br { display: none; }
.p-science__docs a {
    display: flex; align-items: center; gap: 16px; padding: 16px 20px;
    border: 1px solid var(--p-line); border-radius: var(--p-radius-field); background: var(--p-white);
    color: var(--p-ink); text-decoration: none; font-weight: 500; line-height: 1.35;
    transition: border-color .2s, background-color .2s;
}
.p-science__docs a::before {
    content: "PDF"; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
    background: var(--p-mist); color: var(--p-pine); font-size: var(--p-fs-xs); font-weight: 700; letter-spacing: .04em;
}
.p-science__docs a:not([href$=".pdf" i])::before { content: "↗"; font-size: var(--p-fs-md); }
.p-science__docs a::after { content: ""; margin-left: auto; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--p-teal); border-top: 2px solid var(--p-teal); transform: rotate(45deg); }
.p-science__docs a:hover { border-color: var(--p-teal); background: var(--p-mist); color: var(--p-pine); }

@media (max-width: 1023px) {
    .p-science__layout { grid-template-columns: minmax(0, 1fr); }
    .p-science__toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); column-gap: 16px; }
}
@media (max-width: 599px) {
    .p-science__intro::before { display: none; }
    .p-science__toc { display: none; }
}
