/* EMKAN v139 — regression correction pass.
   Purpose: restore the approved thin/linear system after v138, without redesigning modules. */

/* --------------------------------------------------------------------------
   1) GLOBAL HEADER — thin again, and one clear step narrower than page content.
   Desktop geometry intentionally follows the older 34px approved nav rhythm.
   -------------------------------------------------------------------------- */
@media (min-width:1280px){
  html body .site-header{
    width:min(calc(100% - 240px),1300px)!important;
    max-width:1300px!important;
    margin-inline:auto!important;
  }
  html body .site-header .nav-frame{
    min-height:34px!important;
    height:34px!important;
    margin-top:14px!important;
  }
  html body .site-header .primary-nav{
    min-height:34px!important;
    height:34px!important;
    padding-inline:82px!important;
    display:flex!important;
    align-items:center!important;
  }
  html body .site-header .nav-list{
    min-height:0!important;
    height:auto!important;
    gap:clamp(18px,1.35vw,26px)!important;
  }
  html body .site-header .language-button{left:10px!important;right:auto!important;}
  html body .site-header .theme-button,
  html body .site-header .nav-frame>#themeButton.theme-button{right:10px!important;left:auto!important;}
}
@media (min-width:901px) and (max-width:1279px){
  html body .site-header{
    width:min(calc(100% - 72px),1100px)!important;
    max-width:1100px!important;
    margin-inline:auto!important;
  }
  html body .site-header .nav-frame{min-height:36px!important;height:36px!important;margin-top:14px!important;}
  html body .site-header .primary-nav{min-height:36px!important;height:36px!important;padding-inline:62px!important;display:flex!important;align-items:center!important;}
  html body .site-header .nav-list{min-height:0!important;height:auto!important;gap:clamp(10px,1.05vw,17px)!important;}
  html body .site-header .language-button{left:8px!important;right:auto!important;}
  html body .site-header .theme-button,
  html body .site-header .nav-frame>#themeButton.theme-button{right:8px!important;left:auto!important;}
}
@media (min-width:901px){
  html body .site-header .nav-frame{padding-block:0!important;box-sizing:border-box!important;align-items:center!important;}
  html body .site-header .primary-nav{margin:0!important;box-sizing:border-box!important;}
  html body .site-header .nav-list>li{min-height:0!important;height:auto!important;margin:0!important;padding:0!important;align-items:center!important;}
  html body .site-header .nav-link{padding-block:0!important;line-height:1.25!important;}
  html body .site-header :is(.language-button,.theme-button){top:50%!important;transform:translateY(-50%)!important;margin:0!important;}
}

/* --------------------------------------------------------------------------
   2) CARD/COVER RHYTHM — same breathing room as Architecture.
   v138 accidentally made some grids inherit a zero gap; explicitly restore it.
   -------------------------------------------------------------------------- */
@media (min-width:901px){
  body:not([class*="admin"]) :is(
    .category-grid,.store-grid,.product-grid,.related-grid,.people-grid,
    .research-index-grid,.v49-grid,.v49-work-grid,.v74-level2-grid,
    .v74-sample-grid,.v73-portfolio-grid,.dx-grid
  ){
    column-gap:clamp(26px,3vw,48px)!important;
    row-gap:clamp(46px,5.2vw,70px)!important;
  }
}
@media (max-width:900px){
  body:not([class*="admin"]) :is(
    .category-grid,.store-grid,.product-grid,.related-grid,.people-grid,
    .research-index-grid,.v49-grid,.v49-work-grid,.v74-level2-grid,
    .v74-sample-grid,.v73-portfolio-grid,.dx-grid
  ){
    column-gap:14px!important;
    row-gap:26px!important;
  }
}

/* --------------------------------------------------------------------------
   3) DROPDOWNS / FILTERS — compact, linear, no inflated vertical rhythm.
   Main navigation is deliberately excluded.
   -------------------------------------------------------------------------- */
:is(
  .category-list ul,.article-category-list ul,.detail-subcategory-list,
  .v49-filter-list,.podcast-filter-list,.podcast-topics,.podcast-seasons,
  .store-subcategory-list,.store-sort-list,.civil-filter-list,.research-filter-list,
  .research-category-list,.article-filter-list,.emkan-filter-list
){
  gap:0!important;
  row-gap:0!important;
  padding-top:2px!important;
  padding-bottom:0!important;
  margin-top:0!important;
}
:is(
  .category-button,.article-category-choice,.detail-subcategory-list a,
  .v49-filter-option,.podcast-filter-list button,.podcast-topics button,
  .podcast-seasons button,.store-subcategory-list a,.store-sort-list button,
  .civil-filter-list button,.research-filter-list button,.research-category-list button,
  .emkan-landing-category,.emkan-filter-list button,.emkan-filter-list a
){
  min-height:0!important;
  margin:0!important;
  padding:2px 0!important;
  line-height:1.34!important;
}
:is(
  .store-subcategory-filter,.store-sort-filter,.research-filter,
  .article-category-filter,.category-filter
)>summary{
  min-height:22px!important;
  padding-block:2px!important;
  line-height:1.35!important;
}

