layerinfo "type" = "layout";
layerinfo "name" = "Tabula Rasa";
layerinfo redist_uniq = "core2base/layout";

##===============================
## Presentation
##===============================

propgroup presentation {
    property use layout_type;
    property use num_items_recent;
    property use num_items_reading;
    property use use_custom_friend_colors;
    property use use_shared_pic;
    property use use_journalstyle_entry_page;
    property use margins_size;
    property use margins_unit;
    property use sidebar_width;
    property use sidebar_width_doubled;
    property use medium_breakpoint_width;
    property use large_breakpoint_width;
    property use custom_control_strip_colors;

    property use reverse_sortorder_group;
    property use reg_firstdayofweek;
    property use tags_page_type;
    property use num_items_icons;
    property use icons_page_sort;

    property use all_entrysubjects;
    property use all_commentsubjects;
    property use entry_datetime_format_group;
    property use comment_datetime_format_group;
    property use userpics_style_group;
    property use userpics_position;
    property use entry_metadata_position;
    property use userlite_interaction_links;
    property use entry_management_links;
    property use comment_management_links;

}

set layout_type = "one-column";
set sidebar_width = "15em";
set sidebar_width_doubled = "30em";
set userpics_position = "left";
set use_custom_friend_colors = false;
set custom_foreground_element = "userpic_border";
set custom_background_element = "userpic_background";

##===============================
## Colors
##===============================

propgroup colors {
    property use color_page_background;
    property use color_page_text;
    property use color_page_link;
    property use color_page_link_active;
    property use color_page_link_hover;
    property use color_page_link_visited;
    property use color_page_border;

    property use color_module_background;
    property use color_module_text;
    property use color_module_link;
    property use color_module_link_active;
    property use color_module_link_hover;
    property use color_module_link_visited;
    property use color_module_title_background;
    property use color_module_title;
    property use color_module_border;

    property use color_header_background;
    property use color_page_title;

    property use color_footer_background;
    property use color_footer_link;
    property use color_footer_link_active;
    property use color_footer_link_hover;
    property use color_footer_link_visited;

    property use color_entry_background;
    property use color_entry_text;
    property use color_entry_link;
    property use color_entry_link_active;
    property use color_entry_link_hover;
    property use color_entry_link_visited;
    property use color_entry_title_background;
    property use color_entry_title;
    property use color_entry_interaction_links;
    property use color_entry_interaction_links_active;
    property use color_entry_interaction_links_hover;
    property use color_entry_interaction_links_visited;
    property use color_entry_border;

    property use color_comment_title_background;
    property use color_comment_title;

    property use control_strip_bgcolor;
    property use control_strip_fgcolor;
    property use control_strip_bordercolor;
    property use control_strip_linkcolor;
}

##===============================
## Fonts
##===============================

propgroup fonts {
    property use font_base;
    property use font_fallback;
    property use font_base_size;
    property use font_base_units;
    property use font_module_heading;
    property use font_module_heading_size;
    property use font_module_heading_units;
    property use font_module_text;
    property use font_module_text_size;
    property use font_module_text_units;
    property use font_journal_title;
    property use font_journal_title_size;
    property use font_journal_title_units;
    property use font_journal_subtitle;
    property use font_journal_subtitle_size;
    property use font_journal_subtitle_units;
    property use font_entry_title;
    property use font_entry_title_size;
    property use font_entry_title_units;
    property use font_comment_title;
    property use font_comment_title_size;
    property use font_comment_title_units;
    property use font_sources;
}

set font_base = "";
set font_fallback = "";
set font_base_size = "100";
set font_base_units = "%";

##===============================
## Images
##===============================

propgroup images {
    property use image_background_page_group;
    property use image_background_module_group;
    property use image_background_header_group;
    property use image_background_header_height;
    property use image_background_entry_group;
}

##===============================
## Modules
##===============================

propgroup modules {
    property use module_userprofile_group;
    property use module_navlinks_group;
    property use module_calendar_group;
    property use module_links_group;
    property use module_syndicate_group;
    property use module_tags_group;
    property use module_pagesummary_group;
    property use module_active_group;
    property use module_time_group;
    property use module_poweredby_group;
    property use module_customtext_group;
    property use module_credit_group;
    property use module_search_group;
    property use module_cuttagcontrols_group;
    property use module_subscriptionfilters_group;
}

# Explicitly define what sections the layout has available
set module_layout_sections = "none|(none)|one|Main Module Section|two|Secondary Module Section";

##===============================
## Text
##===============================

propgroup text {

    property use text_module_userprofile;
    property use text_module_links;
    property use text_module_syndicate;
    property use text_module_tags;
    property use text_module_popular_tags;
    property use text_module_pagesummary;
    property use text_module_active_entries;
    property use text_module_customtext;
    property use text_module_customtext_url;
    property use text_module_customtext_content;
    property use text_module_credit;
    property use text_module_search;
    property use text_module_cuttagcontrols;
    property use text_module_subscriptionfilters;

    property use text_view_recent;
    property use text_view_archive;
    property use text_view_friends;
    property use text_view_friends_comm;
    property use text_view_network;
    property use text_view_tags;
    property use text_view_memories;
    property use text_view_userinfo;

    property use text_entry_prev;
    property use text_entry_next;
    property use text_edit_entry;
    property use text_edit_tags;
    property use text_mem_add;
    property use text_tell_friend;
    property use text_watch_comments;
    property use text_unwatch_comments;

    property use text_read_comments;
    property use text_read_comments_friends;
    property use text_read_comments_screened_visible;
    property use text_read_comments_screened;
    property use text_post_comment;
    property use text_post_comment_friends;
    property use text_permalink;

    property use text_meta_location;
    property use text_meta_mood;
    property use text_meta_music;
    property use text_meta_xpost;
    property use text_tags;

    property use text_stickyentry_subject;

    property use text_max_comments;
    property use text_skiplinks_back;
    property use text_skiplinks_forward;
}

