ASCII Art of the Day #3 - Chinese Shrines In today's episode of AAOD, we are going to construct a Chinese Shrine of varying heights.

Consider the following examples for height (N) 1 to 6

N = 1:

       .
       |
  .   ]#[   .
   \_______/
.    ]###[    .
 \__]#.-.#[__/
  |___| |___|
  |___|_|___|
  ####/_\####
     |___|
    /_____\


N = 2:

         .
         |
    .   ]#[   .
     \_______/
  .    ]###[    .
   \___________/
.     ]#####[     .
 \___]#.---.#[___/
  |__|_|   |_|__|
  |__|_|___|_|__|
  #####/___\#####
      |_____|
     /_______\


N = 3:

           .
           |
      .   ]#[   .
       \_______/
    .    ]###[    .
     \___________/
  .     ]#####[     .
   \_______________/
.      ]#######[      .
 \____]#.-----.#[____/
  |__|__|     |__|__|
  |__|__|_____|__|__|
  ######/_____\######
       |_______|
      /_________\


N = 4:

             .
             |
        .   ]#[   .
         \_______/
      .    ]###[    .
       \___________/
    .     ]#####[     .
     \_______________/
  .      ]#######[      .
   \___________________/
.       ]#########[       .
 \_____]##.-----.##[_____/
  |__|__|_|     |_|__|__|
  |__|__|_|_____|_|__|__|
  ########/_____\########
         |_______|
        /_________\


N = 5: 

               .
               |
          .   ]#[   .
           \_______/
        .    ]###[    .
         \___________/
      .     ]#####[     .
       \_______________/
    .      ]#######[      .
     \___________________/
  .       ]#########[       .
   \_______________________/ 
.        ]###########[        .
 \______]###.-----.###[______/
  |__|__|___|     |___|__|__|
  |__|__|___|_____|___|__|__|
  ##########/_____\##########
           |_______|
          /_________\


N = 6: 

                 .
                 |
            .   ]#[   .
             \_______/
          .    ]###[    .
           \___________/
        .     ]#####[     .
         \_______________/
      .      ]#######[      .
       \___________________/
    .       ]#########[       .
     \_______________________/ 
  .        ]###########[        .
   \___________________________/ 
.         ]#############[         .
 \_______]####.-----.####[_______/
  |__|__|__|__|     |__|__|__|__|
  |__|__|__|__|_____|__|__|__|__|
  ############/_____\############
             |_______|
            /_________\


and so on.

Construction Details

I am sure most of the details about the pattern are clear. Here are some finer details:


The door at the bottom of the shrine can at minimum be of 1 _ width and at maximum be of 5 _ width.
There will always be two . directly above the pillars around the door (two vertical |).
The stairs start with the same width as the door and increase like show in the pattern
The ]##..##[ blocks above each roof level increase in size of 2 from top to bottom.
The \__...__/ roofs levels increase in size of 4 from top to bottom.
The walls blocks around the door should at minimum contain 1 _ and at maximum, 3 _ between the two |. Priority goes to the outer wall blocks so that the one closest to the door gets a varying size for each level.
The space between the . and the ] (or [) is filled by # in the roof just above the doors.


Challenge Details


Write a function or full program that reads a positive integer greater than 0 via STDIN/ARGV/function argument or closest equivalent and outputs (to STDOUT or closest equivalent) the Nth Chinese Shrine
Trailing newline is optional.
There should either be no trailing spaces or enough trailing spaces to pad the output in the minimum bounding rectangle.
There should not be any leading spaces that are not part of the pattern.


Leaderboard

The first post of the series generates a leaderboard.

To make sure that your answers show up, please start every answer with a headline, using the following Markdown template:

# Language Name, N bytes


where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, &lt;s&gt;104&lt;/s&gt; &lt;s&gt;101&lt;/s&gt; 96 bytes
Perl, 332 316 294

$:=($w=&lt;&gt;)*2+6;$r=2x($m=$w&gt;3?3:$w);$k=1x($w-3).b.4x$m;
y!a-f1-4!/.|\\[,#_ -!,/,/,s/(.*),(.*).{@{-}}/$2$1/,printf"%$:s%s
",y!/\\[!\\/]!r,(reverse=~s/.//r)for@x=(b,c,
(map{b33.3x$_.e.1x$_,"[#$k,"x/$w/.a__.22x$_}1..++$w),
_c.3x$m.f.($z=substr"|__"x$:,0,2*++$w),"_|$r,$z","d$r,".11x$w,c_.$r,d__.$r)


Try me.

C, 371

d,i,w;char s[1&lt;&lt;24];m(){v(w,13);}p(){puts(s+1);}
v(i,j){s[w-i]=".|]\\#/"[j%7];s[w+i]=".|[/#\\"[j%7];
while(i--)s[w-i]=s[w+i]="# _-"[j/7];}
main(l){scanf("%d",&amp;l);d=l&gt;3?3:l;m(w=l*2+6);p(v(0,0));
for(v(0,1);i++&lt;=l;v(i*2+2,17))p(),v(i*2+3,7),m(p(v(i,2)));v(l+2,2);p(v(d,21));
for(m(i=w-3);i&gt;d+1;i-=3)v(i,15);p(v(d,8));p(v(d,15));
v(w-3,4);m(p(v(d,19)));p(v(d+1,15));p(v(d+2,19));}


Try me.

JavaScript, 365

The above can be translated almost 1 to 1 into JavaScript:

s=[];r="";i=0;m=()=&gt;v(w,13);p=()=&gt;r+=s.join('')+"\n";
v=(i,j)=&gt;{s[w-i]=".|]\\#/"[j%7];s[w+i]=".|[/#\\"[j%7];
while(i--)s[w-i]=s[w+i]="# _-"[j/7|0];};
f=l=&gt;{d=l&gt;3?3:l;m(w=l*2+6);p(v(0,0));
for(v(0,1);i++&lt;=l;v(i*2+2,17))p(),v(i*2+3,7),m(p(v(i,2)));v(l+2,2);p(v(d,21));
for(m(i=w-3);i&gt;d+1;i-=3)v(i,15);p(v(d,8));p(v(d,15));
v(w-3,4);m(p(v(d,19)));p(v(d+1,15));p(v(d+2,19));}


Use:

f(2);console.log(r)