/*
 * Scoped styling for the optional Home Sections layout.
 * Reuses existing #НОКТИ palette and Bootstrap utilities without htn-title on h2/h3.
 * Does not alter the active "home" layout or inner pages.
 */
.htn-home-sections {
  width: 100%;
}

.htn-home-sections__hero .htn-home--intro {
  margin: 0;
}

.htn-home-sections__block {
  position: relative;
  width: 100%;
  scroll-margin-top: 7rem;
}

.htn-home-sections__block > .container {
  max-width: 1320px;
}

.htn-home-sections__block h2 {
  margin-inline: auto;
  max-width: 850px;
  line-height: 1.3;
}

.htn-home-sections__block img {
  max-width: 100%;
  height: auto;
}

.htn-home-sections__block .card {
  height: 100%;
}

.htn-home-sections__block .row {
  --bs-gutter-y: 1.5rem;
}

@media (max-width: 767.98px) {
  .htn-home-sections__block {
    scroll-margin-top: 5rem;
  }

  .htn-home-sections__block h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .htn-home-sections * {
    scroll-behavior: auto !important;
  }
}

/* Restore the former Services / Courses homepage backgrounds from existing
 * Theme Preferences. Rendered as decorative <img> elements by theme shortcodes.
 * They cover the full section while the cards remain fully readable.
 * The rules are intentionally scoped to the optional home_sections layout.
 */
#home-services,
#home-courses {
  isolation: isolate;
}

#home-services > .htn-home-sections__collection-backdrop,
#home-courses > .htn-home-sections__collection-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#home-services > .htn-home-sections__collection-backdrop > img,
#home-courses > .htn-home-sections__collection-backdrop > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

#home-services > .htn-home-sections__collection-backdrop::after,
#home-courses > .htn-home-sections__collection-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* The original Services section used a dark photo treatment. */
#home-services > .htn-home-sections__collection-backdrop::after {
  background: rgba(0, 0, 0, .65);
}

/* The original Courses section used a translucent white foreground. */
#home-courses > .htn-home-sections__collection-backdrop::after {
  background: rgba(255, 255, 255, .75);
}

#home-services > .container,
#home-courses > .container {
  position: relative;
  z-index: 1;
}

/* Only recolor the headline if a background image is actually configured. */
#home-services > .htn-home-sections__collection-backdrop ~ .container > h2 {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

/* Services + Courses homepage cards. Existing brand colors come from theme CSS. */
.htn-home-sections__cards .htn-home-sections__card {
  overflow: hidden;
  border: 1px solid var(--bs-border-color, #e5e5e5);
  border-radius: var(--htn-card-radius, .75rem);
  transition: transform .2s ease, border-color .2s ease;
}

.htn-home-sections__cards .htn-home-sections__card:hover {
  transform: translateY(-3px);
  border-color: var(--bs-primary, #333);
}

.htn-home-sections__card-link {
  color: inherit;
}

.htn-home-sections__card-link:focus-visible {
  outline: 3px solid var(--bs-primary, currentColor);
  outline-offset: -3px;
}

.htn-home-sections__card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.htn-home-sections__card-media img {
  display: block;
  object-fit: cover;
  transition: transform .25s ease;
}

.htn-home-sections__card-link:hover .htn-home-sections__card-media img {
  transform: scale(1.025);
}

.htn-home-sections__card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(0,0,0,.06));
}

.htn-home-sections__card-body {
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.htn-home-sections__card-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.6;
}

.htn-home-sections__card-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__card-more,
.htn-home-sections__card-price {
  color: var(--bs-primary, inherit);
}

@media (prefers-reduced-motion: reduce) {
  .htn-home-sections__cards .htn-home-sections__card,
  .htn-home-sections__card-media img {
    transition: none;
  }

  .htn-home-sections__cards .htn-home-sections__card:hover,
  .htn-home-sections__card-link:hover .htn-home-sections__card-media img {
    transform: none;
  }
}

