/* EMKAN v136 — final geometry, canonical controls/search, education rail, square covers.
   Loaded after v135. Preserve the approved minimal / linear language. */

:root{
  --emkan-v136-menu-max:1320px;
  --emkan-v136-content-max:1430px;
  --emkan-v136-page-gutter:48px;
}

/* --------------------------------------------------------------------------
   Header: narrower than the page content. Utilities are physical left/right,
   independent of RTL/LTR, so changing language cannot move them into the nav.
   -------------------------------------------------------------------------- */
@media (min-width:901px){
  html body .site-header{
    width:min(calc(100% - 96px),var(--emkan-v136-menu-max))!important;
    max-width:var(--emkan-v136-menu-max)!important;
    margin-inline:auto!important;
  }
  html body .site-header .nav-frame{
    position:relative!important;
    display:block!important;
    min-height:52px!important;
  }
  html body .site-header .primary-nav{
    width:100%!important;
    min-height:52px!important;
    padding-inline:112px!important;
    box-sizing:border-box!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }
  html body .site-header .nav-list{
    width:max-content!important;
    max-width:100%!important;
    margin-inline:auto!important;
    gap:clamp(18px,1.45vw,28px)!important;
    align-items:center!important;
    justify-content:center!important;
  }
  html body .site-header .language-button,
  html[dir="rtl"] body .site-header .language-button,
  html[dir="ltr"] body .site-header .language-button{
    position:absolute!important;
    left:16px!important;right:auto!important;inset-inline:auto!important;
    top:50%!important;bottom:auto!important;
    transform:translateY(-50%)!important;
    margin:0!important;z-index:30!important;
  }
  html body .site-header .theme-button,
  html body .site-header .nav-frame>#themeButton.theme-button,
  html[dir="rtl"] body .site-header .theme-button,
  html[dir="ltr"] body .site-header .theme-button{
    position:absolute!important;
    right:16px!important;left:auto!important;inset-inline:auto!important;
    top:50%!important;bottom:auto!important;
    transform:translateY(-50%)!important;
    margin:0!important;z-index:30!important;
  }
}

/* One exact utility size everywhere except the dedicated Welcome pair. */
body:not(.welcome-page) .site-header :is(.theme-button,.language-button),
.menu-page :is(.theme-button,.language-button),
.account-language-rail :is(.theme-toggle,.auth-theme-inline){
  min-height:30px!important;height:30px!important;
  padding-block:0!important;
}
body:not(.welcome-page) .site-header .theme-button,
.menu-page .theme-button,
.account-language-rail :is(.theme-toggle,.auth-theme-inline){
  width:30px!important;min-width:30px!important;padding-inline:0!important;
  display:inline-grid!important;place-items:center!important;
}
body:not(.welcome-page) .site-header .theme-button .theme-icon-wrap,
.menu-page .theme-button .theme-icon-wrap,
.account-language-rail :is(.theme-toggle,.auth-theme-inline) .theme-icon-wrap{
  width:15px!important;height:15px!important;display:grid!important;place-items:center!important;
}
body:not(.welcome-page) .site-header .theme-button :is(svg,i),
.menu-page .theme-button :is(svg,i),
.account-language-rail :is(.theme-toggle,.auth-theme-inline) :is(svg,i){
  width:13.5px!important;height:13.5px!important;font-size:13.5px!important;
}

/* --------------------------------------------------------------------------
   Page geometry: breadcrumb/back line is one step wider than the menu and all
   page content uses exactly that same outer measure.
   -------------------------------------------------------------------------- */
