/*
 * Hospital application category
 * Load after style.css in the hospital category template.
 * Uses the original template markup and media.
 */

body:has(> .n_banner + .mbx_section + .n_main .nspace_section > .nspace_list) {
  --hospital-ink: #153743;
  --hospital-muted: #48616e;
  --hospital-accent: #006782;
  --hospital-line: #d8e4e8;
  --hospital-pale: #eef5f7;
  --hospital-gutter: clamp(18px, 5vw, 72px);
  --hospital-width: 1240px;
}

/* Existing banner, page heading and breadcrumb */
body:has(> .n_banner + .mbx_section + .n_main .nspace_section > .nspace_list) > .n_banner {
  z-index: auto;
  overflow: hidden;
  border-bottom: 2px solid var(--hospital-line);
  background: var(--hospital-pale);
}

body:has(> .n_banner + .mbx_section + .n_main .nspace_section > .nspace_list) > .mbx_section {
  z-index: auto;
  padding-block: clamp(24px, 3.4vw, 48px);
  border-bottom: 1px solid var(--hospital-line);
  background: #fff;
  color: var(--hospital-muted);
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) > .container,
body > .n_banner + .mbx_section + .n_main > .container:has(> .nspace_section > .nspace_list) {
  width: calc(100% - 2 * var(--hospital-gutter));
  max-width: var(--hospital-width);
  padding: 0;
  margin-inline: auto;
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) .n_title {
  display: block;
  margin: 0 0 10px;
  color: var(--hospital-ink) !important;
  font: 400 clamp(33px, 4.25vw, 57px)/1.08 Arial, "Helvetica Neue", sans-serif !important;
  letter-spacing: -.045em;
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) .mbx {
  float: none;
  color: var(--hospital-ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) .mbx :is(a, span, i) {
  color: var(--hospital-muted);
  font-size: inherit;
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) .mbx a:hover {
  color: var(--hospital-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Application navigation */
body > .n_banner + .mbx_section + .n_main:has(.nspace_section > .nspace_list) {
  padding-block: clamp(23px, 3vw, 42px) clamp(38px, 5.4vw, 78px);
  background: #f6f9fa;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav {
  height: auto;
  overflow: visible;
  margin-bottom: clamp(21px, 3vw, 40px);
  padding: 9px;
  border: 1px solid var(--hospital-line);
  border-radius: 6px;
  background: #fff;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav > ul {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px 6px;
  overflow: visible;
  margin: 0;
  padding: 0;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav > ul::before,
.n_main .nspace_section:has(> .nspace_list) > .page_nav > ul::after {
  display: none;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li {
  display: flex;
  align-items: center;
  gap: 8px;
  height: auto;
  min-width: 0;
  margin: 0;
  padding-inline: 9px 10px;
  border-radius: 4px;
  text-align: left;
  transition: background-color .18s ease;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li::after {
  content: none;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li > img {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
  object-fit: contain;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li > a {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  height: auto;
  padding-block: 7px;
  color: var(--hospital-ink);
  font-size: clamp(14px, .15rem, 15px);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  transition: color .18s ease;
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li:is(:hover, :focus-within, .active),
.n_main .nspace_section:has(> .nspace_list) > .page_nav li:has(> a:is([aria-current="page"], [href="https://www.zsrehabilitation.com/applicationcase/hospital/"], [href="/applicationcase/hospital/"])) {
  background: var(--hospital-pale);
}

.n_main .nspace_section:has(> .nspace_list) > .page_nav li:is(:hover, :focus-within, .active) > a,
.n_main .nspace_section:has(> .nspace_list) > .page_nav li > a:is([aria-current="page"], [href="https://www.zsrehabilitation.com/applicationcase/hospital/"], [href="/applicationcase/hospital/"]) {
  color: var(--hospital-accent);
}

/* Existing CMS case cards */
.n_main .nspace_section > .nspace_list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(15px, 2.25vw, 30px);
  overflow: visible;
  margin: 0;
  padding: 0;
}

.n_main .nspace_section > .nspace_list::before,
.n_main .nspace_section > .nspace_list::after {
  display: none;
}

.n_main .nspace_section > .nspace_list > li {
  float: none;
  clear: none;
  width: auto;
  min-width: 0;
  margin: 0 0 0.5rem;
  padding: 0;
}

.n_main .nspace_section > .nspace_list > li .column {
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--hospital-line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 18px rgb(24 53 66 / 5%);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.n_main .nspace_section > .nspace_list > li:is(:hover, :focus-within) .column {
  border-color: #98b8c5;
  box-shadow: 0 8px 24px rgb(24 53 66 / 9%);
}

.n_main .nspace_section > .nspace_list > li .image {
  aspect-ratio: 16 / 9;
  background: var(--hospital-pale);
}

.n_main .nspace_section > .nspace_list > li .image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .3s ease;
}

.n_main .nspace_section > .nspace_list > li:hover .image img {
  transform: scale(1.025);
}

.n_main .nspace_section > .nspace_list > li .wrap_con {
  width: 100%;
  margin: 0;
  padding: clamp(16px, 2vw, 25px);
}

.n_main .nspace_section > .nspace_list > li .wrap {
  align-items: flex-start;
  gap: 12px;
}

.n_main .nspace_section > .nspace_list > li .wrap .theme {
  flex: 1;
  width: auto;
  min-width: 0;
}

.n_main .nspace_section > .nspace_list > li .title {
  overflow: visible;
  margin-bottom: 7px;
  color: var(--hospital-ink);
  font: 700 clamp(17px, .21rem, 21px)/1.34 Arial, "Helvetica Neue", sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: color .18s ease;
}

.n_main .nspace_section > .nspace_list > li .title:hover {
  color: var(--hospital-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.n_main .nspace_section > .nspace_list > li p {
  height: auto;
  margin: 0;
  color: var(--hospital-muted);
  font-size: clamp(14px, .16rem, 16px);
  line-height: 1.6;
  -webkit-line-clamp: 3;
}

.n_main .nspace_section > .nspace_list > li .more {
  display: flex;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  opacity: 1;
  background-color: var(--hospital-accent);
  background-size: 15px;
}

/* Existing CMS pagination and keyboard focus */
.n_main .nspace_section:has(> .nspace_list) > .page_num {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: clamp(24px, 3vw, 40px);
}

.n_main .nspace_section:has(> .nspace_list) > .page_num:has(> .total:empty):not(:has(a, b, strong, span)),
.n_main .nspace_section:has(> .nspace_list) > .page_num::before,
.n_main .nspace_section:has(> .nspace_list) > .page_num::after {
  display: none;
}

.n_main .nspace_section:has(> .nspace_list) > .page_num .total {
  float: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 0;
  color: var(--hospital-muted);
  font-size: 14px;
  text-align: center;
}

.n_main .nspace_section:has(> .nspace_list) > .page_num a {
  float: none;
  min-width: 40px;
  height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--hospital-line);
  border-radius: 4px;
  background: #fff;
  color: var(--hospital-ink);
  font-size: 14px;
  line-height: 38px;
  text-transform: none;
  animation: none;
}

.n_main .nspace_section:has(> .nspace_list) > .page_num a:hover {
  border-color: var(--hospital-accent);
  color: var(--hospital-accent);
  animation: none;
}

.n_main .nspace_section:has(> .nspace_list) > .page_num > span,
.n_main .nspace_section:has(> .nspace_list) > .page_num .total > :is(b, strong, span.current),
.n_main .nspace_section:has(> .nspace_list) > .page_num a[aria-current="page"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  border-radius: 4px;
  background: var(--hospital-accent);
  color: #fff;
}

body > .n_banner + .mbx_section:has(+ .n_main .nspace_section > .nspace_list) a:focus-visible,
.n_main .nspace_section:has(> .nspace_list) a:focus-visible {
  outline: 2px solid var(--hospital-accent) !important;
  outline-offset: 3px;
}

.n_main .nspace_section > .nspace_list .image > a:focus-visible {
  outline-offset: -4px;
}

@media (max-width: 600px) {
  body:has(> .n_banner + .mbx_section + .n_main .nspace_section > .nspace_list) > .n_banner img {
    min-height: 116px;
    object-fit: cover;
    object-position: left center;
  }

  .n_main .nspace_section:has(> .nspace_list) > .page_nav > ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .n_main .nspace_section:has(> .nspace_list) > .page_nav li {
    gap: 6px;
    padding-inline: 6px;
  }

  .n_main .nspace_section:has(> .nspace_list) > .page_nav li > img {
    flex-basis: 17px;
    width: 17px;
    height: 17px;
  }

  .n_main .nspace_section > .nspace_list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .n_main .nspace_section:has(> .nspace_list) :is(.page_nav li, a, .column, .image img) {
    transition: none !important;
  }

  .n_main .nspace_section > .nspace_list > li:hover .image img {
    transform: none;
  }
}
