/* Load after site-visuals, catalog, media-slots and search-readiness. */
:where(.site-header, #main-content, .lc-main, .lc-editorial-section) {
  --ep-type-title: 2.75rem;
  --ep-type-section: 1.75rem;
  --ep-type-card: 1.25rem;
  --ep-type-body: 1rem;
  --ep-type-small: .875rem;
  --ep-type-caption: .75rem;
  --ep-logo-width: 124px;
  --ep-logo-height: 46px;
  --ep-hero-image-height: 480px;
  --ep-radius: 8px;
  --ep-stage: #f3f5f6;
  --ep-product-stage: #fff;
  --ep-section-space: 56px;
  --ep-grid-gap: 48px;
}

/* Preserve the existing font stacks and dark-header / light-content contract. */
.site-header .header-inner {
  gap: 20px;
}

.site-header .site-brand {
  flex: 0 0 auto;
  min-width: 0;
  gap: 0;
  align-self: center;
}

.site-header .site-brand-logo {
  flex: 0 0 var(--ep-logo-width);
  width: var(--ep-logo-width);
  height: var(--ep-logo-height);
  object-fit: contain;
  object-position: left center;
}

.site-header .header-actions {
  min-width: 0;
}

#main-content .lv-directory-hero {
  padding-block: 48px;
}

#main-content .lv-directory-head {
  max-width: 860px;
}

#main-content .lv-directory-head > p:last-child {
  margin-bottom: 0;
}

#main-content :is(.lv-hero, .detail-hero, .hero) h1,
.lc-main .lc-hero h1 {
  font-size: var(--ep-type-title);
  line-height: 1.22;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

#main-content .lv-section h2,
.lc-main h2,
.lc-editorial-section h2 {
  font-size: var(--ep-type-section);
  line-height: 1.4;
  letter-spacing: 0;
}

#main-content :is(h3, .lv-kicker, .eyebrow),
.lc-main :is(h3, .lc-kicker, .lc-number, .lc-step-no, .lc-facts dt, .lc-card-placeholder) {
  letter-spacing: 0;
}

.lc-main .lc-subtitle {
  font-size: var(--ep-type-card);
}

.lc-main .lc-card-copy :is(h2, h3) {
  font-size: var(--ep-type-card);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* site-visuals declares its card heading size important. */
#main-content .lv-card-text h2 {
  font-size: var(--ep-type-card) !important;
  line-height: 1.45;
}

.lc-main :is(.lc-hero-grid, .lc-card-grid) > *,
#main-content :is(.lv-hero-grid, .lv-editorial-grid) > * {
  min-width: 0;
}

.lc-main :is(.lc-card, .lc-hero-media, .lc-setup-media, .lc-role-image),
#main-content :is(.lv-image-frame, .lv-editorial-card) {
  border-radius: var(--ep-radius);
}

/* Product hero images sit directly on the hero; source pixels stay unaltered. */
.lc-main.lc-kind-product .lc-hero-figure {
  width: 100%;
  max-width: 640px;
  min-width: 0;
  margin-inline: auto;
}

.lc-main .lc-hero-media,
.single-lecen_product #main-content .detail-visual .media-frame,
.single-lecen_product #main-content .tc-hero-figure {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}

.lc-main.lc-kind-product .lc-hero-media:has(> .lc-image),
.single-lecen_product #main-content .detail-visual .media-frame:has(> .media-slide:only-child) {
  aspect-ratio: auto;
}

.lc-main.lc-kind-product .lc-hero-media > .lc-image {
  position: static;
  inset: auto;
  width: 100%;
  height: auto;
  max-height: var(--ep-hero-image-height);
  padding: 0;
  border: 0;
  border-radius: 10px;
}