/* --------------------------------------------------------------------------
   4) STORE SEARCH — exactly one search. The legacy generated proxy is retired.
   -------------------------------------------------------------------------- */
.store-category-side .emkan-store-search-proxy,
.emkan-store-filter-rail .emkan-store-search-proxy{display:none!important;}
.store-category-side>.product-search,
.store-category-side .product-search:has(#productSearch){
  display:block!important;
  visibility:visible!important;
  position:relative!important;
  width:100%!important;
  min-height:28px!important;
  margin:0 0 14px!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}
.store-category-side .product-search>span[class^="lang-"]{display:none!important;}
.store-category-side .product-search::before,
.store-category-side .product-search::after{display:none!important;content:none!important;}
.store-category-side .product-search>:is(svg,i):not(.emkan-v139-store-search-icon){display:none!important;}
.store-category-side .product-search #productSearch{
  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 #productSearch:is(:hover,:focus){border-bottom-color:var(--hover-accent)!important;}
:is(html[lang="fa"],html[lang="ar"]) .store-category-side .product-search #productSearch{
  direction:rtl!important;text-align:right!important;padding-inline:0 24px!important;
}
html[lang="en"] .store-category-side .product-search #productSearch{
  direction:ltr!important;text-align:left!important;padding-inline:0 24px!important;
}
.store-category-side .product-search>.emkan-v139-store-search-icon{
  display:block!important;visibility:visible!important;position:absolute!important;z-index:6!important;
  top:50%!important;width:12px!important;height:12px!important;transform:translateY(-58%)!important;
  fill:none!important;stroke:currentColor!important;stroke-width:1.5!important;
  stroke-linecap:round!important;stroke-linejoin:round!important;
  color:var(--category-muted,var(--fg))!important;opacity:.58!important;pointer-events:none!important;
}
:is(html[lang="fa"],html[lang="ar"]) .store-category-side .product-search>.emkan-v139-store-search-icon{left:7px!important;right:auto!important;}
html[lang="en"] .store-category-side .product-search>.emkan-v139-store-search-icon{right:7px!important;left:auto!important;}

/* --------------------------------------------------------------------------
   5) R&D / ARTICLES — same post-nav vertical rhythm as the other modules.
   v136's 34px module padding was the source of the visible oversized gap.
   -------------------------------------------------------------------------- */
@media (min-width:901px){
  body.emkan-v136-rd-landing .module-main,
  body.emkan-v136-rd-section .detail-main,
  body.emkan-v136-rd-articles .articles-main--architecture-tools,
  body.emkan-v136-rd-article .article-page{
    padding-top:7px!important;
    margin-top:0!important;
  }
  body.emkan-v136-rd-section .emkan-context-bar,
  body.emkan-v136-rd-articles .emkan-context-bar,
  body.emkan-v136-rd-article .emkan-context-bar{
    margin-top:5px!important;
    margin-bottom:18px!important;
  }
}

/* --------------------------------------------------------------------------
   6) ACCOUNT THEME ICON — same physical size as the rest of the site.
   -------------------------------------------------------------------------- */
.account-language-rail #themeToggle,
.account-language-rail .theme-toggle,
.account-language-rail .auth-theme-inline{
  width:30px!important;height:30px!important;min-width:30px!important;min-height:30px!important;
  padding:0!important;margin-inline-start:6px!important;display:inline-grid!important;place-items:center!important;
}
.account-language-rail #themeToggle :is(svg,i),
.account-language-rail .theme-toggle :is(svg,i),
.account-language-rail .auth-theme-inline :is(svg,i),
.account-language-rail #themeToggle .emkan-v133-theme-icon,
.account-language-rail #themeToggle .emkan-v132-theme-moon,
.account-language-rail #themeToggle .emkan-v132-theme-sun{
  width:13.5px!important;height:13.5px!important;font-size:13.5px!important;line-height:13.5px!important;
}

/* Guardrail: card radius and thin rules remain one language everywhere. */
body:not([class*="admin"]) :is(.category-card,.store-card,.product-card,.research-index-card,.v49-card,.v49-course,.gallery-item){border-radius:0!important;}

/* Specificity guard for older module sheets that used !important on opened lists. */
html body :is(
  .category-list ul,.article-category-list ul,.detail-subcategory-list,
  .v49-filter-list,.podcast-filter-list,.podcast-topics,.podcast-seasons,
  .store-subcategory-list,.store-sort-list,.civil-filter-list,.research-filter-list,
  .research-category-list,.article-filter-list,.emkan-filter-list
){gap:0!important;row-gap:0!important;padding-top:2px!important;padding-bottom:0!important;margin-top:0!important;}
html body .articles-main--architecture-tools .article-category-list ul{gap:0!important;row-gap:0!important;}
html body :is(
  .category-button,.article-category-choice,.detail-subcategory-list a,
  .v49-filter-option,.podcast-filter-list button,.podcast-topics button,
  .podcast-seasons button,.store-subcategory-list a,.store-sort-list button,
  .civil-filter-list button,.research-filter-list button,.research-category-list button,
  .emkan-landing-category,.emkan-filter-list button,.emkan-filter-list a
){min-height:0!important;margin:0!important;padding:2px 0!important;line-height:1.34!important;}