@media (min-width:901px){
  body :is(
    .architecture-main,.module-main,.store-main,.store-category-main,.product-main,
    .checkout-main,.articles-main,.article-page,.detail-main,.v49-main,.podcast-main,
    .about-main,.contact-main,.careers-main,.emkan-search-main,.emkan-member-main,
    .project-main,.account-shell
  ){
    width:min(calc(100% - 96px),var(--emkan-v136-content-max))!important;
    max-width:var(--emkan-v136-content-max)!important;
    margin-inline:auto!important;
    box-sizing:border-box!important;
  }
  body :is(.emkan-context-bar,.store-context-bar,.podcast-context-bar,.product-toolbar,.detail-nav,.short-back,.article-page-back){
    width:100%!important;max-width:none!important;box-sizing:border-box!important;
  }
  /* Education details previously re-shrank themselves to 1050px. Keep their
     outer line aligned to the same breadcrumb/content width. */
  body.content-section-page .v49-main:has(.v86-course-detail),
  body.content-section-page .v49-main:has(.v49-reading){
    width:min(calc(100% - 96px),var(--emkan-v136-content-max))!important;
    max-width:var(--emkan-v136-content-max)!important;
  }
  body.content-section-page #contentApp>.v69-content-detail-layout{
    width:100%!important;max-width:100%!important;margin-inline:0!important;
  }
}

/* --------------------------------------------------------------------------
   Store search — exact canonical line + magnifier used by other sections.
   -------------------------------------------------------------------------- */
.store-category-side .product-search{
  position:relative!important;display:block!important;width:100%!important;
  height:28px!important;min-height:28px!important;margin:0 0 18px!important;
  padding:0!important;border:0!important;background:transparent!important;
}
.store-category-side .product-search>.lang-fa,
.store-category-side .product-search>.lang-en,
.store-category-side .product-search>.lang-ar{
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
  overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;
}
.store-category-side .product-search input[type="search"]{
  display:block!important;width:100%!important;height:28px!important;min-height:28px!important;
  margin:0!important;padding-block:0 5px!important;border:0!important;border-bottom:1px solid var(--line)!important;
  border-radius:0!important;background:transparent!important;color:var(--fg)!important;box-shadow:none!important;outline:0!important;
  font:inherit!important;font-size:10px!important;line-height:1.5!important;
  -webkit-appearance:none!important;appearance:none!important;
}
.store-category-side .product-search input[type="search"]:is(:hover,:focus){border-bottom-color:var(--hover-accent)!important}
:is(html[lang="fa"],html[lang="ar"]) .store-category-side .product-search input[type="search"]{
  direction:rtl!important;text-align:right!important;padding-inline:0 26px!important;
}
html[lang="en"] .store-category-side .product-search input[type="search"]{
  direction:ltr!important;text-align:left!important;padding-inline:0 26px!important;
}
.store-category-side .product-search>.search-icon.emkan-v136-store-search-icon{
  position:absolute!important;z-index:4!important;top:50%!important;width:12px!important;height:12px!important;
  transform:translateY(-58%)!important;color:var(--category-muted,var(--fg))!important;opacity:.54!important;
  fill:none!important;stroke:currentColor!important;stroke-width:1.55!important;pointer-events:none!important;
}
:is(html[lang="fa"],html[lang="ar"]) .store-category-side .product-search>.search-icon.emkan-v136-store-search-icon{left:9px!important;right:auto!important}
html[lang="en"] .store-category-side .product-search>.search-icon.emkan-v136-store-search-icon{right:9px!important;left:auto!important}

/* --------------------------------------------------------------------------
   Education: FA/AR rail is physically right, EN rail physically left.
   The main column begins at the same vertical level and receives a topic lead.
   -------------------------------------------------------------------------- */