##===============================
## Custom CSS
##===============================

propgroup customcss {
    property use external_stylesheet;
    property use include_default_stylesheet;
    property use linked_stylesheet;
    property use custom_css;
}

function Page::print_default_stylesheet() {
    var string medium_media_query = generate_medium_media_query();
    var string large_media_query = generate_large_media_query();

    var string page_background = generate_background_css ($*image_background_page_url, $*image_background_page_repeat, $*image_background_page_position, $*color_page_background);
    var string header_background = generate_background_css ($*image_background_header_url, $*image_background_header_repeat, $*image_background_header_position, $*color_header_background);
    if ($*image_background_header_height > 0) {
        $header_background = """
            $header_background
            height: """ + $*image_background_header_height + """px;""";
    }

    var string footer_background = generate_background_css( "", "", "", $*color_footer_background );
    var string footer_link_colors = generate_color_css( $*color_footer_link, new Color, new Color );
    var string footer_link_active_colors = generate_color_css( $*color_footer_link_active, new Color, new Color );
    var string footer_link_hover_colors = generate_color_css( $*color_footer_link_hover, new Color, new Color );
    var string footer_link_visited_colors = generate_color_css( $*color_footer_link_visited, new Color, new Color );

    var string entry_background = generate_background_css ($*image_background_entry_url, $*image_background_entry_repeat, $*image_background_entry_position, $*color_entry_background);
    var string module_background = generate_background_css ($*image_background_module_url, $*image_background_module_repeat, $*image_background_module_position, $*color_module_background);

    var string page_colors = generate_color_css($*color_page_text, $*color_page_background, $*color_page_border);
    var string entry_colors = generate_color_css($*color_entry_text, $*color_entry_background, $*color_entry_border);
    var string module_colors = generate_color_css($*color_module_text, $*color_module_background, $*color_module_border);

    var string page_title_colors = generate_color_css($*color_page_title, new Color, new Color);
    var string entry_title_colors = generate_color_css($*color_entry_title, $*color_entry_title_background, new Color);
    var string comment_title_colors = generate_color_css($*color_comment_title, $*color_comment_title_background, new Color);
    var string module_title_colors = generate_color_css($*color_module_title, $*color_module_title_background, new Color);

    var string page_link_colors = generate_color_css($*color_page_link, new Color, new Color);
    var string page_link_active_colors = generate_color_css($*color_page_link_active, new Color, new Color);
    var string page_link_hover_colors = generate_color_css($*color_page_link_hover, new Color, new Color);
    var string page_link_visited_colors = generate_color_css($*color_page_link_visited, new Color, new Color);

    var string entry_link_colors = generate_color_css($*color_entry_link, new Color, new Color);
    var string entry_link_active_colors = generate_color_css($*color_entry_link_active, new Color, new Color);
    var string entry_link_hover_colors = generate_color_css($*color_entry_link_hover, new Color, new Color);
    var string entry_link_visited_colors = generate_color_css($*color_entry_link_visited, new Color, new Color);
    var string entry_interaction_link_colors = generate_color_css($*color_entry_interaction_links, new Color, new Color);
    var string entry_interaction_link_active_colors = generate_color_css($*color_entry_interaction_links_active, new Color, new Color);
    var string entry_interaction_link_hover_colors = generate_color_css($*color_entry_interaction_links_hover, new Color, new Color);
    var string entry_interaction_link_visited_colors = generate_color_css($*color_entry_interaction_links_visited, new Color, new Color);

    var string module_link_colors = generate_color_css($*color_module_link, new Color, new Color);
    var string module_link_active_colors = generate_color_css($*color_module_link_active, new Color, new Color);
    var string module_link_hover_colors = generate_color_css($*color_module_link_hover, new Color, new Color);
    var string module_link_visited_colors = generate_color_css($*color_module_link_visited, new Color, new Color);

    var string page_font = generate_font_css("", $*font_base, $*font_fallback, $*font_base_size, $*font_base_units);
    var string page_title_font = generate_font_css($*font_journal_title, $*font_base, $*font_fallback, $*font_journal_title_size, $*font_journal_title_units);
    var string page_subtitle_font = generate_font_css($*font_journal_subtitle, $*font_base, $*font_fallback, $*font_journal_subtitle_size, $*font_journal_subtitle_units);
    var string entry_title_font = generate_font_css($*font_entry_title, $*font_base, $*font_fallback, $*font_entry_title_size, $*font_entry_title_units);
    var string comment_title_font = generate_font_css($*font_comment_title, $*font_base, $*font_fallback, $*font_comment_title_size, $*font_comment_title_units);
    var string module_font = generate_font_css($*font_module_text, $*font_base, $*font_fallback, $*font_module_text_size, $*font_module_text_units);
    var string module_title_font = generate_font_css($*font_module_heading, $*font_base, $*font_fallback, $*font_module_heading_size, $*font_module_heading_units);


     var string userpic_css = "";
         if ($*userpics_position == "right") {
             $userpic_css = """
             .entry .userpic,
             .comment .userpic {
                 text-align: right;
                 }
             """;
         }
    print_custom_control_strip_css();

    """
H1, H2, H3 {
    margin: .25em 0;
    padding: .25em 0;
}

img {
    border: none;
}

hr {
    display: none;
}
.entry-content hr,
.comment-content hr {
    display: block;
    margin: 1em 10%;
}

body {
    $page_font
    padding: 0;
    $page_background
    $page_colors
}

html body {
    margin-left: $*margins_size$*margins_unit;
    margin-right: $*margins_size$*margins_unit;
}

a { $page_link_colors }
a:visited { $page_link_visited_colors }
a:hover { $page_link_hover_colors }
a:active { $page_link_active_colors }

q { font-style: italic; }

/* #content layout */
#content { float: none; }
@media $medium_media_query {
    .two-columns-left #content,
    .three-columns-sides #content {
        border-left: $*sidebar_width solid transparent;
    }
    .two-columns-right #content,
    .three-columns-sides #content {
        border-right: $*sidebar_width solid transparent;
    }
    .three-columns-left #content {
        border-left: $*sidebar_width_doubled solid transparent;
    }
    .three-columns-right #content {
        border-right: $*sidebar_width_doubled solid transparent;
    }
    .column-right #content {
        min-width: $*sidebar_width; /* prevents sidebar overlap of entry, when entry becomes narrower than sidebar */
    }
}

#content-footer {
    height: 0;
    font-size: 0; /*to make IE happy*/
    clear: both;
}

#header, #footer {
    margin: 0;
    clear: both;
    padding: .5em;
}

#header {
    $header_background
    $page_title_colors
}

h1#title {
    $page_title_font
}

h2#subtitle,
h2#pagetitle {
    $page_subtitle_font
}

#footer {
    $footer_background
}

#footer a { $footer_link_colors }
#footer a:visited { $footer_link_visited_colors }
#footer a:hover { $footer_link_hover_colors }
#footer a:active { $footer_link_active_colors }

#primary {
    width:100%;
    margin-right:-100%;
    margin-left: 0;
}

#primary > .inner:first-child, #secondary > .inner:first-child, #tertiary > .inner:first-child {
    padding: 1em;
}

/* modules layout */
#primary { float: none; }
#secondary, #tertiary { width: 100%; }

@media $medium_media_query {
    .multiple-columns #primary {
        float: left;
    }

    .two-columns-left #secondary,
    .three-columns-sides #secondary {
        float: left;
        width: $*sidebar_width;
        margin-left: -$*sidebar_width;
    }
    .two-columns-right #secondary {
        float: right;
        width: $*sidebar_width;
        margin-right: -$*sidebar_width;
    }
    .three-columns-left #secondary {
        float: left;
        width: $*sidebar_width;
        margin-left: -$*sidebar_width_doubled;
    }
    .three-columns-right #secondary {
        float: right;
        width: $*sidebar_width;
        margin-right: -$*sidebar_width;
    }

    .two-columns #tertiary {
        clear: both;
        width: auto;
    }
    .two-columns-left #tertiary { margin-left: -$*sidebar_width; }
    .two-columns-right #tertiary { margin-right: -$*sidebar_width; }
    .two-columns #tertiary .module {
        float: left;
        width: $*sidebar_width;
    }
    .three-columns-left #tertiary {
        float: left;
        width: $*sidebar_width;
        margin-left: -$*sidebar_width;
    }
    .three-columns-right #tertiary {
        float: right;
        width: $*sidebar_width;
        margin-right: -$*sidebar_width_doubled;
        margin-left: $*sidebar_width; /* so that #tertiary won't overlay #secondary in IE7 */
    }
    .three-columns-sides #tertiary {
        float: right;
        width: $*sidebar_width;
        margin-right: -$*sidebar_width;
    }
}

.navigation ul {
    margin-left: 0;
    padding-left: 0;
}
.navigation li {
    display: inline;
    padding: 0 .5em;
}
.noentries {
    padding: 0 .5em;
}

/* entries */

.entry {
    $entry_background
    $entry_colors
}

.entry .entry-title {
    $entry_title_font
}

.entry .entry-title, .entry .entry-title a {
    $entry_title_colors
}

.no-subject .entry .entry-title {
    background: none;
    border: none;
}

.entry a { $entry_link_colors }
.entry a:visited { $entry_link_visited_colors }
.entry a:hover { $entry_link_hover_colors }
.entry a:active { $entry_link_active_colors }

/* ensure comment content stretches out horizontally so it's readable */
.comment-content:before {
    content: "";
    display: block;
    overflow: hidden;
    width: 10em;
}
.comment-content { border-top: 1px transparent solid; } /* for firefox */

/* To prevent overlapping when icon's on the left */
/* and list is the first thing in content */
.entry-content li,
.comment-content li {
    list-style-position: inside;
    }

/* To constrain the width and prevent layout breaking */
.entry-content img, .comment-content img {
    max-width: 100%;
    height: auto;
}

@media $large_media_query {
    .entry-content img, .comment-content img { max-width: none; }
}

.metadata ul {
    display: inline;
    list-style: none;
    margin-left: .5em;
    padding-left: 0;
}
.metadata li {
    margin-bottom: .5em;
}
.metadata.top-metadata ul {
    margin: 0;
}
.metadata.top-metadata {
    margin-bottom: 1em;
}

.tag ul {
    display: inline;
    margin-left: 0;
    padding-left: 0;
}

.tag ul li {
    display: inline;
} /* same for month view */

ul.entry-management-links {
    margin-left: 0;
    padding-left: 0;
}
ul.entry-management-links li {
    display: inline;
    padding: 0 .25em;
}

ul.entry-interaction-links {
    margin-left: 0;
    padding-left: 0;
    text-align: right;
}

.entry-interaction-links a, .entry-management-links a { $entry_interaction_link_colors }
.entry-interaction-links a:visited, .entry-management-links a:visited { $entry_interaction_link_visited_colors }
.entry-interaction-links a:hover, .entry-management-links a:hover { $entry_interaction_link_hover_colors }
.entry-interaction-links a:active, .entry-management-links a:active { $entry_interaction_link_active_colors }

ul.entry-interaction-links li {
    display: inline;
    padding: 0 .25em;
}

/* comments */

.comment-posted {font-weight:bold;}

.comment-wrapper {
    padding: .5em 0;
    min-width: 15em;
}

.comment .comment-title {
    $comment_title_font
    margin: 0;
}

.comment .comment-title, .comment .comment-title a {
    $comment_title_colors
}

.no-subject .comment .comment-title {
    background: none;
    border: none;
}

ul.comment-management-links {
    margin-left: 0;
    padding-left: 0;
    text-align: right;
}
ul.comment-management-links li {
    display: inline;
    padding: 0 .25em;
}

ul.comment-interaction-links {
    margin-left: 0;
    padding-left: 0;
}
ul.comment-interaction-links li {
    display: inline;
    padding: 0 .25em;
}

textarea#commenttext {
    width: 100%; /* fix for FF form width glitch */
}

/* archive */

table.month {
    margin: 0 auto;
    border-collapse: collapse;
}
table.month td {
    height: 3.25em;
}
table.month td,
table.month th {
    border: 1px solid; /* ? */
    padding: 3px;
}
table.month td p {
    margin: 0;
    padding: 3px;
}

.month dl dt {
    font-weight: bold;
}
.month dl .time {
    padding-right: .5em;
}
.month dl h3 {
    display: inline;
    font-size: medium;
}
.page-month .month .entry-poster {
    margin-right: .5em;
}
.month dl .tag ul {
    margin-top: 0;
}

/* icons */

.sorting-options ul {
    margin-left: 0;
}

.sorting-options ul li {
    display: inline;
}

.icon-keywords ul {
    display: inline;
    margin-left: 0;
    padding-left: 0;
}

.icon-keywords ul li {
    display: inline;
}

/* modules */

.module {
    $module_background
    $module_colors
}

.module a { $module_link_colors }
.module a:visited { $module_link_visited_colors }
.module a:hover { $module_link_hover_colors }
.module a:active { $module_link_active_colors }

.module h2 {
    $module_title_colors
    $module_title_font
}

.module-content {
    $module_font
}

.module-content ul {
    list-style: outside;
    margin-left: 1em;
    padding-left: 0;
}
.module-content li {
    margin: .5em 0;
}

ul.userlite-interaction-links.icon-links {
    margin-left: 0;
    padding-left: 0;
}

ul.userlite-interaction-links.icon-links li {
    display: inline;
    padding: 0 .20em;
}

ul.userlite-interaction-links.text-links {
    text-align: left;
}

.any-column .module-calendar table { margin: 0; }
.module-calendar .module-content { text-align: left; }
@media $medium_media_query {
    .multiple-columns .module-calendar .module-content {
        text-align: center;
    }

    .multiple-columns .module-calendar table {
        margin: 0 auto;
    }

    .multiple-columns .module-syndicate .module-content {
        text-align: center;
    }
}

.module-calendar td {
    padding: 1px;
}
.module-calendar td a {
    display: block;
    padding: 2px;
}

.search-box {
    margin: .2em auto;
    max-width: 100%;
}

.search-form .search-box-item, 
.search-form .search-button-item {
    display: block
}

.search-form .comment_search_checkbox_item {
    display: inline
}

/* wrap long content, particularly openid usernames */
.module-pagesummary .ljuser {
    white-space: normal !important;
}
.module-pagesummary .module-content {
    word-wrap: break-word;
}

.module-credit .category-title {
    font-weight: bold;
}

.tags_cloud li, .module-tags_cloud li { display: inline; }

$userpic_css
    """;
}
layerinfo type = "layout";
layerinfo name = "Lefty";
layerinfo redist_uniq = "lefty/layout";
layerinfo author_name = "sarken";
layerinfo lang = "en";

