g | x | w | all
Bytes Lang Time Link
099Vyxal211217T002253Zemanresu
404Charcoal211219T215212Zjixperso
280Vyxal210620T074440Zemanresu
200CJam150531T090438Zaditsu q
660C150523T205406ZReto Kor
294Perl150523T124819Znutki
440JavaScript ES6150523T144958Zedc65
473Haskell150523T082317ZDamien
344Python 2150522T183842ZMatty

Vyxal, 120 113 107 101 100 99 bytes

3∵£\.\|?›(‛.[n⇧Ij\#n*+\\\_n›d*+)?⇧Ẏ‛].?⇩1∴\#*j+¥-‛_|:ǏǓ?₌⇧d‹∴Ẏp¥꘍:ð\_VȮȧL‛#/e2Ǔ‛|/fJ2ʀ¥+\_*+÷WøMøĊ⁋

Try it Online!

Posting this as a separate answer because it's so golfed, and uses the latest version of Vyxal.

Explanation

----------------- TOP ------------
3∵£\.\|?›(‛.[n⇧Ij\#n*+\\\_n›d*+)
3∵£                              # Store min(input, 3) into the register for later use 
   \.\|                          # Push a . and a |
       ?›(                     ) # For each of 1...n+1, push
          ‛.[   j                # ".[" joined by
             n⇧I                 # that+2 spaces
                 \#n*+           # Append that many #
                        \_n›d*   # And push 2*that+2 underscores
                      \\      +  # Appended to a \
------------------- Doorway ------------------
?⇧Ẏ‛].?⇩1∴\#*j+¥-‛_|:ǏǓ?₌⇧d‹∴Ẏp¥꘍:ð\_V 
?⇧Ẏ           +                         # To the last of what was pushed in the previous, take the first input+2 characters and append
   ‛].       j                          # "]." joined by
      ?⇩1∴\#*                           # max(input-2,1) hashes 
               ¥-                       # Append min(input,3) -
                        ?₌⇧d‹∴          # max(input+2, 2*input-1)
                  ‛_|:ǏǓ      Ẏ         # Repeat '|__' to that length
                  ‛_|          p        # Append '_|'
                                ¥꘍      # Append min(input,3) spaces
                                  :ð\_V # Make a copy, and replace spaces with underscores 

---------- Entrance ------------
ȮȧL‹\#*\/+
ȮȧL                     # Length of top part of doorway with whitespace removed
   ‛#/e2Ǔ               # That-1 #, plus a /
         ‛|/fJ          # Append ['|','/']
              2ʀ¥+      # [a,a+a,a+2] where a = min(3,input)
                  \_*+  # That many underscores appended to each of previous
                      ÷ # Iterate out those on the stack

- Final magic bit -
W      # Get the stack
 øM    # Palindromise each, mirroring brackets
   øĊ  # Center each 
     ⁋ # Join on newlines

Charcoal, 404 bytes

≔Nν≔⁺⁵ײνη≔× ⁻η⁻∕¹¦²¦¹τ⁺⁺⁺⁺⁺τ.¶τ|¶× ⁻η⁻∕¹²¦²¦¹“±∨N"G:W⮌+”Fν«≔⁺⁺\×_⁺⁷×⁴ι/ε≔× ⁻η⁻∕L岦¹τ⁺⁺τε¶≔⁺⁺⁺⁺.× ⁺ι⁴]×#⁺³×²ι⁺⁺[× ⁺ι⁴.ε≔× ⁻η⁻∕L岦¹τ⁺⁺τε¶»≔⁻ײ⌊⟦³ν⟧¹δ≔∕δ²ζ≔×#⁺¹⁻νζσ≔⁺⁺⁺⁺⁺\×_⁺ν¹]σ.⁺×-δ⁺.⁺σ⁺[⁺×_⁺ν¹/ε≔× ⁻η⁻∕L岦¹τ⁺⁺τε¶≔×|__νε≔⁻⁻⁺⁴ײνζ¹τ≔✂ε⁰τ¦¦ε≔Lεα≔⁻Lε¹β¿⁼✂εβᦦ|«≔⁺✂ε⁰⦦_ε»≔⁺✂ε⁰ᦦ|ε≔⁺⁺ε× δ⮌εα≔⁺⁺ε×_δ⮌εβM⁼ν¹¦⁰⁺⁺⁺⁺  ᶦ  βM±⁼ν¹¦⁰M±Lα⁰≔×#⁻⁺⁴ײ⁻ν·⁵ζε⁺¶⁺⁺ε⁺/⁺⁺×_δ\ε¶≔⁻⁻⁺⁴ײ⁻ν·⁵ζ¹ψ⁺× ψ⁺|⁺×_⁺δ²|¶⁺× ⁻ψ¹⁺/⁺×_⁺δ⁴\

Try it online!

Vyxal, 280 bytes

d5+\.꘍,d5+\|꘍,(n-d:£\.꘍3n+\]꘍\#nd›*\[3n+\.꘍Ṡ,¥›\\꘍ndd7+\_*\/Ṡ,)\.?3+꘍\]\#?d›*\[?3+\.꘍Ṡ,ð\\?›\_*\]?2-1∴\#*\.?d‹5∵-\.?2-1∴\#*\[?›\_*\/Ṡ,3<[⟨0|⟨3⟩|⟨2|1⟩⟩$i|3/⌊d2w$ẋf`013`?3%iIJ';]\_*Ṅðpð+ð\|Vðdp:£3?∵꘍øm,¥3?∵\_*+øm,4<[3+|d]\#*:£ðdp\/\_?d‹5∵*\\¥Ṡ,¥L›\|꘍\_?d‹5∵⇧*\|Ṡ,¥L\/꘍\_?d‹5∵4+*\\Ṡ,

Try it Online! No, I'm not explaining this.

CJam, 200 bytes

-4'.-4'|]2/ri:M),{2af.-~[W'.I3+~']'#I)*][-2'\'_I2*4+*]]}fI~[~M)<']
M2m1e>'#*'.'-M3e<:D*][-3"|__"M*M2+M2*(e>:L<"_|"D~][_~~'_*][-3'#L)*
'/'_D*][L2+~'|'_D)*][L)~'/'_D2+*]]{{_0<{~S*}&}%s_W%1>"\/]""/\["erN}%

