Make a Triangularity program valid Triangularity is a new esolang developed by Mr. Xcoder where code structure has to follow a very specific pattern:


For the nth line of code, there must be exactly 2n-1 characters of the program on  it.  This causes a triangular/pyramid shape, with the first line having only one character and the rest increasing by increments of 2.  
Each line must be padded with .s on the left and right, such that the characters are centered on their lines and all lines are padded to the same length. If l is defined as the number of lines in the program, each line in the program must have a length of 2 * l - 1


For example, the program on the left is valid, but the program on the right isn't:

 Valid    |  Invalid  
          |
...A...   |  ABCDE
..BCD..   |  FGH
.EFGHI.   |  IJKLMN
JKLMNOP   |  OPQRS


When laid out in the valid structure, the name becomes obvious.

Task

Your task is to take a single line string as input, representing Triangularity code, and output it converted into valid code as described above. 

Specifications for I/O:


The input will only contain characters in the range 0x20 - 0x7e
The length of the input always will be a square number and thus paddable nicely.
You must use dots for the output padding, not something else.


You may input and output through any acceptable method. This is a code-golf so the shortest code in bytes wins!

Test cases

input
----
output

g
----
g

PcSa
----
.P.
cSa

DfJ0vCq7G
----
..D..
.fJ0.
vCq7G

7xsB8a1Oqw5fhHX0
----
...7...
..xsB..
.8a1Oq.
w5fhHX0

QNYATbkX2sKZ6IuOmofwhgaef
----
....Q....
...NYA...
..TbkX2..
.sKZ6IuO.
mofwhgaef

ABCDEF"$%&amp; G8"F@
----
...A...
..BCD..
.EF"$%.
&amp; G8"F@

ab.c
----
.a.
b.c


For those who know Triangularity, you'll notice from the last test case that strings don't have to be handled
Triangularity, 127 bytes

.......).......
......2)1......
...../)IL^.....
....f)rMD@_....
...)2)1/)IL^...
..f+`"'.'*"+E..
.DWReD)2s^)Its.
D+@sh+s+})10cJ.


Try it online!

Explanation

Removing the characters that make up for the padding, we get the following program:

)2)1/)IL^f)rMD@_)2)1/)IL^f+`"'.'*"+EDWReD)2s^)ItsD+@sh+s+})10cJ


... Which is quite length-ish, right? Let's break it down into pieces.

Generating the integers [0 … √len(input))

)2)1/)IL^f)r – Subprogram #1.
)            – Creates a new stack entry, equal to 0. This must precede any integer
               literal, because each character in '0123456789' isn't parsed on its
               own as a literal, but rather they are commands which multiply the ToS
               by 10 and add the value of their digit equivalent. 
 2           – ToS * 10 + 2 = 2.           || STACK: [2]
  )1         – The literal 1.              || STACK: [2, 1]
    /        – Division.                   || STACK: [1 / 2] = [0.5]
     )I      – Get the input at index 0.   || STACK: [0.5, input]
       L     – Length.                     || STACK: [0.5, len(input)]
        ^    – Exponentiation.             || STACK: [len(input) ** 0.5]
         f   – Trim decimals.              || STACK: [int(len(input) ** 0.5)] 
          )r – Create the list [0 .. ToS). || STACK: [[0 ... int(len(input) ** 0.5))]


Generating the dots

MD@_)2)1/)IL^f+`"'.'*"+E – Subprogram #2.
MD                       – For each integer in the range, run some code on a separate
                           stack, preinitialised to two copies of the argument.
  @_                     – Increment and negate the ToS.
    )2)1/)IL^f           – The square root of the length of the input, again.
              +          – Add the two.
               `         – And cast the integer given to a string.
                "'.'*"+  – Prepends the literal "'.'*" to the string representation.
                       E – Evaluate as a Python expression (basically string repetition).


Trimming the characters at the front

DWReD)2s^)It – Subprogram #3.
D            – Duplicate the result of the expression above.
 W           – Wrap the whole intermediate stack to an array.
  Re         – Reverse the stack and dump the contents separately onto the stack.
    D        – Duplicate the result.
     )2      – Push the literal 2.
       s^    – Swap and perform exponentiation.
         )It – Push the input and trim the characters before that index.


Trimming the characters at the end

sD+@sh+s+ – Subprogram #4.
s         – Swap the top two elements on the stack.
 D+       – Double. Push twice and add.
   @      – Increment.
    sh    – Swap the top two elements and trim the characters after that index.
      +   – Append the first set of dots.
       s+ – And prepend the second set of dots.


Ending the loop and pretty-printing

})10cJ – Subprogram #5.
}      – End the loop.
 )10   – Push the literal 10.
    c  – Convert from code-point to character (yields '\n').
     J – And join the result by newlines.