/* Team portrait cards (Student module styles remain available off-homepage). */
.htn-home-sections__person,
.htn-home-sections__review {
  border: 1px solid var(--bs-border-color, #e5e5e5);
  box-shadow: none;
}

.htn-home-sections__person-photo {
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.htn-home-sections__person-photo img {
  display: block;
  object-fit: cover;
  transition: transform .25s ease;
}

.htn-home-sections__person-link:hover img {
  transform: scale(1.025);
}

.htn-home-sections__person-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(140deg, rgba(255,255,255,.22), rgba(0,0,0,.05));
}

.htn-home-sections__person-role {
  color: var(--bs-secondary-color, #6c757d);
}

.htn-home-sections__person-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.htn-home-sections__person-more,
.htn-home-sections__review-rating {
  color: var(--bs-primary, inherit);
}

.htn-home-sections__review-rating {
  font-size: 1.35rem;
  letter-spacing: .12em;
}

.htn-home-sections__review-quote {
  flex: 1 1 auto;
  font-size: 1.025rem;
  line-height: 1.7;
}

/* Images come from the Theme Preferences-selected eGallery album.
 * Six images fit on one desktop row (>=992px); mobile/tablet use two per
 * row (three rows for six images). Keep the 8/4 Gallery/Updates layout.
 * Adjacent photos are flush with square corners; other eGallery views are unaffected.
 */
#home-gallery .egallery-menu-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  margin: 0 0 1.25rem;
}

#home-gallery .egallery-menu-images > .htn-gallery--portfolio__item {
  width: auto;
  max-width: none;
  min-width: 0;
  padding: 0;
  margin: 0;
}

#home-gallery .egallery-menu-images figure {
  height: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: 0;
}

#home-gallery .egallery-menu-images figure > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

#home-gallery .egallery-menu-images a:focus-visible {
  outline: 3px solid var(--htn-card-accent, #E5D272);
  outline-offset: -5px;
}

#home-gallery .egallery-menu-images__more {
  padding: 0;
  margin: 1rem auto 0;
}

@media (min-width: 992px) {
  #home-gallery .egallery-menu-images {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .htn-home-sections__person-photo img {
    transition: none;
  }
  .htn-home-sections__person-link:hover img {
    transform: none;
  }
}