Newlines added to avoid scrolling. Try it online

Brief explanation:

The program builds the left half of the shrine (including the middle), then reverses it and replaces some characters to get the right half. A series of n spaces is represented as the number ~n (bitwise "not") during construction, and replaced with the actual spaces at the end.

The program starts with the top 2 lines, then for each roof level, it prepends all the previous lines with 2 spaces and adds the new roof (2 lines). The last roof is modified to add the "above door" part.

Next, the upper wall is built by repeating "|__" and truncating at the right length, followed by a fixed "_|" and spaces. The wall is then duplicated and the door spaces are replaced with underscores. Finally, the lower part is constructed line by line.

C, 660 bytes

The pattern just seemed to be too irregular to come up with anything fancy, particularly in a language without string processing. So here is my brute force approach:

m,d,w,k,j;r(n,c){for(j=0;j++<n;)putchar(c);}c(char*s){for(;*s;)putchar(*s++);}f(n){m=n*2;d=n<3?m-1:5;w=m-d/2+2;r(m+5,32);c(".\n");r(m+5,32);c("|\n");for(;;){r(m-k*2,32);c(".");r(k+3,32);c("]");r(k*2+1,35);c("[");r(k+3,32);c(".\n");if(k==n)break;r(m-k*2+1,32);c("\\");r(k++*4+7,95);c("/\n");}c(" \\");r(n+1,95);c("]");r(n-d/2,35);c(".");r(d,45);c(".");r(n-d/2,35);c("[");r(n+1,95);c("/\n");for(k=0;k<2;){c("  ");for(j=0;j<w/3;++j)c("|__");c("|_|"-w%3+2);r(d,k++?95:32);c(!w%3?"|":w%3<2?"|_":"|_|");for(j=0;j<w/3;++j)c("__|");c("\n");}c("  ");r(w,35);c("/");r(d,95);c("\\");r(w,35);c("\n");r(w+1,32);c("|");r(d+2,95);c("|\n");r(w,32);c("/");r(d+4,95);c("\\\n");}

Before golfing:

#include <stdio.h>

void r(int n, int c) {
    for (int i = 0; i++ < n; )
        putchar(c);
}

void c(char* s) {
    for (; *s; ++s) putchar(*s);
}

