/*
 * HEER compact-web preview
 *
 * The approved desktop composition remains unchanged from 1200px upward,
 * except for the compact Mongolian header band documented at the end.
 * app/layout enables this stylesheet only for Web mode, so compact Web can
 * follow the browser width without ever selecting the phone presentation.
 */
.hero-review {
  /* The approved footer panel has an intentional +15px x-offset. Clip its
     paint at the page edge instead of altering the saved geometry. */
  overflow-x: clip;
}

@media (width < 1200px) {
  :root {
    --heer-fluid-gutter: clamp(30px, 6vw, 72px);
    --heer-fluid-gap: clamp(20px, 3vw, 38px);
  }

  html,
  body,
  .hero-review {
    max-width: 100%;
  }

  /* Keep the complete navigation reachable while its labels reflow. */
  .site-header {
    grid-template-columns: clamp(72px, 9vw, 104px) minmax(0, 1fr) clamp(40px, 5vw, 52px);
    gap: clamp(8px, 1.5vw, 18px);
    width: 100%;
    height: clamp(74px, 7vw, 86px);
    padding-inline: clamp(14px, 2.5vw, 30px);
  }

  .site-header nav {
    display: flex;
    min-width: 0;
    height: 100%;
    align-self: stretch;
    align-items: stretch;
    justify-content: safe center;
    gap: clamp(14px, 2.2vw, 30px);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .site-header nav::-webkit-scrollbar {
    display: none;
  }

  .site-header nav a {
    flex: 0 0 auto;
    display: flex;
    height: 100% !important;
    align-items: center;
    padding-block: 0 !important;
    font-size: clamp(12px, 1.15vw, 14px);
  }

  .site-header > .header-logo {
    left: auto !important;
    top: auto !important;
    width: clamp(62px, 6vw, 72px) !important;
    height: clamp(62px, 7vw, 82px) !important;
    translate: none !important;
    scale: 1 !important;
  }

  .site-header > .globe,
  .site-header nav > a[data-heer-layout-key] {
    left: auto !important;
    top: auto !important;
    width: auto !important;
    translate: none !important;
    scale: 1 !important;
  }

  .site-header nav > a[data-heer-layout-key] {
    height: 100% !important;
  }

  .site-header > .globe {
    height: auto !important;
  }

  /* Company: logo + story + benefits become a real responsive grid. */
  .identity-section {
    display: grid !important;
    grid-template-columns: minmax(170px, .72fr) minmax(0, 1.28fr) !important;
    grid-template-areas:
      "logo copy"
      "benefits benefits";
    align-items: center;
    gap: clamp(38px, 6vw, 78px) clamp(34px, 6vw, 86px);
    min-height: 0 !important;
    height: auto !important;
    padding: clamp(62px, 7vw, 94px) var(--heer-fluid-gutter) clamp(68px, 8vw, 108px) !important;
  }

  .identity-section > .identity-copy,
  .identity-section > .identity-benefits,
  .identity-section > .identity-mark {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    translate: none !important;
    scale: 1 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .identity-section > .identity-copy {
    grid-area: copy;
    width: 100% !important;
  }

  .identity-section > .identity-mark {
    grid-area: logo;
    justify-self: center;
    width: min(100%, 255px) !important;
    aspect-ratio: 535 / 796;
  }

  .identity-section > .identity-benefits {
    grid-area: benefits;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100% !important;
  }

  .identity-copy > [data-heer-layout-key],
  .identity-story-body > [data-heer-layout-key],
  .identity-benefits > [data-heer-layout-key] {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    transform: none !important;
    translate: none !important;
    scale: 1 !important;
    overflow-wrap: anywhere;
  }

  /* How HEER works: replace absolute desktop coordinates with flow. */
  .why-process {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    column-gap: clamp(16px, 2vw, 28px);
    row-gap: clamp(28px, 4vw, 52px);
    min-height: 0 !important;
    height: auto !important;
    padding: clamp(64px, 7vw, 96px) var(--heer-fluid-gutter) clamp(74px, 9vw, 118px) !important;
    overflow: hidden;
  }

  .why-process > .process-layout-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
    translate: none !important;
  }

  .why-process > .why-title {
    grid-column: 1 / span 7;
  }

  .why-process > .why-description {
    grid-column: 8 / -1;
    align-self: end;
    font-size: clamp(14px, 1.35vw, 16px);
  }

  .why-process > .why-card {
    grid-column: span 4;
    min-height: clamp(230px, 24vw, 292px) !important;
    padding: clamp(27px, 3vw, 39px) !important;
  }

  .why-process > .process-title,
  .why-process > .process-closing {
    grid-column: 1 / -1;
  }

  .why-process > .process-step {
    grid-column: span 2;
    width: auto !important;
    padding-inline: clamp(4px, .8vw, 12px);
  }

  .why-process > .process-steps-line {
    display: none;
  }

  .why-process > :is(.why-title, .why-card, .process-title, .process-step) > [data-heer-layout-key] {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    transform: none !important;
    translate: none !important;
    scale: 1 !important;
    overflow-wrap: anywhere;
  }

  .why-process > .process-step > span[data-heer-layout-key] {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
  }

  .why-process > .process-step p {
    max-width: 100%;
  }

  /* Services: keep the cards and their edited artwork, reflow only the cards. */
  .medical-services > .section-heading,
  .medical-services .service-grid > .service-card-flip {
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    translate: none !important;
    scale: 1 !important;
  }

  .medical-services > .section-heading > [data-heer-layout-key] {
    left: auto !important;
    top: auto !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
    translate: none !important;
    scale: 1 !important;
    overflow-wrap: anywhere;
  }

  .medical-services > .section-heading h2 {
    font-size: clamp(34px, 5vw, 62px);
  }

  /* The baked 전/후 artwork remains one coordinate system: image and
     hotspots scale together, with no independent movement. */
  .hero-review > .before-after {
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .before-after > .before-scene.before-layout-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    translate: none !important;
    scale: 1 !important;
  }

  .before-scene > .before-reference-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1672 / 941;
    object-fit: contain;
  }

  .before-scene > .before-case-hotspots {
    position: absolute;
    inset: 0;
  }

  /* Partners/news already use grids; remove only saved desktop offsets. */
  .partner-hero .tab-page-item,
  .partner-network-grid > .tab-page-item,
  .partner-clinic-row > .tab-page-item,
  .partner-summary > .tab-page-item,
  .partner-network-panel > header > [data-heer-layout-key],
  .partner-logo-grid > .partner-logo-card,
  .partner-lead > [data-heer-layout-key] {
    left: auto !important;
    top: auto !important;
    max-width: 100% !important;
    height: auto !important;
    translate: none !important;
    scale: 1 !important;
  }

  .partner-hero .tab-page-item,
  .partner-network-grid > .tab-page-item,
  .partner-clinic-row > .tab-page-item,
  .partner-logo-grid > .partner-logo-card {
    width: auto !important;
    height: auto !important;
  }

  .partner-heading h2,
  .partner-lead,
  .partner-network-panel,
  .partner-network-panel > header {
    min-width: 0;
  }

  .partner-heading h2,
  .partner-lead p,
  .partner-network-panel > header h3,
  .partner-logo-card > span,
  .partner-logo-card > em {
    overflow-wrap: anywhere;
  }

  .news-section > .section-heading,
  .news-section > .section-heading > [data-heer-layout-key],
  .news-section .news-grid > .news-card,
  .news-card > .news-card-image,
  .news-card-copy > [data-heer-layout-key] {
    left: auto !important;
    top: auto !important;
    max-width: 100% !important;
    height: auto !important;
    translate: none !important;
    scale: 1 !important;
  }

  .news-section > .section-heading,
  .news-section .news-grid > .news-card,
  .news-card > .news-card-image {
    width: auto !important;
    height: auto !important;
  }

  .news-card-copy h3 {
    min-height: 0;
    overflow-wrap: anywhere;
  }

  /* Saved footer nudges must not create page-wide horizontal overflow. */
  .legal-footer,
  .legal-footer > [data-heer-layout-key],
  .legal-footer-brand > [data-heer-layout-key] {
    left: auto !important;
    top: auto !important;
    max-width: 100% !important;
    height: auto !important;
    translate: none !important;
    scale: 1 !important;
  }

  .legal-footer[data-heer-layout-key] {
    width: 100% !important;
    height: auto !important;
  }

  .legal-footer-contact {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (width < 900px) {
  .identity-section {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "logo"
      "copy"
      "benefits";
  }

  .identity-section > .identity-mark {
    width: min(34vw, 190px) !important;
  }

  .identity-section > .identity-benefits {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .why-process {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .why-process > :is(.why-title, .why-description, .process-title, .process-closing) {
    grid-column: 1 / -1;
  }

  .why-process > .why-description {
    max-width: 680px !important;
  }

  .why-process > .why-card {
    grid-column: span 3;
    min-height: 235px !important;
  }

  .why-process > .process-card3 {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - clamp(8px, 1vw, 14px)) !important;
  }

  .why-process > .process-step {
    grid-column: span 2;
    padding-bottom: 10px;
  }

  .medical-services .service-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .medical-services .service-card-flip,
  .medical-services .service-card-flip:nth-child(n),
  .medical-services .service-card-flip.service-featured {
    grid-column: span 2;
  }

  .medical-services .service-card-flip:nth-child(5) {
    grid-column: span 2;
  }

  .medical-services .service-card-flip:nth-child(7) {
    grid-column: 2 / span 2;
  }

  .news-section .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  .news-section .news-grid article:nth-child(n) {
    margin-top: 0;
  }

  .news-section .news-grid article:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 12px) !important;
  }

  .partner-clinic-row {
    display: block;
  }

  .news-detail-dialog {
    display: block;
    overflow: auto;
    max-height: calc(100svh - 36px);
  }

  .news-detail-copy {
    border-top: 1px solid rgba(133, 78, 60, .16);
    border-left: 0;
  }
}

/* At the former 701px boundary (and at 768px), keep every destination in the
   bar instead of hiding the last Mongolian labels beyond a horizontal scroll. */
@media (min-width: 640px) and (max-width: 899px) {
  .site-header {
    grid-template-columns: 54px minmax(0, 1fr) 36px;
    gap: 6px;
    height: 68px;
    padding-inline: 10px;
  }

  .site-header > .header-logo {
    width: 50px !important;
    height: 60px !important;
  }

  .site-header > .globe {
    width: 36px !important;
  }

  .site-header > .globe img {
    width: 32px;
    height: 32px;
  }

  .site-header nav {
    justify-content: stretch;
    gap: 3px;
    overflow: hidden;
  }

  .site-header nav a,
  .site-header nav a[data-heer-layout-key] {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 2px !important;
    white-space: normal;
    text-align: center;
    font-size: 10.5px;
    line-height: 1.15;
  }

  .site-header nav a.news-image-link {
    flex: 0 1 52px;
  }

  .site-header .news-tab-image {
    width: 48px;
  }
}

/* Mongolian labels need a compact desktop header for the 1200–1438px band;
   other languages and the approved >=1439px header remain untouched. */
@media (min-width: 1200px) and (max-width: 1438px) {
  html:lang(mn) .site-header {
    grid-template-columns: clamp(94px, 8.5vw, 122px) minmax(0, 1fr) 46px;
    gap: clamp(8px, 1vw, 14px);
    padding-inline: clamp(16px, 2vw, 28px);
  }

  html:lang(mn) .site-header nav {
    min-width: 0;
    gap: clamp(10px, 1.2vw, 17px);
  }

  html:lang(mn) .site-header nav a {
    flex: 0 1 auto;
    min-width: 0;
    font-size: clamp(11px, .9vw, 13px);
  }
}