/* Homepage pricing: use existing brand colors, no fake item links. */
.htn-home-sections__price-list {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__price-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.15rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__price-item:last-child {
  border-bottom: 0;
}

.htn-home-sections__price-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.htn-home-sections__price-copy h3 {
  overflow-wrap: anywhere;
}

.htn-home-sections__price-amount {
  flex: 0 0 auto;
  color: var(--bs-primary, inherit);
  white-space: nowrap;
  font-size: 1.1rem;
}

/* eContact form: uses the theme's existing Bootstrap forms and brand colors. */
.htn-home-sections__contact-card {
  border: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__contact-form .form-label {
  font-weight: 600;
}

.htn-home-sections__contact-form .form-control {
  border-radius: 0;
  min-height: 48px;
}

.htn-home-sections__contact-form textarea.form-control {
  min-height: 135px;
  resize: vertical;
}

.htn-home-sections__contact-form .form-control:focus-visible,
.htn-home-sections__contact-form .form-check-input:focus-visible {
  outline-offset: 2px;
}

.htn-home-sections__contact-info p {
  overflow-wrap: anywhere;
}

.htn-home-sections__contact-details img,
.htn-home-sections__contact-details iframe {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  .htn-home-sections__price-item {
    flex-direction: column;
    gap: .4rem;
  }

  .htn-home-sections__price-amount {
    white-space: normal;
  }
}

/* Managed Why #НОКТИ / Training Space sections.
 * Reuse the existing Bootstrap + htn palette and typography.
 */
#home-why .htn-home-sections__section-head {
  max-width: 48rem;
}

.htn-home-sections__eyebrow {
  letter-spacing: .09em;
  font-size: .85rem;
}

.htn-home-sections__section-intro,
.htn-home-sections__training-head .lead {
  line-height: 1.65;
}

.htn-home-sections__why-item {
  border: 1px solid var(--bs-border-color, #e5e5e5);
  transition: border-color .2s ease;
}

.htn-home-sections__why-item:hover {
  border-color: var(--bs-primary, #333);
}

.htn-home-sections__why-item h3,
.htn-home-sections__training-item h3 {
  overflow-wrap: anywhere;
}

.htn-home-sections__why-item p,
.htn-home-sections__training-item p {
  line-height: 1.65;
}

.htn-home-sections__icon-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 3.5rem;
  height: 3.5rem;
  color: var(--bs-primary, #333);
  background: var(--bs-light, #f6f5f1);
  border: 1px solid var(--bs-border-color, #e5e5e5);
  border-radius: 50%;
}

.htn-home-sections__icon {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  color: inherit;
  stroke: currentColor;
  flex-shrink: 0;
}

.htn-home-sections__training-media {
  aspect-ratio: 5 / 4;
  border: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__training-media > img {
  object-fit: cover;
}

.htn-home-sections__training-placeholder {
  min-height: 100%;
  color: var(--bs-primary, #333);
  background: var(--bs-light, #f6f5f1);
}

.htn-home-sections__training-placeholder .htn-home-sections__icon {
  width: clamp(4.5rem, 9vw, 8rem);
  height: clamp(4.5rem, 9vw, 8rem);
}

.htn-home-sections__training-items {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.htn-home-sections__training-items .htn-home-sections__icon-frame {
  width: 3rem;
  height: 3rem;
}

.htn-home-sections__training-items .htn-home-sections__icon {
  width: 1.4rem;
  height: 1.4rem;
}

@media (max-width: 767.98px) {
  .htn-home-sections__training-media {
    aspect-ratio: 4 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .htn-home-sections__why-item {
    transition: none;
  }
}

/* Configurable contact heading, service/training highlights and contact methods.
 * These rules are loaded exclusively by the optional home_sections layout.
 */
#home-contact .htn-home-sections__section-head {
  max-width: 48rem;
}

#home-contact .htn-home-sections__contact-highlight,
#home-contact .htn-home-sections__contact-method {
  min-width: 0;
}

#home-contact .htn-home-sections__contact-highlights {
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--bs-border-color, #e5e5e5);
}

#home-contact .htn-home-sections__contact-highlight p {
  line-height: 1.6;
}

#home-contact .htn-home-sections__contact-highlight h3 {
  overflow-wrap: anywhere;
}

#home-contact .htn-home-sections__contact-method .htn-home-sections__icon-frame,
#home-contact .htn-home-sections__contact-highlight .htn-home-sections__icon-frame {
  width: 3rem;
  height: 3rem;
}

#home-contact .htn-home-sections__contact-method .htn-home-sections__icon,
#home-contact .htn-home-sections__contact-highlight .htn-home-sections__icon {
  width: 1.4rem;
  height: 1.4rem;
}

#home-contact .htn-home-sections__contact-method > div,
#home-contact .htn-home-sections__contact-highlight > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

#home-contact .htn-home-sections__contact-method a:focus-visible,
#home-contact .htn-home-sections__contact-form button:focus-visible {
  outline: 3px solid var(--bs-primary, currentColor);
  outline-offset: 3px;
}



/* Contact methods: familiar phone green, email blue and location gold.
 * Tint both the icon frame and the actionable text while leaving form
 * labels, field validation and the editor-selected icons untouched.
 */
#home-contact .htn-home-sections__contact-method--phone {
  --htn-contact-color: #186b3b;
  --htn-contact-tint: #e7f6ec;
}
#home-contact .htn-home-sections__contact-method--email {
  --htn-contact-color: #1656aa;
  --htn-contact-tint: #e9f2ff;
}
#home-contact .htn-home-sections__contact-method--address {
  --htn-contact-color: #866012;
  --htn-contact-tint: #fff7e3;
}
#home-contact .htn-home-sections__contact-method .htn-home-sections__icon-frame {
  color: var(--htn-contact-color, var(--bs-primary));
  background: var(--htn-contact-tint, var(--bs-light));
  border-color: currentColor;
}
#home-contact .htn-home-sections__contact-method a[href^="tel:"],
#home-contact .htn-home-sections__contact-method a[href^="mailto:"] {
  color: var(--htn-contact-color, var(--bs-primary));
  text-decoration-color: transparent;
  text-underline-offset: .2em;
}
#home-contact .htn-home-sections__contact-method a:hover {
  text-decoration: underline;
  text-decoration-color: currentColor;
}
#home-contact .htn-home-sections__contact-method a:focus-visible {
  outline-color: var(--htn-contact-color, var(--bs-primary));
}