int f(int n) {
    int m = n * 2;
    int d = n < 3 ? m - 1 : 5;
    int w = m - d / 2 + 2;

    r(m + 5, 32);
    c(".\n");

    r(m + 5, 32);
    c("|\n");

    for (int k = 0; ; ++k) {
        r(m - k * 2, 32);
        c(".");
        r(k + 3, 32);
        c("]");
        r(k * 2 + 1, 35);
        c("[");
        r(k + 3, 32);
        c(".\n");

        if (k == n) break;

        r(m - k * 2 + 1, 32);
        c("\\");
        r(k * 4 + 7, 95);
        c("/\n");
    }

    c(" \\");
    r(n + 1, 95);
    c("]");
    r(n - d / 2 , 35);
    c(".");
    r(d, 45);
    c(".");
    r(n - d / 2 , 35);
    c("[");
    r(n + 1, 95);
    c("/\n");

    for (int k = 0; k < 2; ++k) {
        c("  ");
        for (int j = 0; j < w / 3; ++j)
            c("|__");
        c("|_|" - w % 3 + 2);
        r(d, k ? 95 : 32);
        c(!w % 3 ? "|" : w % 3 < 2 ? "|_" : "|_|");
        for (int j = 0; j < w / 3; ++j)
            c("__|");
        c("\n");
    }

    c("  ");
    r(w, 35);
    c("/");
    r(d, 95);
    c("\\");
    r(w, 35);
    c("\n");

    r(w + 1, 32);
    c("|");
    r(d + 2, 95);
    c("|\n");

    r(w, 32);
    c("/");
    r(d + 4, 95);
    c("\\\n");

    return 0;
}

Not much to explain here. It just goes line by line, and generates the necessary count of each character. I tried to keep the code itself compact, but it still adds up. d is the width of the door, w the width of each brick wall.

Perl, 332 316 294