@media (min-width:901px){
  :is(html[lang="fa"],html[lang="ar"]) body.content-section-page #contentApp .v69-content-detail-layout:has(.v49-reading),
  :is(html[lang="fa"],html[lang="ar"]) body.content-section-page #contentApp .v69-content-detail-layout:has(.v86-course-detail){
    display:grid!important;direction:ltr!important;
    grid-template-columns:minmax(0,1fr) 190px!important;
    grid-template-areas:"content rail"!important;
    column-gap:clamp(42px,4vw,62px)!important;align-items:start!important;
  }
  html[lang="en"] body.content-section-page #contentApp .v69-content-detail-layout:has(.v49-reading),
  html[lang="en"] body.content-section-page #contentApp .v69-content-detail-layout:has(.v86-course-detail){
    display:grid!important;direction:ltr!important;
    grid-template-columns:190px minmax(0,1fr)!important;
    grid-template-areas:"rail content"!important;
    column-gap:clamp(42px,4vw,62px)!important;align-items:start!important;
  }
  body.content-section-page #contentApp .v69-content-detail-layout:has(.v49-reading)>.v69-content-search-rail,
  body.content-section-page #contentApp .v69-content-detail-layout:has(.v86-course-detail)>.v69-content-search-rail{
    grid-area:rail!important;width:190px!important;max-width:190px!important;margin:0!important;padding:0!important;
  }
  body.content-section-page #contentApp .v69-content-detail-layout:has(.v49-reading)>.v69-content-detail-body,
  body.content-section-page #contentApp .v69-content-detail-layout:has(.v86-course-detail)>.v69-content-detail-body{
    grid-area:content!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important;min-width:0!important;
  }
}
.emkan-v136-learning-lead{
  width:100%!important;margin:0 0 26px!important;padding:0 0 18px!important;
  border-bottom:1px solid var(--line)!important;box-sizing:border-box!important;
}
.emkan-v136-learning-lead h1{margin:0 0 8px!important;font-size:21px!important;font-weight:620!important;line-height:1.65!important;color:var(--fg)!important}
.emkan-v136-learning-lead p{margin:0!important;max-width:760px!important;font-size:11px!important;line-height:2!important;color:var(--category-muted,var(--fg))!important}
:is(html[lang="fa"],html[lang="ar"]) .emkan-v136-learning-lead{text-align:right!important;direction:rtl!important}
html[lang="en"] .emkan-v136-learning-lead{text-align:left!important;direction:ltr!important}
body.content-section-page #contentApp .v49-reading.v136-has-lead>.v49-top{display:none!important}

/* --------------------------------------------------------------------------
   Covers: cards / project covers / product covers / service covers are square.
   Gallery frames, videos, office photos and long-form editorial imagery are not
   forcibly cropped unless they are a cover component.
   -------------------------------------------------------------------------- */
:is(
  .img-wrapper,.category-square,.store-square,.product-card-media,.related-item-media,
  .related-media,.v49-card-media,.v49-course-media,.v49-course-cover,.v49-work-media,
  .research-entry-media,.research-index-media,.dx-card-media,.dx-card-placeholder,
  .podcast-series-cover,.episode-cover,.player-cover,.v115-course-poster,
  .product-main-image,.learning-course-cover,.civil-entry-media img
){aspect-ratio:1/1!important;height:auto!important;min-height:0!important;overflow:hidden!important}
:is(
  .img-wrapper,.category-square,.store-square,.product-card-media,.related-item-media,
  .related-media,.v49-card-media,.v49-course-media,.v49-course-cover,.v49-work-media,
  .research-entry-media,.research-index-media,.dx-card-media,.v115-course-poster,
  .product-main-image,.learning-course-cover
) > img,
:is(.dx-card-media,.podcast-series-cover,.episode-cover,.player-cover,.learning-course-cover,.civil-entry-media img){
  width:100%!important;height:100%!important;object-fit:cover!important;
}
.product-main #productMainImage{aspect-ratio:1/1!important;height:auto!important;max-width:330px!important}
.product-main #productMainImage img{width:100%!important;height:100%!important;object-fit:cover!important}

/* Responsive: leave established mobile composition intact, only retain square covers. */
@media (max-width:900px){
  .emkan-v136-learning-lead{margin-bottom:20px!important;padding-bottom:14px!important}
  .emkan-v136-learning-lead h1{font-size:18px!important}
}

/* ========================================================================== 
   v136 finalization — unified enlargement, checkbox grammar, R&D rhythm
   ========================================================================== */

