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 = "Librarian's Dream";
layerinfo author_name = "branchandroot";
layerinfo redist_uniq = "librariansdream/layout";
layerinfo lang = "en";

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

# loosely inspired by the WordPress theme whose name I have never found

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

propgroup colors_child {
    property use color_header_link;
    property use color_header_link_active;
    property use color_header_link_hover;
    property use color_header_link_visited;
    property Color color_entry_management_background  { des = "Entry management links background color"; }
    property Color color_module_link_background { des = "Module link background color"; }
    property Color color_module_link_hover_background { des = "Module hovered link background color"; }
    property Color color_module_link_border { des = "Module link border color"; }
    property Color color_module_link_hover_border { des = "Module hovered link border color"; }
    property Color color_navigation_link { des = "Navigation link color"; }
    property Color color_navigation_link_visited { des = "Navigation visited link color"; }
    property Color color_navigation_link_active { des = "Navigation active link color"; }
    property Color color_navigation_link_hover { des = "Navigation hovered link color"; }
    property Color color_primary_background { des = "Entries column background color"; }
    property Color color_sidebars_background { des = "Sidebar background color"; }
}


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

set userlite_interaction_links = "text";

set module_tags_opts_count_type = "title";
set all_commentsubjects = true;

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

set userpics_position = "right";

##===============================
## 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 = "one";

##===============================
## Layout
##===============================

set margins_size = "2";
set margins_unit = "%";

set layout_type = "two-columns-left";
set module_tags_opts_type = "multi";


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

#to give a title to the navlinks module
function print_module_navlinks( bool apply_class_to_link ) {
    var Page p = get_page();
    var string title = "Navigation";

    open_module("navlinks", "$title", "");

    if ( $apply_class_to_link ) {
        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);
    } else {
        var string{}[] links = [];
        foreach var string k ($p.views_order) {
            var string class = $k;
            if ($p.view == $k) { $class = "current $k"; }
            $links[size $links] = { "class" => $class, "item" => """<a href="$p.view_url{$k}">"""+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>""";
}


## Enclose userpic and name in new DIV
## Switch from DIV to SPAN for userpic and name

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) {
                $p.journal.default_pic.width  = $p.journal.default_pic.width  / 4;
                $p.journal.default_pic.height = $p.journal.default_pic.height / 4;
                """<span class="userpic">""";
                $p.journal->print_userpic();
                """</span>""";
            }
        }
        if ($*module_userprofile_opts_name) {
            println "<span class='journal-name'>" + $p.journal.name + "</span>";
        }
        "</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();
    close_module();
}

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

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

#to move userpic left or right
var string userpic_css = "";
    if ($*userpics_position == "right") {
        $userpic_css = ".entry .userpic,
            .comment .userpic { float: right; }";
    }
    else {
        $userpic_css = ".entry .userpic,
            .comment .userpic { float: left; }
            .entry .header,
            .comment .header { text-align: right; }
            .entry-title,
            .comment-title { text-align: left; }";
    }


#for showing the module in the header
var string navlinks_css = "";
if ( $*module_navlinks_section == "header" ) { $navlinks_css = """
    #header > .inner:first-child { padding-bottom: 2em;
        position: relative; }
    .module-navlinks { text-align:right;}
    .module-navlinks * {
       display: inline !important;
       background:  transparent !important;
       border-left: none !important; }

    /* Above standard link colors so hover and active still work */
    .module-navlinks .module-content li a.current,
    .module-navlinks .module-content li a.current:visited {
        color: $*color_page_title;
        text-decoration: none;
    }

    /* Extra specificity needed to override code below */
    .module-navlinks .module-content li a { color: $*color_header_link; }
    .module-navlinks .module-content li a:visited { color: $*color_header_link_visited; }
    .module-navlinks .module-content li a:hover { color: $*color_header_link_hover; }
    .module-navlinks .module-content li a:active { color: $*color_header_link_active; }

    .module-navlinks .module-header { display: none !important; }
    """; }
else { $navlinks_css = ""; }

    var string entry_title_colors = generate_color_css($*color_entry_title, $*color_entry_title_background, new Color);
    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 entry_colors = generate_color_css($*color_entry_text, $*color_entry_background, $*color_entry_border);




"""
/* Lists CSS */

/* Spacing */

#primary > .inner:first-child {
    margin: .25em .25em .25em .25em;
    padding: .5em 1em;
}

@media $medium_media_query {
    .two-columns-left #primary > .inner:first-child,
    .three-columns-left #primary > .inner:first-child { margin-right: 0; }
    .two-columns-right #primary > .inner:first-child,
    .three-columns-right #primary > .inner:first-child { margin-left: 0; }

    .two-columns-left #header,
    .three-columns-sides #header { margin-left: $*sidebar_width;
        padding-left: .25em; border: none;}
    .three-columns-left #header { margin-left: $*sidebar_width_doubled;
        padding-left: .25em; border: none;}
    .two-columns-right #header,
    .three-columns-sides #header { margin-right: $*sidebar_width;
        padding-right: .25em; border: none;}
    .three-columns-right #header { margin-right: $*sidebar_width_doubled;
        padding-right: .25em; border: none;}

    .multiple-columns #secondary,
    .three-columns-left #tertiary,
    .three-columns-right #tertiary,
    .three-columns-sides #tertiary { position: absolute;
        top: 1em;
        margin: 0 !important;
    }

    .two-columns-left #secondary,
    .three-columns-sides #secondary { left: 0; }
    .three-columns-left #secondary { left: -.25em; }

    .two-columns-right #secondary,
    .three-columns-sides #tertiary { right: 0; }
    .three-columns-right #tertiary {right: -.25em; }

    .three-columns-right #secondary { right: $*sidebar_width;  }
    .three-columns-left #tertiary { left: $*sidebar_width; }

    .two-columns-left #tertiary .module,
    .two-columns-right #tertiary .module { margin: 0 .25em 0 0; }
}

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