set layout_authors = [ { "name" => "sarken", "type" => "user" } ];

set layout_type = "two-columns-left";
set entry_management_links = "text";
set margins_size = "4";
set margins_unit = "%";

##===============================
## Presentation
##===============================

set userpics_position = "right";
set text_skiplinks_back = "";
set text_skiplinks_forward = "";

##===============================
## Colors
##===============================

propgroup colors_child {
 property Color color_headernav_background { des = "Page header navigation background color"; }
 property use color_header_link;
 property use color_header_link_active;
 property use color_header_link_hover;
 property Color color_headernav_hover_background { des = "Page header navigation background hover color"; }
 property use color_header_link_visited;
 property Color color_headernav_current_background { des = "Page header navigation background current color"; }
## There is no text in the navigation module. This doesn't need to be set but was probably meant for link colors originally.
## As it went live already, noui it instead of removing it to prevent compilation errors.
 property Color color_headernav_text { des = "Page header navigation text color"; noui = 1; }
 property Color color_header_title_background { des = "Page header title background color"; }
 property Color color_module_background_accent { des = "Module background accent color for blocks"; }
 property Color color_entry_background_accent { des = "Entry background accent color for blocks"; }
 property Color color_page_left_border { des = "Page left border color"; }
 property Color color_page_right_border { des = "Page right border color"; }
 property Color color_page_navigation_link { des = "Page navigation link color"; }
 property Color color_page_navigation_link_hover { des = "Page navigation link hover color"; }
 property Color color_page_navigation_link_active { des = "Page navigation link active color"; }
 property Color color_page_navigation_link_visited { des = "Page navigation link visited color"; }
 property Color color_module_titlelist_border { des = "Module title and list border color"; }
 property Color color_entry_titleuserpic_border { des = "Entry and comment title and userpic border color"; }
 property Color color_comment_footer_text { des = "Comment footer text color"; }
 property Color color_entry_footer_text { des = "Entry footer text color"; }
 }