/* Education/report thumbnails stay square in-page. */
.v120-report-gallery img,
.v106-course-gallery-thumbs img,
.v73-sample-gallery img,
.learning-gallery img{
  aspect-ratio:1/1!important;
  width:100%!important;
  height:auto!important;
  object-fit:cover!important;
}

/* Expanded educational galleries follow the Architecture project viewer:
   a wide rectangular stage, natural image ratio, no square crop / bottom rail. */
.emkan-v135-viewer{
  position:fixed!important;
  inset:0!important;
  display:block!important;
  padding:0!important;
  background:rgba(8,10,13,.95)!important;
  backdrop-filter:blur(8px)!important;
  -webkit-backdrop-filter:blur(8px)!important;
  color:#f7f8fa!important;
}
.emkan-v135-viewer[hidden]{display:none!important}
.emkan-v135-viewer-stage{
  position:absolute!important;
  inset:46px 48px 48px!important;
  width:auto!important;height:auto!important;
  display:grid!important;place-items:center!important;
  overflow:hidden!important;
  background:transparent!important;
  border:0!important;
}
.emkan-v135-viewer-stage img{
  display:block!important;
  width:auto!important;height:auto!important;
  max-width:100%!important;max-height:100%!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center!important;
  border:0!important;box-shadow:none!important;
  border-radius:0!important;
  user-select:none!important;-webkit-user-drag:none!important;
}
.emkan-v135-viewer-close{
  position:absolute!important;z-index:8!important;
  top:12px!important;right:16px!important;left:auto!important;
  width:34px!important;height:34px!important;
  display:grid!important;place-items:center!important;
  padding:0!important;
  font:200 25px/1 Arial,sans-serif!important;
  opacity:.68!important;
}
.emkan-v135-viewer-prev,.emkan-v135-viewer-next{
  position:absolute!important;z-index:8!important;
  top:50%!important;transform:translateY(-50%)!important;
  width:38px!important;height:56px!important;
  display:grid!important;place-items:center!important;
  padding:0!important;opacity:.5!important;
}
.emkan-v135-viewer-prev:hover,.emkan-v135-viewer-next:hover,
.emkan-v135-viewer-prev:focus-visible,.emkan-v135-viewer-next:focus-visible{
  color:var(--hover-accent)!important;opacity:1!important;
}
html[lang="en"] .emkan-v135-viewer-prev{left:0!important;right:auto!important}
html[lang="en"] .emkan-v135-viewer-next{right:0!important;left:auto!important}
:is(html[lang="fa"],html[lang="ar"]) .emkan-v135-viewer-prev{right:0!important;left:auto!important}
:is(html[lang="fa"],html[lang="ar"]) .emkan-v135-viewer-next{left:0!important;right:auto!important}
:is(html[lang="fa"],html[lang="ar"]) .emkan-v135-viewer-prev svg,
:is(html[lang="fa"],html[lang="ar"]) .emkan-v135-viewer-next svg{transform:scaleX(-1)!important}
.emkan-v135-viewer-prev svg,.emkan-v135-viewer-next svg{
  width:17px!important;height:29px!important;fill:none!important;
  stroke:currentColor!important;stroke-width:1.15!important;
  stroke-linecap:round!important;stroke-linejoin:round!important;
}
/* Fully neutralize legacy education report viewers so there is only one visual system. */
.emkan-report-lightbox,.emkan-report-viewer,.emkan-gallery-lightbox{display:none!important}
body.emkan-lightbox-open:not(.emkan-v135-viewer-open){overflow:auto!important}
@media(max-width:700px){
  .emkan-v135-viewer-stage{inset:46px 28px 42px!important}
  .emkan-v135-viewer-close{right:8px!important}
  .emkan-v135-viewer-prev,.emkan-v135-viewer-next{width:28px!important}
}

/* Canonical checkbox: one restrained square everywhere, including admin.
   Removes inconsistent browser ticks / blue fills while keeping a clear state. */