#footer { margin-top: .25em; }

/* Canvas level */
blockquote {
    padding: 1em 1em .5em 2em;
    font-style: italic;
}
blockquote > p:first-child { margin-top: 0; }
q { font-style: italic; }
dl dt { font-weight: bold; }

a:hover { text-decoration: none; }

body {
    padding: 0;
    margin: 0;
}

#canvas {
    margin: 0 $*margins_size$*margins_unit;
    padding: 1em 0;
    position: relative;
    background: $*color_page_background;
}

#header {
    padding: 1px;
    background: none;}

#header .inner {
    padding: 1px 1em;
    background: $*color_header_background;
    }

#content { border-color: $*color_page_background !important; }
#content-footer { clear: both; }

.navigation { text-align: right; }
.navigation ul { margin: .5em 0; }

.navigation a { color: $*color_navigation_link; }
.navigation a:visited { color: $*color_navigation_link_visited; }
.navigation a:hover { color: $*color_navigation_link_hover; }
.navigation a:active { color: $*color_navigation_link_active; }

#title,
#pagetitle,
#subtitle,
.entry-title,
.module-header,
.comment-title,
.tags-container h2,
#archive-year .month .header h3 {
    font-weight: normal;
    text-transform: capitalize;
}

#header h1,
#header h2,
#header h3 {
    margin: 0;
    padding: .15em 0;
}

#header h1 a {
    color: $*color_page_title;
    text-decoration: none;
}

.one-column #header .module-navlinks {width:100%;}

/* entry */

#primary > .inner:first-child { background:  $*color_primary_background; }

.entry-wrapper,
.comment-wrapper {
    background: $*color_entry_management_background;
    margin: 0 0 1em 0;
}

.entry,
.comment { margin: 0 0 0 35px; padding: 0;
    position: relative;
    border: none; }

.entry .header .datetime,
.comment .header .datetime { padding:0 10px; } /*so datetime et al has some padding */

.entry .header {padding-left: 10px;}

.entry-title,
.comment-title {
    padding: .25em .5em;
    margin: 0;
    margin-left: -45px;
    border-bottom: 1px solid $*color_primary_background;
}

.entry .datetime,
.comment .header .datetime { font-size: small; }

.entry .contents,
.comment .contents { padding: 0 .5em .5em;
    min-height: 100px; }

.entry-content,
.comment-content { padding: 1em .5em .5em; }

$userpic_css

.entry .userpic,
.comment .userpic { margin: -.75em .25em .5em; }

.entry .tag { padding-left: .5em; }

.entry ul.text-links,
.comment-interaction-links {
    padding: 0 .5em .75em;
    margin: 0;
    text-align:right;}

.entry ul.icon-links,
.comment .icon-links {
    position: absolute;
    top: 3em;
    left: -30px;
    width: 25px;
}
.entry ul.icon-links,
.comment .icon-links {
    display: block;
    padding: 0 .25em;
}