$:=($w=<>)*2+6;$r=2x($m=$w>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<<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",&l);d=l>3?3:l;m(w=l*2+6);p(v(0,0));
for(v(0,1);i++<=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>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=()=>v(w,13);p=()=>r+=s.join('')+"\n";
v=(i,j)=>{s[w-i]=".|]\\#/"[j%7];s[w+i]=".|[/#\\"[j%7];
while(i--)s[w-i]=s[w+i]="# _-"[j/7|0];};
f=l=>{d=l>3?3:l;m(w=l*2+6);p(v(0,0));
for(v(0,1);i++<=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>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)

JavaScript (ES6), 440

Edit Fixed lintel bug

A function whith height as a parameter, output to console.

Using template string a lot, all newlines are significant and counted.

Run snippet to test in Firefox (with console output)

f=x=>{R=(n,s=0)=>' #_-'[s][Z='repeat'](n),M=c=>R(2)+'|__'[Z](z+1).slice(0,z-1)+'_|'+R(y,c)+'|_'+'__|'[Z](z+1).slice(1-z)
for(z=x+x+(x<2)+(x<3),y=x>2?5:x>1?3:1,l=-1,o=`${t=R(x+x+5)}.
${t}|
`;l++<x;)o+=`${t=R(x+x-l-l)}.${u=R(l+3)}]${R(l*2+1,1)}[${u}.
 ${t}\\${l-x?R(7+l*4,2):`${t=R(x+1,2)}]${u=R(x<3||x-2,1)}.${R(y,3)}.${u}[${t}`}/
`;console.log(`${o+M(0)}
${M(2)}
${R(2)}${t=R(z,1)}/${u=R(y,2)}\\${t}
${R(1+z)}|__${u}|
${R(z)}/____${u}\\`)}

// TEST
f(1),f(2),f(3),f(4),f(5),f(6)
Output 1 to 6 in console

Ungolfed version for interactive test:

// Not so golfed

f=x=>{
  R=(n,s=0)=>' #_-'[s].repeat(n); // base building blocks
  M=c=>R(2)+'|__'.repeat(z+1).slice(0,z-1)+'_|'+R(y,c)+'|_'+'__|'.repeat(z+1).slice(1-z); // manage door level

  z=x+x+(x<2)+(x<3); // door and stairs surroundings
  y=x>2?5:x>1?3:1; // door and stairs width
  
  o = `${R(x+x+5)}.\n${R(x+x+5)}|\n`; // top 
  for(l=-1;l++<x;)
    o += `${ // even row
      t=R(x+x-l-l) // left padding
    }.${
      u=R(l+3)
    }]${
      R(l*2+1,1)
    }[${
      u
    }.\n ${ // end even row, start odd row
      t // left padding
    }\\${
      l-x?R(7+l*4,2)
      :`${t=R(x+1,2)}]${u=R(x<3||x-2,1)}.${R(y,3)}.${u}[${t}` // if last row before the door, insert lintel 
    }/\n`;
  
  o += `${
    M(0) // door level row 1
  }\n${
    M(2) // door level row 2
  }\n${
    R(2)}${t=R(z,1)}/${u=R(y,2)}\\${t  // stairs row 1
  }\n${ 
    R(1+z)}|__${u  // stairs row 2
  }|\n${ 
    R(z)}/____${u // stairs row 3
  }\\`;
  
  out(o)
}

out=x=>O.innerHTML=x

f(3)
<input id=I value=3><button onclick='f(+I.value)'>-></button><br>
<pre id=O></pre>

Haskell, 473 bytes

g '\\'='/'
g '/'='\\'
g '['=']'
g ']'='['
g x=x
z=reverse
d=min 3
m n s=putStrLn$(6+2*n+1-length s)#' '++map g(z s)++tail s
n#c=replicate n c
t 0=".";t n=n#'#'++"["++(2+n)#' '++"."
r 0="|";r n=(2+2*n)#'_'++"/"
q n=d n#'-'++"."++max(n-2)1#'#'++"["++(n+1)#'_'++"/"
e i n=d n#i++"|_"++z(take(max(n+2)(2*n-1))(cycle"|__"))
b n=d n#'_'++"\\"++max(2*n)(3+n)#'#'
w i n=(d n+1+i)#'_'++["|","\\"]!!i
f n=mapM_(m n)$[u k|k<-[0..n],u<-[t,r]]++(t(n+1):map($n)[q,e ' ',e '_',b,w 0,w 1])

Python 2, 356 352 347 344 bytes

n=input()
A,B,C,D,E,F,G,H,I='_ |\/#.]['
def p(*S):
 for s in S:print(5+2*n-len(s)/2)*B+s
p(G,C,'.   ]#[   .')
for i in range(n):b=B*(4+i);p(D+A*(7+4*i)+E,G+b+H+F*(3+2*i)+I+b+G)
d=2*min(3,n)-1
a=A*(2+i)
f=F*(1+i-d/2)
j=4+2*i-d/2
w=('|__'*n)[:j-1]+A+C
v=w[::-1]
p(D+a+H+f+G+'-'*d+G+f+I+a+E,w+B*d+v,w+A*d+v,F*j+E+A*d+D+F*j,C+A*(d+2)+C,E+A*(d+4)+D)

This basically builds the shrine line by line. The function p prints a string with the spaces needed to center it.

I used python 2 to save lots of bytes, because the python 3 map object doesn't trigger. I guess I should always golf in python 2, just saves a few more bytes (even if it's just to not have to parse the input to int). Hehehe, it's not like code's pretty for golfing in the first place.

Edit: and of course, I now don't need the map anymore...

Here's the code in ungolfed form:

n = int(input())

# A function to print strings centered
half_width = 5 + 2*n
def p(string):
    spaces = ' ' * (half_width - len(string) // 2)
    print(spaces + string)

# The rooftops
p('.')
p('|')
p('.   ]#[   .')
for i in range(n):
    p('\\' + '_'*(7 + 4*i) + '/')
    p('.{0}]{1}[{0}.'.format(' '*(i + 4), '#'*(3 + 2*i)))

# The bottom rooftop
door_width = 2 * min(3, n) - 1
# (11+4i - (3+2i) - 4) / 2 = (4 + 2i) / 2 = 2 + i
p('\{0}]{1}.{2}.{1}[{0}/'.format('_'*(2 + i), '#'*(1 + i - door_width // 2), '-'*door_width))

# The windows
w = '|__'*n
w = w[:4 + 2*i  - door_width // 2]
if w[-1] == '|':
    w = w[:-1] + '_'
w += '|'
p(w + ' '*door_width + w[::-1])
p(w + '_'*door_width + w[::-1])

# The foundation and the stairs
w = '#'*(4 + 2*i - door_width // 2)
p(w + '/' + '_'*(door_width) + '\\' + w)

# The remaining stairs
p('|' + '_'*(door_width + 2) + '|')
p('/' + '_'*(door_width + 4) + '\\')