propgroup fonts_child {
 property string font_comment_footer { des = "Comment footer text font"; }
 property string font_entry_footer { des = "Entry footer text font"; }
 property string font_page_navigation { des = "Page navigation text font"; }
}

##===============================
## Modules
##===============================

property string module_navlinks_section_override {
 values = "none|(none)|header|Header|one|Main Module Section|two|Secondary Module Section";
 grouped = 1;
 }

set grouped_property_override = { "module_navlinks_section" => "module_navlinks_section_override" };

set module_navlinks_section = "header";

##===============================
## Functions
##===============================

# Give a title to the navlinks module
function print_module_navlinks() {
 var Page p = get_page();
 var string title = "Navigation";
 open_module("navlinks", "$title", "");
 var string[] links = [];
 foreach var string k ($p.views_order) {
  var string css = """ class="$k" """;
  if ($p.view == $k) { $css = """ class="current $k" """; }
  $links[size $links] = """<a href="$p.view_url{$k}"$css>"""+lang_viewname($k)+"""</a>""";
 }
 print_module_list($links);
 close_module();
}

# Add section for navlinks module
function Page::print() {
 """<!DOCTYPE html>\n<html lang="en">\n<head profile="http://www.w3.org/2006/03/hcard http://purl.org/uF/hAtom/0.1/ http://gmpg.org/xfn/11">\n""";
 $this->print_meta_tags();
 $this->print_head();
 $this->print_stylesheets();
 $this->print_head_title();
 """</head>""";
 $this->print_wrapper_start();
 $this->print_control_strip();
 """
 <div id="canvas">
  <div class="inner">
   <div id="header">
    <div class="inner">
     """;
     $this->print_header();
     $this->print_module_section("header");
 """
    </div><!-- end header>inner -->
   </div><!-- end header -->
   <div id="content">
    <div class="inner">
 """;
    if ($*layout_type == "one-column-split") {
 """
     <div id="secondary"><div class="inner">
 """;
      $this->print_module_section("one");
 """
     </div></div><!--  end secondary and secondary>inner -->
 """;
    }
 """
     <div id="primary"><div class="inner">
      """;
      $this->print_body();
 """
     </div></div><!-- end primary and primary>inner -->
 """;
    if ($*layout_type != "one-column-split") {
 """
     <div id="secondary"><div class="inner">
 """;
      $this->print_module_section("one");
 """
     </div></div><!--  end secondary and secondary>inner -->
 """;
    }
 """
     <div id="invisible-separator" style="float: left; width: 1px;"></div> <!-- this is a hack for IE7 + two-columns-right -->
     <div id="tertiary"><div class="inner">
      """;
      $this->print_module_section("two");
 """
     </div></div><!-- end tertiary and tertiary>inner -->
     <div id="content-footer"></div>
    </div><!-- end content>inner -->
   </div> <!-- end content -->
  </div> <!-- end canvas>inner -->
 """;

 """
 <div id="footer">
  <div class="inner">
   """;
   print safe """
    <div class="page-top"><a href="#">$*text_page_top</a></div>
  </div><!-- end footer>inner -->
 </div><!-- end footer -->

 </div> <!-- end canvas -->
 """;
 $this->print_wrapper_end();
 """</html>""";
}