.bottomcomment {
    background: $*color_entry_background;
    padding: 1px;
    margin: .5em 0;
}
.bottomcomment ul.entry-management-links {
    position: static;
    width: auto;
}
.bottomcomment ul.entry-management-links li {
    display: inline;
    padding: 0 .25em;
}
.bottomcomment ul.entry-management-links {
    float: left;
    margin-top: .5em;
    margin-bottom: .25em;
}
.bottomcomment ul.entry-interaction-links {
    text-align: right;
    margin: .5em .5em .25em 0;
}

/* Comments */
.comment-pages {
    background: $*color_entry_background;
    padding: .25em;
    margin: .5em 0;
    text-align: center;  /* links when paginated */
}
.comment-wrapper { padding: 0;  }

.comment { background:  $*color_entry_background; }

.comment-title { background:  $*color_entry_title_background; }
.comment-title a { color: $*color_entry_title; }

.poster-ip { font-size: small; }

.comment .footer { padding: 1px; }

.comment .footer .multiform-checkbox {
    margin: 0 10px;
    font-size: small;
}

.comment-management-links { top: 2em; }

.comment-interaction-links { text-align: right; }

.partial .comment { padding: .25em; }
.partial .comment-title {
    display: inline;
    background: transparent;
    margin-left: 0;
}

/*-----------------------Generic Secondary Pages Styling----------------------------*/

#archive-year .header h3, .tags-container .header h2, .icons-container .header h2, #archive-month .header h3 {
    $entry_title_font
    $entry_title_colors;
    border-bottom: 1px solid $*color_primary_background;
    padding: .20em .25em;
    margin: 0;
}

.tags-container,
.icons-container,
#archive-year .month,
#comments,
#archive-month .month {
    $entry_colors
}

.tags-container a,
.icons-container a,
#archive-year .month a,
#comments a,
#archive-month .month a {
    color:$*color_entry_link;
}

.tags-container a:visited,
.icons-container a:visited,
#archive-year .month a:visited,
#comments a:visited,
#archive-month .month a:visited {
    color:$*color_entry_link_visited;
}

.tags-container a:hover,
.icons-container a:hover,
#archive-year .month a:hover,
#comments a:hover,
#archive-month .month a:hover {
    color:$*color_entry_link_hover;
}

.tags-container a:active,
.icons-container a:active,
#archive-year .month a:active,
#comments a:active,
#archive-month .month a:active {
    color:$*color_entry_link_active;
}

/* Archive */

#archive-year .month-wrapper {margin: 0 0 1.5em; }

#archive-year .month .contents { padding-top: 1em; }

#archive-year .month .footer { padding: 1em; }

table.month td,
table.month th { padding: .25em .5em;
    vertical-align: top; }

table.month caption { display: none; }

#archive-month .month { padding: 1em; }

#archive-month .month .entry-title { border-bottom: none;
    font-weight: bold;
    margin-left: 0; }

#archive-month .navigation { text-align: center; }


/* Tags */


.tags-container .manage-tags-link { padding: 1em; }

/* Icons */

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;
}
.userprofile-userinfo {
    border-left: .5em solid $*color_module_link_border;
    background:  $*color_module_link_background;
    margin-bottom: 1px;
}

/*Sidebars*/
#secondary,
#tertiary { background:  $*color_sidebars_background; }

#secondary, #tertiary {
    background-color: $*color_sidebars_background;
    width: 100%;
    position: relative;
    text-align:center;
    margin: 1em 0;
    top: 0;
    }

.any-column .module {
    display: inline-block;
    vertical-align: top;
    width: $*sidebar_width;
    margin: 0.5em;
    }

.any-column .module-list {text-align: left;}

@media $medium_media_query {
    .two-columns-left #tertiary .separator-after,
    .two-columns-right #tertiary .separator-after  {clear: both; }

    .two-columns-left #tertiary { margin-left: .25em; }
    .two-columns-right #tertiary { margin-right: .25em; }

    .multiple-columns #secondary, .multiple-columns #tertiary {
        text-align: left;
        margin-bottom: 0;
        margin-top: 0;
    }

    .multiple-columns .module {
        display: block;
        width: auto;
        margin: 0 0 4px 0;
    }
}

.module {
    border: none;
    background:  transparent;
}

