/* Bounded polish for the original NIC.RU site. No content/theme replacement. */
/* The old grid-wide translucent panel ended halfway through the last bios. */
main .relative.isolate:has(> .grid a[href^="/trenery/profile/"]) > div[aria-hidden="true"] { display: none; }
/* Preserve every portrait and crop; give its name a separate, quiet baseline. */
main a[href^="/trenery/profile/"] > div:first-child { background: transparent; overflow: visible; border-radius: 0; }
main a[href^="/trenery/profile/"] > div:first-child > div:first-child { border-radius: 1rem; }
main a[href^="/trenery/profile/"] > div:first-child > div:has(> h3) {
  position: static; background: transparent; color: var(--title, #222);
  padding: 1.125rem 0 0; align-items: center;
}
main a[href^="/trenery/profile/"] h3 { font-size: 1.125rem; line-height: 1.35; overflow-wrap: anywhere; }
main a[href^="/trenery/profile/"] h3 span + span { color: var(--muted, #667085); line-height: 1.5; }
main a[href^="/trenery/profile/"] h3 + svg { color: var(--brand, #3d78b9); }
main a[href^="/trenery/profile/"] > p { line-height: 1.65; }
/* Shared public typography: retain Unbounded/Golos, improve long Russian wraps. */
main :is(h1,h2,h3) { text-wrap: balance; overflow-wrap: anywhere; }
main .page-title { line-height: 1.15; letter-spacing: -.03em; }
main :is(p,li) { text-wrap: pretty; }
main :is(input,select,textarea) { font-size: 1rem; }
@media(max-width: 639px) {
  main .page-title { font-size: clamp(1.75rem, 6.8vw, 2.25rem); }
  main :is(.page-shell,.seamless-dark) h1:not(.page-title) { font-size: clamp(1.75rem, 7.5vw, 2.5rem); line-height: 1.2; }
  main h2 { line-height: 1.25; }
}
/* Shared gymnastics vocabulary. CSS backgrounds are decorative, noninteractive
   and absent from the accessibility tree. Original brand blue/pink only. */
:root {
  --gym-rings: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round'%3E%3Cpath d='M42 12V82M118 12V82'/%3E%3Cellipse cx='42' cy='116' rx='26' ry='34'/%3E%3Cellipse cx='118' cy='116' rx='26' ry='34'/%3E%3Cpath stroke='%23df57a9' d='M57 168H103'/%3E%3C/svg%3E");
  --gym-ribbon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%23df57a9' stroke-width='2.8' stroke-linecap='round'%3E%3Cpath d='M20 36C100-8 160 52 118 82C82 108 29 64 66 52C115 36 154 130 95 143C52 152 26 126 45 111C69 92 110 137 85 166'/%3E%3Cpath stroke='%233d78b9' d='M17 21L34 8'/%3E%3C/svg%3E");
  --gym-ball: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round'%3E%3Ccircle cx='80' cy='92' r='43'/%3E%3Cpath d='M57 70C67 58 84 55 98 62'/%3E%3Cpath stroke='%23df57a9' d='M14 120C6 70 34 22 78 15M24 146C56 166 104 160 140 128'/%3E%3Ccircle fill='%23df57a9' stroke='none' cx='139' cy='41' r='4'/%3E%3C/svg%3E");
  --gym-bars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 64H136M24 94H136M38 64V148M122 64V148M48 94V158M132 94V158M27 148H49M111 148H133M37 158H59M121 158H143'/%3E%3Cpath stroke='%23df57a9' d='M51 44C72 17 101 22 117 40'/%3E%3C/svg%3E");
  --gym-clubs: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='rotate(-24 80 90)'%3E%3Ccircle cx='61' cy='22' r='6'/%3E%3Cpath d='M59 28V92C45 106 46 137 61 145C76 137 77 106 63 92V28'/%3E%3C/g%3E%3Cg stroke='%23df57a9' transform='rotate(24 80 90)'%3E%3Ccircle cx='99' cy='22' r='6'/%3E%3Cpath d='M97 28V92C83 106 84 137 99 145C114 137 115 106 101 92V28'/%3E%3C/g%3E%3C/svg%3E");
  --gym-floor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 40V148H137M38 40V132H137'/%3E%3Cpath stroke='%23df57a9' d='M59 108C59 65 116 65 116 26M104 37L116 25L127 38'/%3E%3Ccircle stroke='%23df57a9' cx='60' cy='108' r='5'/%3E%3C/svg%3E");
  --gym-motion: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 180' fill='none' stroke='%233d78b9' stroke-width='2.8' stroke-linecap='round'%3E%3Cpath d='M24 128C24 55 77 21 137 45M40 129C40 77 83 45 129 61'/%3E%3Cpath stroke='%23df57a9' d='M61 131C61 98 85 76 116 79'/%3E%3Ccircle stroke='%23df57a9' cx='130' cy='120' r='13'/%3E%3C/svg%3E");
}

/* Two motifs per section, alternating vocabulary instead of repeating a logo.
   Keep the photographic hero and legal copy free of new decoration. */
main > section:has(h2), main > .page-shell, main > .seamless-dark, footer {
  position: relative; isolation: isolate;
  --gym-left: var(--gym-ribbon); --gym-right: var(--gym-rings);
}
main > section:nth-of-type(2) { --gym-left: var(--gym-ball); --gym-right: var(--gym-floor); }
main #programs { --gym-left: var(--gym-clubs); --gym-right: var(--gym-ribbon); }
main #coaches { --gym-left: var(--gym-rings); --gym-right: var(--gym-bars); }
main #gallery { --gym-left: var(--gym-ball); --gym-right: var(--gym-motion); }
main > section:nth-of-type(6) { --gym-left: var(--gym-floor); --gym-right: var(--gym-clubs); }
main #contacts { --gym-left: var(--gym-motion); --gym-right: var(--gym-ball); }
main #reviews { --gym-left: var(--gym-ribbon); --gym-right: var(--gym-clubs); }
main > .page-shell:has(a[href^="/programmy/"]) { --gym-left: var(--gym-clubs); --gym-right: var(--gym-ribbon); }
main > .page-shell:has(a[href^="/trenery/profile/"]) { --gym-left: var(--gym-rings); --gym-right: var(--gym-bars); }
main > .page-shell:has(iframe) { --gym-left: var(--gym-motion); --gym-right: var(--gym-ball); }
main > .page-shell:has(button[aria-pressed]) { --gym-left: var(--gym-floor); --gym-right: var(--gym-clubs); }
main > .page-shell:has(video) { --gym-left: var(--gym-ball); --gym-right: var(--gym-motion); }
footer { --gym-left: var(--gym-floor); --gym-right: var(--gym-ribbon); }

:is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::before,
:is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::after {
  content: ""; display: block; position: absolute; pointer-events: none;
  width: clamp(56px, calc((100vw - 1200px) / 2), 180px); height: 200px;
  z-index: -1; opacity: .78;
  background-repeat: no-repeat; background-position: center; background-size: contain;
}
:is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::before {
  top: 76px; left: 8px; background-image: var(--gym-left);
}
:is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::after {
  bottom: 48px; right: 8px; background-image: var(--gym-right);
}
main > :is(.page-shell,.seamless-dark)::before { top: 160px; }
main > .seamless-dark::before { top: auto; bottom: 48px; }
:is(main > section.bg-brand, main > .seamless-dark, footer)::before,
:is(main > section.bg-brand, main > .seamless-dark, footer)::after {
  filter: brightness(0) invert(1); opacity: .65;
}
/* Narrow layouts use the existing section padding, not the reading column.
   Shorter motifs remain visible without stealing space from portraits. */
@media(max-width: 1439px) {
  :is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::before,
  :is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::after {
    width: 88px; height: 48px; opacity: .86; transform: none;
  }
  :is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::before {
    top: 8px; left: 16px; background-position: left center;
  }
  :is(main > section:has(h2), main > .page-shell, main > .seamless-dark, footer)::after {
    top: 8px; bottom: auto; right: 16px; background-position: right center;
  }
  main > .page-shell { padding-top: 10rem; }
  main > .page-shell::before, main > .page-shell::after { top: 96px; height: 52px; }
  main > .seamless-dark::before, main > .seamless-dark::after { top: auto; bottom: 12px; }
  footer::before, footer::after { top: 6px; height: 36px; }
}
@media(min-width: 1440px) {
  main > section.bg-brand::before, main > section.bg-brand::after,
  footer::before, footer::after { height: 140px; }
}