## Shrink icons in two-columns mode
function print_module_userprofile() {
    var Page p = get_page();

    open_module("userprofile", $*text_module_userprofile, $p.view_url{"userinfo"});

    if ($*module_userprofile_opts_userpic or $*module_userprofile_opts_name) {
        """<div class="userprofile-userinfo">""";
        if ($*module_userprofile_opts_userpic) {
            if (defined $p.journal.default_pic) {
                if ($*layout_type == "two-columns-right" or $*layout_type == "two-columns-left" ) {
                $p.journal.default_pic.width  = $p.journal.default_pic.width  / 2;
                $p.journal.default_pic.height = $p.journal.default_pic.height / 2;
                }
                """<div class="userpic">""";
                $p.journal->print_userpic();
                """</div>""";
            }
        }
    }

    if ($*module_userprofile_opts_name) {
        println "<div class='journal-name'>" + $p.journal.name + "</div>";
    }

    if ($*module_userprofile_opts_website and $p.journal.website_url != "") {
        var string website_name = ( $p.journal.website_name != "" ) ? $p.journal.website_name : $*text_website_default_name;
        println "<div class='journal-website-name'><a href='$p.journal.website_url'>$website_name</a></div>";
    }
    $p.journal->print_interaction_links();
    """</div>""";
    close_module();
}



##===============================
## Stylesheet
##===============================