.module-header {
    font-size: large;
    padding: .25em;
    margin: 0;
}

/* Extra specificity needed to override .module a */
.module .module-header a { color: $*color_module_title; }
.module .module-header a:visited { color: $*color_module_title; }
.module .module-header a:hover { color: $*color_module_link_hover; }
.module .module-header a:active { color: $*color_module_link_active; }

.module-content ul,
.module-list,
.module dl {
    list-style: none;
    margin: 0;
    padding: 0;
}
.module-content li,
.module-list-item,
.module-syndicate a,
.module .manage-link a,
.module dt,
.module dd,
.module-search input {
    margin: 1px 0;
}

.module-content li a,
.module-list-item a,
.module-syndicate a,
.module .manage-link a,
.module-calendar td a,
.journal-website-name a,
.module-credit li,
.module-search input {
    display: block;
    padding: .25em .5em;
    background:  $*color_module_link_background;
    border-left: .5em solid $*color_module_link_border;
    color: $*color_module_link;
}

.module-credit .module-list-item a, .module-credit .module-content li a, .module-credit .module-content li a:hover {
    display: inline;
    background: none;
    border: none;
    padding: 0; }

.module-calendar td { font-size: small; }
.module-calendar td.empty-day { padding: .25em; }
.module-search input.search-box { margin-top: 2px; }

.module-content li a:hover,
.module-list-item a:hover,
.module-syndicate a:hover,
.module .manage-link a:hover,
.module-calendar td a:hover,
.journal-website-name a:hover,
.module-search input.search-button:hover,
.module-search input.search-box:focus {
    background:  $*color_module_link_hover_background;
    border-left: .5em solid $*color_module_link_hover_border;
    color: $*color_module_link_hover;
}

$navlinks_css

.manage-link { font-style: italic; }

.module-calendar td a:hover {
    border: .05em solid $*color_module_link_hover_border;
    padding: .20em .5em;
}

.module-calendar td a {
    border: .05em solid transparent;
    padding: .20em .5em;
}

.module-userprofile .module-content {
    text-align: left;
    padding-top: 1px;
}

.module-user-links .module-content {
    text-align: left;
}
ul.userlite-interaction-links {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}
ul.userlite-interaction-links li {
    display: block !important;
    padding: 0 !important;
}

.module-userprofile .journal-name {
    padding-left: .5em;
}

.module-powered,
.module-time,
.module-tags_cloud .module-content .module-list{
    background:  $*color_module_background;
    padding: .5em;
}

.module-pagesummary li {
    background:  $*color_module_link_background;
    padding: .25em .5em;
    border-left: .5em solid $*color_module_link_border;
}

.module-pagesummary li:hover {
    background:  $*color_module_link_hover_background;
    border-left: .5em solid $*color_module_link_hover_border;
}

.module-pagesummary a {
    display: inline !important;
    border-left: none !important;
    padding: 0 !important;
}

.module-pagesummary li:hover a {
    background:  transparent;
    color: $*color_module_link_hover;
}

.module-tags_multilevel .non-link-tag {
    display: block;
    padding: .25em .5em;
    background:  $*color_module_link_background;
    border-left: .5em solid $*color_module_link_border;
}

.module-tags_multilevel ul ul a { padding-left: 2em; }

.module-tags_cloud .module-list-item a,
.module-tags_cloud .manage-tags-link a {
    display: inline;
    background:  transparent;
    border-left: none;
    padding: .25em;
}

.module-tags_cloud .module-list-item a:hover,
.module-tags_cloud .manage-tags-link a:hover {
    background:  transparent;
    border-left: none;
}

.module-tags_cloud .manage-tags-link  { margin-top: 1em; }

.module-active .active-entry-label { display:none; }

/* Footer */

#footer .inner {
    background: $*color_footer_background;
    padding: .5em;
}

#footer {border: none; background: none; padding: 0;
}

@media $medium_media_query {
    .two-columns-left #footer,
    .three-columns-sides #footer { margin-left: $*sidebar_width;
        padding-left: .25em; }
    .two-columns-right #footer,
    .three-columns-sides #footer { margin-right: $*sidebar_width;
        padding-right: .25em; }
    .three-columns-left #footer { margin-left: $*sidebar_width_doubled;
        padding-left: .25em; }
    .three-columns-right #footer { margin-right: $*sidebar_width_doubled;
        padding-right: .25em; }
}


""";
}