/* Reference homepage composition. Respect existing Bootstrap theme colors:
 * #НОКТИ's primary/decorative tones are inherited; no new palette is defined.
 */
/* Reference: four service tiles, six course tiles. Media dimensions do not
 * depend on hover, and every card retains a visible title and summary.
 */
#home-services .htn-home-sections__card-body,
#home-courses .htn-home-sections__card-body {
  text-align: center;
}

#home-services .htn-home-sections__card-body .h4,
#home-courses .htn-home-sections__card-body .h4 {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#home-services .htn-home-sections__card-description,
#home-courses .htn-home-sections__card-description {
  font-size: .875rem;
}

/* Team-only portrait cards now occupy the full homepage width. */
#home-people .htn-home-sections__person {
  border: 0;
  background: transparent;
  box-shadow: none;
}

#home-people .htn-home-sections__person-photo {
  width: min(100%, 8rem);
  margin: .75rem auto 0;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--bs-border-color, #e5e5e5);
}

#home-people .htn-home-sections__person-photo img {
  border-radius: 50%;
}

#home-people .htn-home-sections__person .card-body {
  padding: .65rem .25rem 0;
}

#home-people .htn-home-sections__person h3 {
  font-size: clamp(.8rem, 1.15vw, 1rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#home-people .htn-home-sections__person-role,
#home-people .htn-home-sections__person-description,
#home-people .htn-home-sections__person-more {
  font-size: .75rem;
}

#home-people .htn-home-sections__person-description {
  display: none;
}

#home-people .htn-home-sections__people .col {
  min-width: 0;
}

/* More breathing room INSIDE each Team card on desktop and mobile. Keep
 * the shared rounded corners, visible outline and gold hover treatment.
 */
#home-team .htn-home-sections__person {
  padding: clamp(1.25rem, 2vw, 1.75rem);
}

#home-team .htn-home-sections__person-photo {
  width: min(100%, 9rem);
  margin: 0 auto;
}

#home-team .htn-home-sections__person .card-body {
  padding: 1.125rem .25rem .125rem;
}

#home-team .htn-home-sections__person .card-title {
  margin-bottom: .75rem !important;
}

#home-team .htn-home-sections__person-role {
  margin-bottom: 1rem !important;
}

/* News come from e107's actual published news_grid controller. Editorial
 * updates below are only the explicitly saved Theme Preferences records.
 */
.htn-home-sections__blog-card,
.htn-home-sections__updates-item {
  border: 1px solid var(--bs-border-color, #e5e5e5);
  background: var(--bs-body-bg, #fff);
}

.htn-home-sections__blog-photo {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.htn-home-sections__blog-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.htn-home-sections__blog-body {
  padding: .9rem 1rem 1.1rem;
}

.htn-home-sections__blog-body h3,
.htn-home-sections__updates-item {
  overflow-wrap: anywhere;
}

.htn-home-sections__updates {
  display: grid;
  gap: .75rem;
}

.htn-home-sections__updates-item a {
  padding: 1rem 1.15rem;
  color: var(--bs-body-color, inherit);
  border-left: 3px solid var(--bs-primary, currentColor);
}

.htn-home-sections__updates-item a:hover,
.htn-home-sections__updates-item a:focus-visible {
  background: var(--bs-light, #f8f9fa);
}

/* Gallery and updates share an 8/4 row. If no editorial updates are
 * configured, the gallery takes the whole row without empty sidebar space. */
.htn-home-sections__journal > .htn-home-sections__gallery-column:only-child {
  flex: 0 0 100%;
  width: 100%;
}

.htn-home-sections__map {
  max-width: 61rem;
  margin-inline: auto;
  border: 1px solid var(--bs-border-color, #e5e5e5);
}

.htn-home-sections__map img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.htn-home-sections__map a:focus-visible {
  outline: 3px solid var(--bs-primary, currentColor);
  outline-offset: 3px;
}

@media (max-width: 575.98px) {
  #home-people .htn-home-sections__people {
    --bs-gutter-x: .65rem;
  }

  #home-services .htn-home-sections__card-media,
  #home-courses .htn-home-sections__card-media {
    aspect-ratio: 4 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  #home-people img,
  .htn-home-sections__blog-card img {
    transition: none;
  }
}