/* All hero frames are unframed; photographs retain their actual scene pixels. */
#main-content .lv-hero .lv-image-frame,
#main-content .lv-page-hero .lv-image-frame,
#main-content .lv-article-hero .lv-image-frame {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  border-radius: 10px;
}
.site-footer .social-links { margin-top: 20px; gap: 8px 20px; }
.site-footer .social-links a { padding-block: 8px; font-size: .875rem; overflow-wrap: anywhere; }
.site-footer .copyright { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
.social-qr { flex-basis: 100%; min-width: 0; }
.social-qr summary { cursor: pointer; padding-block: 8px; font-size: .875rem; width: fit-content; }
.social-qr figure { margin: 12px 0 0; width: min(280px,100%); }
.social-qr img { display: block; width: 100%; height: auto; border-radius: 8px; }
.social-qr figcaption { font-size: .8125rem; margin-top: 8px; }

.lc-main .lc-card .lc-card-media,
#main-content .product-card .card-media {
  background: var(--ep-product-stage);
}

.lc-main .lc-card .lc-card-media.lc-surface-dark {
  background: #000;
}

.lc-main :is(.lc-hero-media, .lc-card-media) .lc-image,
.lc-main .lc-card-media > img,
.single-lecen_product #main-content .detail-visual :is(.image-primary, .media-frame > img),
#main-content .product-card .card-media :is(.image-primary, img:not(.image-backdrop)) {
  object-fit: contain !important;
  object-position: center;
  transform: none !important;
  filter: none;
}

.single-lecen_product #main-content .detail-visual .image-surface {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.single-lecen_product #main-content .detail-visual :is(.image-primary, .media-frame > img) {
  padding: 0;
}

.single-lecen_product #main-content .detail-visual .media-slide:only-child,
.single-lecen_product #main-content .detail-visual .media-slide:only-child .image-surface {
  height: auto;
}

.single-lecen_product #main-content .detail-visual .media-slide:only-child .image-primary {
  position: static;
  height: auto;
  max-height: var(--ep-hero-image-height);
}

.single-lecen_product #main-content .detail-visual .image-backdrop,
#main-content .product-card .image-backdrop {
  display: none;
}

html:not(.js) .single-lecen_product #main-content .detail-visual .media-frame:has(> .media-slide:nth-child(2)) {
  aspect-ratio: auto;
}

html:not(.js) .single-lecen_product #main-content .detail-visual .media-frame > .media-slide:not(:only-child) {
  height: auto;
  aspect-ratio: 4 / 3;
}

/* Galleries need room for their controls and the no-JS list of slides. */
.lc-main.lc-kind-product .lc-hero-media:has(.tc-gallery),
.single-lecen_product #main-content .tc-hero-figure {
  display: block;
  aspect-ratio: auto;
  overflow: visible;
}

.lc-main.lc-kind-product .lc-hero-media .tc-gallery,
.single-lecen_product #main-content .tc-hero-figure .tc-gallery {
  width: 100%;
  padding: 0;
}

.lc-main.lc-kind-product .lc-hero-media .tc-slide,
.single-lecen_product #main-content .tc-hero-figure .tc-slide {
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
}

.lc-main.lc-kind-product .lc-hero-media .tc-slide :is(.tc-image, video, iframe),
.single-lecen_product #main-content .tc-hero-figure .tc-slide :is(.tc-image, video, iframe) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  padding: 0;
  border: 0;
}

.lc-main.lc-kind-product .tc-gallery-controls,
.single-lecen_product #main-content .tc-hero-figure .tc-gallery-controls {
  flex-wrap: wrap;
}

.single-lecen_product #main-content .tc-hero-figure figcaption {
  padding: 10px 0 0;
  color: #b8cddd;
}

.lc-main .lc-setup-media,
.lc-main .lc-role-image {
  background: var(--ep-stage);
  box-shadow: none;
}

.lc-main .lc-setup-media .lc-image,
.lc-main .lc-role-image img,
#main-content .lv-diagram .lv-img,
.post-type-archive-lecen_case #main-content .archive-card .image-surface:not(.image-surface--photo) > .image-primary,
#main-content .case-card .image-surface:not(.image-surface--photo) > .image-primary {
  object-fit: contain !important;
  object-position: center;
  transform: none;
}