html body input[type="checkbox"]{
  -webkit-appearance:none!important;appearance:none!important;
  width:14px!important;height:14px!important;min-width:14px!important;min-height:14px!important;
  margin:0!important;padding:0!important;
  border:1px solid color-mix(in srgb,var(--fg,#15181d) 34%,transparent)!important;
  border-radius:0!important;
  background-color:transparent!important;
  background-repeat:no-repeat!important;background-position:center!important;background-size:10px 10px!important;
  box-shadow:none!important;outline:0!important;
  vertical-align:middle!important;cursor:pointer!important;
  transition:border-color .16s ease,background-color .16s ease,opacity .16s ease!important;
}
html body input[type="checkbox"]:hover,
html body input[type="checkbox"]:focus-visible{border-color:var(--hover-accent,var(--accent,#4b7c91))!important}
html body input[type="checkbox"]:checked{
  border-color:var(--hover-accent,var(--accent,#4b7c91))!important;
  background-color:var(--hover-accent,var(--accent,#4b7c91))!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.1 8.2 6.35 11.25 12.9 4.8' fill='none' stroke='%23fff' stroke-width='1.55' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;
}
html body input[type="checkbox"]:disabled{opacity:.38!important;cursor:not-allowed!important}
html body label:has(>input[type="checkbox"]),
html body label:has(input[type="checkbox"]){align-items:center!important}

/* R&D now uses the same post-navigation vertical rhythm as the rest of EMKAN. */
body.emkan-v136-rd-landing .module-main{padding-top:36px!important}
body.emkan-v136-rd-section:not(:has(.research-entry-detail)) .detail-main{padding-top:34px!important}
body.emkan-v136-rd-section:has(.research-entry-detail) .detail-main{padding-top:54px!important}
body.emkan-v136-rd-articles .articles-main--architecture-tools{padding-top:34px!important}
body.emkan-v136-rd-article .article-page{padding-top:34px!important}
@media(max-width:900px){
  body.emkan-v136-rd-landing .module-main,
  body.emkan-v136-rd-section:not(:has(.research-entry-detail)) .detail-main,
  body.emkan-v136-rd-articles .articles-main--architecture-tools,
  body.emkan-v136-rd-article .article-page{padding-top:28px!important}
}
@media(max-width:560px){
  body.emkan-v136-rd-landing .module-main,
  body.emkan-v136-rd-section:not(:has(.research-entry-detail)) .detail-main,
  body.emkan-v136-rd-articles .articles-main--architecture-tools,
  body.emkan-v136-rd-article .article-page{padding-top:22px!important}
}

/* Keep the site visually one system: no module may override the shared line,
   accent, theme timing or cover radius with a local visual language. */
body:not([class*="admin"]) {
  --theme-duration:620ms;
  --theme-ease:cubic-bezier(.22,.61,.36,1);
}
body:not([class*="admin"]) :is(.category-card,.store-card,.product-card,.research-index-card,.v49-card,.v49-course){border-radius:0!important}

/* v136 final small guarantees */
body:not(:has(.sidebar)):not(:has(.side)){font-size:var(--emkan-v136-base-size,16px)}
.store-category-side .product-search:not(:has(.emkan-v136-store-search-icon))::after{
  content:"";position:absolute;z-index:4;top:50%;width:12px;height:12px;transform:translateY(-58%);opacity:.54;pointer-events:none;
  background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.55'%3E%3Ccircle cx='10.8' cy='10.8' r='6.1'/%3E%3Cpath d='M15.4 15.4 20 20'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.55'%3E%3Ccircle cx='10.8' cy='10.8' r='6.1'/%3E%3Cpath d='M15.4 15.4 20 20'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
}
:is(html[lang="fa"],html[lang="ar"]) .store-category-side .product-search:not(:has(.emkan-v136-store-search-icon))::after{left:9px;right:auto}
html[lang="en"] .store-category-side .product-search:not(:has(.emkan-v136-store-search-icon))::after{right:9px;left:auto}