function print_stylesheet () {
var string medium_media_query = generate_medium_media_query();

var string entry_header_margin = "";
    if ( $*entry_userpic_style == "" ) { $entry_header_margin = "112px"; }
    elseif ( $*entry_userpic_style == "small" ) { $entry_header_margin = "87px"; }
    elseif ( $*entry_userpic_style == "smaller" ) { $entry_header_margin = "62px"; }

var string comment_header_margin = "";
    if ( $*comment_userpic_style == "" ) { $comment_header_margin = "112px"; }
    elseif ( $*comment_userpic_style == "small" ) { $comment_header_margin = "87px"; }
    elseif ( $*comment_userpic_style == "smaller" ) { $comment_header_margin = "62px"; }

    var string userpic_css = "";
        if ($*userpics_position == "left") {
            $userpic_css = """
            .has-userpic .entry .userpic {
                float: left;
                margin: -4em 1em 0 0;
                }
            .has-userpic .entry .header,
            .has-userpic .comment .header {
                text-align: right;
                }
            .has-userpic .entry .header {
                margin-left: $entry_header_margin;
                }
            .has-userpic .comment .header {
                margin-left: $comment_header_margin;
                }
            .has-userpic .comment .userpic {
                float: left;
                margin: -1em 1em 0 0;
                }
            """;
        }
        elseif ($*userpics_position == "right") {
            $userpic_css = """
            .has-userpic .entry .userpic {
                float: right;
                margin: -4em 0 0 1em;
                }
            .has-userpic .entry .header {
                margin-right: $entry_header_margin;
                }
            .has-userpic .comment .header {
                margin-right: $comment_header_margin;
                }
            .has-userpic .comment .userpic {
                float: right;
                margin: -1em 0 0 1em;
                }
            """;
        }

var string navlinks_css = "";
 if ($*module_navlinks_section == "header") {
  $navlinks_css = """

  .module-navlinks {
    background: $*color_headernav_background;
    padding: 0 1.25em;
    text-align: right;
    }

/* User more specific selector to override other code */
  #header .module-navlinks h2 {
    display: none;
    }

  .module-navlinks ul {
    letter-spacing: .1em;
    margin: 0;
    padding:.5em 0;
    text-transform: lowercase;
    }

  .module-navlinks li {
    display: inline;
    }

  .module-navlinks li a {
    padding: .5em;
    }

  .module-navlinks a,
  .module-navlinks a.current {
    color: $*color_header_link;
    }

  .module-navlinks li a:visited {
    color: $*color_header_link_visited;
    }

  .module-navlinks li a:hover {
    background: $*color_headernav_hover_background;
    color: $*color_header_link_hover;
    }

  .module-navlinks li a:active {
    color: $*color_header_link_active;
    }

  .module-section-header li .current,
  .module-section-header a.current:hover {
    background: $*color_headernav_current_background;
    font-style: italic;
    }
  """;
 }

 """
/*
Layout: LEFTY

CREDITS
CSS: Sarken @ rentals - https://rentals.dreamwidth.org/945.html
*/

* {
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}


html body {
margin-top: 0;
margin-bottom: 0;
}

a {
text-decoration: none;
}

ul, ol {
list-style-type: none;
}

code {
font-family: monospace;
}

hr {
display: none;
}

#content blockquote, .poll-container {
background: $*color_entry_background_accent;
border: 1px solid $*color_entry_titleuserpic_border;
margin: 0.875em auto;
padding: 1em;
width: 95%;
}

blockquote {
background: $*color_module_background_accent;
border: 1px solid $*color_module_titlelist_border;
margin: 0.875em auto;
padding: 1em;
width: 95%;
}

#canvas {
background-color: $*color_entry_background;
border-left: 0.75em solid $*color_page_left_border;
border-right: 0.375em solid $*color_page_right_border;
}

span.access-filter, span.restrictions {
display: none;
}

/* header */

#header {
padding: 1.25em 0 0;
}

#header h1 {
text-decoration: none;
display: inline-block;
background: $*color_header_title_background;
padding: 0.625em 1.25em 0.625em 4.5em;
margin:0;
}

#header h1 a {
color: $*color_page_title;
}

#header h2 {
text-decoration: none;
display: inline-block;
background: $*color_header_title_background;
padding: 0.625em 1.25em 0.625em 2.5em;
margin:0;
}

#header #pagetitle { display:none; }

$navlinks_css

/* content */

#content {

padding: 0 1em;
width:100%;
}

.navigation {
position: relative;
text-align: center;
}

.navigation ul {
position: relative;
height: 4.5em;
}

.navigation li {
padding: 0 0.5em;
}

.navigation .page-back, .navigation .page-forward {
display: inline-block;
padding: 0;
width: auto;
position: absolute;
}

.navigation .page-back a, .navigation .page-forward a {
display: block;
font-style: italic;
font-weight: bold;
color: $*color_page_navigation_link;
font-family: $*font_page_navigation;
font-size: 4em;
}

.navigation .page-back a:visited, .navigation .page-forward a:visited {
color: $*color_page_navigation_link_visited;
}

.navigation .page-back a:hover, .navigation .page-forward a:hover {
color: $*color_page_navigation_link_hover;
}

.navigation .page-back a:active, .navigation .page-forward a:active {
color: $*color_page_navigation_link_active;
}

.navigation .page-back a:before {
content: "<<";
}

.navigation .page-back {
left: 0;
}
.navigation .page-forward {
padding-left: 2em;
right: 0;
}

.navigation .page-forward a:after {
content: ">>";
}

.navigation .page-separator {
display: none;
}

@media $medium_media_query {
    .multiple-columns .navigation ul {
    height: auto;
    }

    .multiple-columns .navigation .page-back, .multiple-columns .navigation .page-forward {
    position: static;
    }
}


/* entries and comments */

.entry-wrapper, .comment-wrapper {
margin-bottom: 3.5em;
position: relative;
color: $*color_entry_text;
background-color: $*color_entry_background;
}

.page-entry #primary > .inner:first-child { padding: 1em 0; }
.page-entry .entry-wrapper { padding: 0 1em; }
.comment > .inner:first-child { padding: 0 1em; }

.no-userpic .entry .header, .no-userpic .comment .header {
margin-right: 0;
}

.entry .entry-title, .comment .comment-title {
border-bottom: 1px solid $*color_entry_titleuserpic_border;;
padding-right: 0.875em;
}

.datetime, .poster {
font: smaller $*font_entry_footer $*color_entry_footer_text;
text-transform: uppercase;
}

.datetime a, .poster a {
color: $*color_entry_footer_text;
}

.security-protected .entry .datetime:after {
content: " Access: Protected";
}

.security-private .entry .datetime:after {
content: " Access: Private";
}

.security-custom .entry .datetime:after {
content: " Access: Filtered";
}

.restrictions-18 .entry .datetime:after {
content: " 18+";
}

.restrictions-nsfw .entry .datetime:after {
content: " NSFW";
}

.entry .userpic img, .comment .userpic img {
-moz-box-sizing: content-box;
-ms-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
padding: 5px;
border: 1px solid $*color_entry_titleuserpic_border;
}

.entry-content, .comment-content {
line-height: 1.75;
margin: 1.75em 0;
min-height: 6em;
text-align: justify;
}

.entry-content a, .comment-content a {
text-decoration: underline;
}

.entry-content ul {
list-style: disc inside;
}

.entry-content ol {
list-style: decimal-leading-zero inside;
}

.entry-content li {
display: list-item;
}

.entry-content h1, .comment-content h1 {
font-size: 1.625em;
}

.entry-content h2, .comment-content h2 {
font-size: 1.5em;
}

.entry-content h3, .comment-content h3 {
font-size: 1.375em;
}

.entry-content h4, .comment-content h4 {
font-size: 1.25em;
}

.entry-content h5, .comment-content h5 {
font-size: 1.125em;
}

.entry-content h6, .comment-content h6 {
font-weight: bold;
}

.entry .metadata li {
display: block;
}

.entry .metadata span {
font-size: smaller;
text-transform: lowercase;
}

.entry .metadata span.metadata-label {
font-weight: bold;
}

.entry .footer, .comment .footer {
text-align: right;
}

.entry .footer a{
color: $*color_entry_footer_text;
}

.comment .footer a {
color: $*color_comment_footer_text;
}

.tag {
font-size: smaller;
text-align: left;
text-transform: lowercase;
}

.tag-text {
font-weight: bold;
}

.footer .tag ul, .tag ul {
display: inline;
}

.footer ul {
display: inline-block;
}

.entry-management-links, .entry-interaction-links, .comment-management-links, .comment-interaction-links {
display: inline-block;
margin-top: 1.25em;
}

.entry-management-links li, .entry-interaction-links li, .comment-management-links li, .comment-interaction-links li {
margin-right: 0.25em;
text-transform: uppercase;
}

.entry-management-links li a, .entry-interaction-links li a{
font: 0.8125em $*font_entry_footer;
color: $*color_entry_footer_text;
}

.comment-management-links li, .comment-interaction-links li {
font: 0.8125em $*font_comment_footer;
color: $*color_comment_footer_text;
}

.comment-management-links li a, .comment-interaction-links li a{ color: $*color_comment_footer_text;
}

.entry-interaction-links li.first-item, .comment-interaction-links li.first-item {
padding-left: 0.1875em;
}

#comments .comment-pages {
margin-bottom: 3.5em;
padding: 0.5em;
text-align: center;
}

#comments .comment-pages a {
font-family: $*font_comment_footer;
text-transform: uppercase;
}

#comments .bottompages {
margin-top: 3.5em;
}

/* module section two */

#secondary {background: $*color_module_background;}

#secondary .module h2 a { color: $*color_module_title; }

.module-section-one .module {
padding: 0;
}

.module-content ul{
list-style: none;
}

/* module shared */

.module-section-one .module, .module-section-two .module {
color: #111;
margin-bottom: 1em;
}

.module-section-one h2, .module-section-two h2 {
border-bottom: 1px solid $*color_module_titlelist_border;
margin-bottom: 0.625em;
padding-left: 1em;
}


.module-section-one .module-list, .module-section-two .module-list {
margin: 1.25em 0 1em;
}

.module-section-one ul.module-list li, .module-section-two ul.module-list li {
border-bottom: 1px solid $*color_module_titlelist_border;
display: list-item;
letter-spacing: 0.1em;
margin-bottom: 0.625em;
padding: 0 0.625em 0 0.875em;
text-align: left;
}

.module-calendar .module-content, .module-credit .module-content, .module-cuttagcontrols .module-content, .module-search .module-content, .module-syndicate .module-content, .module-userprofile .module-content, .module .manage-link {
text-align: center;
}

.module-userprofile .userpic img {
border: 1px solid $*color_entry_titleuserpic_border;
padding: 3px;
}

.module-calendar table {
margin: 0 auto;
}

.module-calendar table th, .module-calendar table td {
font-size: smaller;
}

.module-calendar table .entry-day, .module-calendar table .empty-day {
background: $*color_module_background_accent;
border: 1px solid $*color_module_titlelist_border;
padding: 2px;
}

.module-tags_multilevel ul.module-list li ul {
list-style: disc inside;
}

.module-tags_multilevel ul.module-list li li {
border-bottom: none;
}

.module-tags_cloud div.module-list {
font-size: 65%;
margin-left: 0.875em;
margin-bottom: 1em;
}

.module-wrapper .inner .module-powered.module, .module-wrapper .inner .module-time.module {
margin-bottom: 0;
padding-bottom: 0.875em;
width: 100%;
}

/* footer */

.page-top {
padding: 0.75em 1.25em;
text-align: right;
}

/* forms */

span.multiform-checkbox {
padding-right: 0.5em;
text-transform: uppercase;
}

#postform, #qrform {
margin-top: 1.25em;
}

#qrform table td b, #postform table.talkform td {
vertical-align: top;
}

.module-section-one input, .module-section-one select {
border: 1px solid $*color_module_titlelist_border;
font-size: smaller;
}

#content input, #content select {
border: 1px solid $*color_entry_titleuserpic_border;
font-size: smaller;
}

input[type="submit"], input[type="button"], input[type="search"], input[type="text"], input[type="password"] {
padding: 0.25em 0.5em;
}

.search-box { width: 80%; }

.module-section-one textarea {
border: 1px solid $*color_module_titlelist_border;
}

#content textarea {
border: 1px solid $*color_entry_titleuserpic_border;
}

/* entry and reply */

.page-entry .entry, .page-reply .comment {
margin-top: 0.875em;
}

/* archive and month */

.page-archive #archive-year, .page-month #archive-month {
margin-top: 0.875em;
}

.page-archive .navigation, .page-month .navigation {
}

.page-archive .navigation li, .page-month .navigation li {
}

.page-archive .navigation li a, .page-month .navigation li a {
}

.page-archive .month-wrapper {
margin: 1.25em 0;
}

.page-archive .month .header {
border-bottom: 1px solid $*color_entry_titleuserpic_border;
}

.page-archive .month table {
border-collapse: collapse;
margin: 0.875em auto;
}

.page-archive .month table th, .page-archive .month table .day {
text-align: center;
padding: 0.5em 0.75em;
width: 10%;
}

.page-archive .month table .day {
border: 1px solid $*color_entry_titleuserpic_border;
}

.page-archive .month .footer {
padding: 0 0 0.875em 0;
text-align: center;
}

.page-month .month dt {
font-weight: bold;
}

.page-month .month dd {
margin-left: 1em;
}

.page-month .month .entry-title {
display: inline;
margin-left: 0.5em; }

/*--- Icon Page ---*/

.page-icons .icons-container {
margin-top: 0.875em;
}

.page-icons .icons-container h2 {
border-bottom: 1px solid $*color_entry_titleuserpic_border;
margin-bottom: 0.625em;
}


div.icons-container div.icon:nth-of-type(2n) {
    clear: both;
}

.icons-container .icon {
    float: left;
    margin-bottom: 15px;
    min-width: 350px;
    vertical-align: bottom;
    width: 50%;
    display:table;
}

.icon-image {
    display: inline;
    float: left;
    margin-right: 1em;
    min-width: 100px;
    margin-top: 0;
}

.icon-info {
    overflow: auto;
    vertical-align: bottom;
    word-wrap: break-word;
    display:table-cell;
    width:100%;
}

.icon-info .label,
.icon-info span {
    font-weight: bold;
}

.icons-container .inner .footer, .icon-pages {
    clear: both;
    text-align: center;
}

/* tags */

.page-tags .tags-container {
margin-top: 0.875em;
}

.page-tags .tags-container h2 {
border-bottom: 1px solid $*color_entry_titleuserpic_border;
margin-bottom: 0.625em;
}

.page-tags .tags-container > .ljtaglist {
margin-bottom: 1em;
}

.page-tags .tags-container ul.tags_list, .page-tags .tags-container ul.tags_multilevel {
list-style: disc inside;
}

.page-tags .tags-container ul.tags_multilevel ul {
margin-left: 3em;
}

.page-tags .tags-container ul.tags_list li, .page-tags .tags-container ul.tags_multilevel li {
display: list-item;
margin: 0.5em 0;
}

.page-tags .tags-container .tags_cloud {
text-align: center;
}

.page-tags .tags-container .manage-link {
text-align: center;
}

.module-section-one {
padding: 3.5em 1.25em 0;
width: 100%;
}

#secondary .module, #tertiary .module {
    display:inline-block;
    text-align:left;
    vertical-align: top;
    float:none;
    width: $*sidebar_width;
}

#secondary, #tertiary{
text-align: center;
}

@media $medium_media_query {
    /* two columns */

    .two-columns #secondary {
    text-align: left;
    }

    .two-columns #secondary .module {
    display: block;
    }

    .two-columns #secondary .module-section-one .module-userprofile {
    float: left;
    }

    .two-columns .module-section-one {
    padding: 0;
    width: auto;
    }

    .two-columns .module-section-one .module-userprofile h2 {
    display: none;
    }

    .two-columns .module-section-one .module-userprofile .module-content {
    background: $*color_module_background_accent;
    border: 1px solid $*color_module_titlelist_border;
    float: left;
    padding: 1.125em 1em;
    width: $*sidebar_width;
    }

    .two-columns .module-section-one .journal-name, .two-columns .module-section-one .journal-website-name {
    line-height: 1.25;
    font-size: smaller;
    }

    .two-columns .module-section-one .module-userprofile .userpic {
    display: inline-block;
    float: left;
    }

    .two-columns .module-section-one .module-userprofile ul {
    padding: 0.25em 0 0 0;
    }

    .two-columns .module-section-one .module-userprofile li {
    padding: 0 0.25em;
    }

    .two-columns .module-section-one .module-userprofile li:last-of-type {
    padding: 0 0.25em 0 0;
    }

    .two-columns .module-section-one .module-userprofile li:last-of-type {
    padding: 0 0 0 0.25em;
    }

    .two-columns .module-section-one .module-userprofile + .module {
    clear: both;
    }

    .two-columns .module-section-one .module-customtext .module-content, .two-columns .module-section-one .calendar-horizontal {
    padding: 0 0.625em 0 0.875em;
    }

    .two-columns .module-section-one .module-powered.module, .two-columns .module-section-one .module-time.module {
    margin-bottom: 0;
    }

    .two-columns .module-section-one .module-powered .module-content, .two-columns .module-section-one .module-time .module-content {
    padding: 0 0.625em 0 0.875em;
    text-align: left;
    }

    .page-recent.two-columns .module-section-one, .page-day.two-columns .module-section-one, .page-read.two-columns .module-section-one, .page-network.two-columns .module-section-one {
    margin-top: 100px;
    }

    /* two columns left */
    .two-columns-left #content {
    float:right;
    }

    .two-columns-left .module-section-one {
    float: right;
    width: $*sidebar_width;
    }

    .two-columns-left .module-section-one .module-userprofile .module-content {
    border-left: none;
    }

    .two-columns-left #entries .topnav {
    padding-left: 0;
    left: -$*sidebar_width;
    }

    .two-columns-left #entries .navigation {
    text-align: left;
    }

    /* two columns right */

    .two-columns-right #content {
    float: left;
    }

     .two-columns-right .module-section-one {
    float: left;
    width: $*sidebar_width;
    }

    .two-columns-right #entries .topnav {
    padding-right: 0;
    right: -$*sidebar_width;
    }

    .two-columns-right #entries .navigation {
        text-align: right;
    }

    .two-columns-right .module-section-one .module-userprofile .module-content {
    border-right: none;
    }
}

$userpic_css
""";
}