/* Fix the media box, not the source dimensions; keep captions outside it. */
.post-type-archive-lecen_case #main-content .lv-card-cover .lv-image-frame,
.post-type-archive-lecen_case #main-content .archive-card .card-media,
#main-content .case-card .card-media {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--ep-stage);
}

.post-type-archive-lecen_case #main-content .lv-card-cover .lv-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  border-radius: 0;
  object-fit: contain;
}

/* Only case-owner covers and explicitly classified photos receive scene crops. */
.post-type-archive-lecen_case #main-content .lv-card-cover .lv-owner:not(.lv-diagram):not(.lv-concept) .lv-img,
.post-type-archive-lecen_case #main-content .archive-card .image-surface--photo > .image-primary,
#main-content .case-card .image-surface--photo > .image-primary {
  object-fit: cover;
  object-position: center;
  padding: 0;
  filter: none;
}

.post-type-archive-lecen_case #main-content .archive-card .image-backdrop,
#main-content .case-card .image-backdrop {
  display: none;
}

.post-type-archive-lecen_case #main-content .lv-card-cover figcaption,
.lc-main .lc-hero-figure > figcaption,
.lc-main .lc-media-disclosure {
  height: auto;
  max-height: none;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

/* Optional template extensions: full-width editorial bands with unframed columns. */
.lc-editorial-section {
  width: 100%;
  padding-block: var(--ep-section-space);
  border-top: 1px solid var(--line, #dce5eb);
  border-radius: 0;
  background: var(--paper, #fff);
  color: var(--ink, #12283b);
  box-shadow: none;
  font-size: var(--ep-type-body);
  letter-spacing: 0;
  scroll-margin-top: 112px;
}

.lc-editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 28px var(--ep-grid-gap);
  align-items: start;
}

.lc-editorial-grid > * {
  min-width: 0;
}

.lc-editorial-section :is(h2, h3, p, li, dt, dd, a) {
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.lc-editorial-section h3 {
  font-size: var(--ep-type-card);
  line-height: 1.45;
}

.lc-editorial-section p {
  max-width: 72ch;
  line-height: 1.85;
  color: var(--muted, #526577);
}

.lc-editorial-section p + p {
  margin-top: 16px;
}

.lc-editorial-section a:not(.lc-button) {
  color: var(--blue, #076ca9);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lc-evidence-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line, #dce5eb);
}

.lc-evidence-list > li {
  padding-block: 18px;
  border-bottom: 1px solid var(--line, #dce5eb);
  font-size: var(--ep-type-small);
  line-height: 1.8;
}

.lc-evidence-list :is(small, figcaption) {
  font-size: var(--ep-type-caption);
}

@media (max-width: 1080px) {
  :where(.site-header, #main-content, .lc-main, .lc-editorial-section) {
    --ep-type-title: 2.25rem;
    --ep-grid-gap: 32px;
  }

  .site-header .header-inner {
    gap: 12px;
  }
}

@media (max-width: 800px) {
  :where(#main-content, .lc-main, .lc-editorial-section) {
    --ep-section-space: 40px;
  }

  #main-content .lv-hero-grid,
  .lc-editorial-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .lc-main .lc-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  :where(.site-header, #main-content, .lc-main, .lc-editorial-section) {
    --ep-type-title: 1.875rem;
    --ep-type-section: 1.5rem;
    --ep-logo-width: 104px;
    --ep-logo-height: 38px;
    --ep-hero-image-height: 360px;
    --ep-section-space: 32px;
  }

  .site-header .header-inner {
    gap: 8px;
  }

  .site-header .mobile-menu-toggle {
    flex-shrink: 0;
  }

  .post-type-archive-lecen_case #main-content .lv-editorial-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lc-main .lc-related-grid .lc-card-copy h3 {
    font-size: var(--ep-type-body);
  }

  .lc-main .lc-actions > a {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .lc-editorial-grid {
    gap: 24px;
  }
}
