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 = "Five AM";
layerinfo redist_uniq = "fiveam/layout";
layerinfo author_name = "winterfish";
layerinfo lang = "en";

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

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

propgroup presentation_child {
    property string userpics_position {
       des = "Place of icons in entries";
       note = "If displayed, icons will be on the opposite side in comments";
       values = "none|None (don't show)|left|Left|right|Right";
       }
}

set layout_type = "two-columns-left";
set sidebar_width = "17em";
set sidebar_width_doubled = "34em";
set userpics_position = "right";

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

propgroup colors_child {
    property Color color_page_usernames { des = "Page username color"; }
    property Color color_page_usernames_active { des = "Page active username color"; }
    property Color color_page_usernames_hover { des = "Page hover username color"; }
    property Color color_page_usernames_visited { des = "Page visited username color"; }
    property Color color_header_border { des = "Page header border color"; }
    property Color color_header_accent { des = "Page header accent color"; }
    property Color color_footer_border { des = "Page footer border color"; }
    property use color_entry_interaction_links_background;
    property use color_entry_interaction_links_hover;
    property use color_entry_interaction_links_active;
    property use color_entry_interaction_links_visited;
    property Color color_comment_interaction_links { des = "Comment interaction links color"; }
    property Color color_comment_interaction_links_border { des = "Comment interaction links border color"; }
    property Color color_module_accent { des = "Module accent color"; }
    property Color color_calendar_background { des = "Calendar background color on days with entries"; }
    property Color color_calendar_background_hover { des = "Calendar hover background color on days with entries"; }
    property Color color_calendar_border { des = "Calendar border color"; }
    property Color color_calendar_link { des = "Calendar link color on days with entries"; }
    property Color color_calendar_link_active { des = "Calendar active link color on days with entries"; }
    property Color color_calendar_link_hover { des = "Calendar hover link color on days with entries"; }
    property Color color_calendar_link_visited { des = "Calendar visited link color on days with entries"; }
    property Color color_calendar_text { des = "Calendar text color on days with entries"; }
    property Color color_calendar_text_hover { des = "Calendar hover text color on days with entries"; }
}

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

set font_base = "Arial, Verdana, Helvetica";
set font_fallback = "sans-serif";
set font_journal_title = "Calibri";
set font_journal_title_size = "2";
set font_journal_title_units = "em";
set font_journal_subtitle = "Calibri";
set font_journal_subtitle_size = "1.2";
set font_journal_subtitle_units = "em";
set font_entry_title = "Calibri";
set font_entry_title_size = "1.2";
set font_entry_title_units = "em";
set font_comment_title = "Calibri";
set font_comment_title_size = "1.2";
set font_comment_title_units = "em";
set font_module_heading = "Calibri";
set font_module_heading_size = "1.2";
set font_module_heading_units = "em";

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

propgroup images_child {
    property string[] image_blockquote_background_group {
        des = "Blockquote background image";
        grouptype = "image";
        }
    set image_blockquote_background_group = [ "image_blockquote_background_url", "image_blockquote_background_repeat", "image_blockquote_background_position" ];
        property string image_blockquote_background_url {
        grouped = 1;
        }
    property string image_blockquote_background_repeat {
        values = "repeat|tile image|no-repeat|don't tile|repeat-x|tile horizontally|repeat-y|tile vertically";
        grouped = 1;
    }
    property string image_blockquote_background_position {
    values = "top left|top left|top center|top center|top right|top right|center left|center left|center center|center|center right|center right|bottom left|bottom left|bottom center|bottom center|bottom right|bottom right";
        grouped = 1;
        allow_other = 1;
    }
}

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

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

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_module_section("header");
                    $this->print_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>""";
}

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

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

    var string blockquote_background = generate_background_css ($*image_blockquote_background_url, $*image_blockquote_background_repeat, $*image_blockquote_background_position, 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 module_title_font = generate_font_css($*font_module_heading, $*font_base, $*font_fallback, $*font_module_heading_size, $*font_module_heading_units);

    var string entry_contents_margin = "";
    var string entry_userpic_margin = "";
    if ( $*entry_userpic_style == "" ) { $entry_contents_margin = "120px"; $entry_userpic_margin = "140px"; }
    elseif ( $*entry_userpic_style == "small" ) { $entry_contents_margin = "95px"; $entry_userpic_margin = "125px"; }
    elseif ( $*entry_userpic_style == "smaller" ) { $entry_contents_margin = "70px"; $entry_userpic_margin = "90px"; }

    var string userpic_css = "";
    if($*userpics_position == "left") {
        $userpic_css = """
        .has-userpic .entry .contents {
            margin-left: $entry_contents_margin;
            min-height: $entry_userpic_margin;
            padding-left: 2em;
            }

        .has-userpic .entry .userpic {
            float: left;
            clear: left;
            margin-left: -$entry_userpic_margin;
            }

        .has-userpic .comment .userpic {
            float: right;
            clear: right;
            margin-left: 1em;
            padding-left: .5em;
            }
        """;
    }
    elseif ($*userpics_position == "right") {
        $userpic_css = """
        .has-userpic .entry .contents {
            margin-right: $entry_contents_margin;
            min-height: $entry_userpic_margin;
            padding-right: 2em;
            }

        .has-userpic .entry .userpic {
            float: right;
            clear: right;
            margin-right: -$entry_userpic_margin;
            }

        .has-userpic .comment .userpic {
            float: left;
            clear: left;
            margin-right: 1em;
            padding-right: .5em;
            }
        """;
    }
"""

/* Five AM */
/* by w i n t e r f i s h */

/* Main
***************************************************************************/

body {
    margin: 0;
    }

h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
    margin: 0;
    }

p {
    margin: 1em 0;
    }

blockquote {
    $blockquote_background
    border-bottom: 4px solid $*color_entry_border;
    border-top: 4px solid $*color_entry_border;
    line-height: 1.4em;
    margin: 1em 0;
    padding: 2em 1em 2em 6.5em;
    }

input, textarea, select {
    background: $*color_page_background;
    border: 1px solid $*color_calendar_border;
    color: $*color_page_text;
    }

.separator {
    display: none;
    }

a, a:link, a:active, a:visited {
    text-decoration: none;
    }

/* Keep before ljuser */

.comment a { color: $*color_page_link; }
.comment a:visited { color: $*color_page_link_visited; }
.comment a:hover { color: $*color_page_link_hover; }
.comment a:active { color: $*color_page_link_active; }

.ljuser a {
    color: $*color_page_usernames;
    }

.ljuser a:visited {
    color: $*color_page_usernames_visited;
    }

.ljuser a:hover {
    color: $*color_page_usernames_hover;
    }

.ljuser a:active {
    color: $*color_page_usernames_active;
    }

/* Page Containers
***************************************************************************/

#canvas {
    margin: 0 6% auto;
    }

.page-entry #primary,
.page-reply #primary {
    margin-top: 2.15em; /* entry-wrapper has padding already */
    }

.page-icons #primary,
.page-tags #primary {
    margin-top: 3.15em;
    }

#primary > .inner:first-child {
    padding: 0;
    }

#secondary {
    margin-top: 3.15em;
    }

#secondary > .inner:first-child {
    padding: 0;
    }

#tertiary > .inner:first-child {
    padding: 0;
    }

.any-column #tertiary { clear: both; }
@media $medium_media_query {
    .column-left #primary > .inner:first-child {
        padding-left: 4em;
        }

    .column-right #primary > .inner:first-child {
        padding-right: 4em;
        }

    /* to make sure the sidebars always have the same size */
    .three-columns-sides #primary > .inner:first-child {
        padding-left: 2em;
        padding-right: 2em;
        }

    .three-columns #secondary > .inner:first-child {
        padding-right: 2em;
        }

    .multiple-columns #tertiary {
        padding-top: 3.15em;
        }
    .three-columns #tertiary {
        clear: none;
        }
    .three-columns #tertiary > .inner:first-child {
        padding-left: 2em;
        }

}


/* Header
***************************************************************************/

#header {
    border-bottom: 2px solid $*color_header_border;
    margin-top: 2em;
    padding: 0;
    text-transform: lowercase;
    }

h1#title, h1#title a {
    border-top: 2px solid $*color_header_border;
    color: $*color_page_title;
    padding-top: 1.3em;
    }

h2#subtitle {
    color: $*color_page_title;
    margin-top: -.8em;
    }

h2#pagetitle {
    color: $*color_page_title;
    font-size: 1.5em; /* restore to default size */
    padding-bottom: 1.2em;
    padding-top: .3em;
    }

h1#title:first-letter,
h2#pagetitle:first-letter {
    color: $*color_header_accent;
    }

/* Navigation
***************************************************************************/

.navigation {
    font-family: $*font_entry_title;
    text-align: right;
    text-transform: lowercase;
    }

.topnav {
    margin-top: 1em;
    min-height: 1.2em;
    }

.page-recent .bottomnav,
.page-read .bottomnav,
.page-network .bottomnav,
.page-day .bottomnav {
    margin-top: -2.5em;
    }

.page-day .navigation .page-forward:before {
    content: "|";
    }

.page-day .navigation .page-forward a {
    padding-left: 1.1em;
    }

/* Entries
***************************************************************************/

.entry-wrapper {
    margin: 1em 0 4em;
    }

.entry {
    border-bottom: none;
    border-left: none;
    border-right: none;
    }

.entry .header {
    padding: 1em 0 0;
    }

.entry .entry-title {
    display: inline;
    padding: 0;
    }

.entry .access-filter img,
.entry .restrictions img {
    display: inline;
    padding-left: .5em;
    }

.entry .datetime {
    float: right;
    display: inline-block;
    font-size: 1.1em;
    font-family: $*font_entry_title;
    text-transform: none;
    }

.datetime a {
    color: $*color_entry_title;
    }

.datetime a:hover {
    color: $*color_entry_link_hover;
    }

.entry .time:before {
    content: "| ";
    }

.entry .contents {
    margin-top: .5em;
    padding: 0;
    line-height: 1.45em;
    }

.has-userpic .entry .userpic {
    margin-top: 1em;
    text-align: center;
    }

.contents .userpic img {
    background: $*color_entry_text;
    border: 1px solid $*color_entry_text;
    padding: 5px;
    }

.entry .poster {
    color: $*color_page_usernames;
    display: block;
    padding-bottom: 2em;
    }

.entry-content {
    margin-top: -1em;
    padding: 0 0 2em;
    }

.entry-content ul,
.entry-content ol {
    margin: 1em 1em 1em 3em;
    }

.metadata {
    line-height: 1.2em;
    padding: 0 0 1em;
    }

.metadata-label {
    font-weight: normal;
    text-transform: uppercase;
    }

.metadata ul,
.metadata ul li {
    margin: 0;
    padding: 0;
    }

.metadata-item-xpost a {
    padding-right: .5em;
    }

.entry .footer {
    clear: left;
    }

.footer ul {
    margin: 0;
    }

.tag {
    font-family: $*font_entry_title;
    line-height: 1.2em;
    padding: 0 0 .7em;
    text-transform: lowercase;
    }

.tag-text {
    text-transform: uppercase;
    }

.entry-management-links {
    float: left;
    padding: 1em 0 1em .5em;
    }

.entry-interaction-links {
    background: $*color_entry_interaction_links_background;
    padding: 1em .5em 1em 0;
    text-align: right;
    }

.entry-interaction-links li,
.entry-management-links li {
    font-family: $*font_entry_title;
    text-transform: lowercase;
    padding: .5em !important;
    }

.entry-management-links li a {
    color: $*color_entry_interaction_links;
    }

.entry-interaction-links li a:visited,
.entry-management-links li a:visited {
    color: $*color_entry_interaction_links_visited;
    }

.entry-interaction-links li a:hover,
.entry-management-links li a:hover {
    color: $*color_entry_interaction_links_hover;
    }

.entry-interaction-links li a:active,
.entry-management-links li a:active {
    color: $*color_entry_interaction_links_active;
    }

/* Comments
***************************************************************************/

#qrform {
    margin-top: 1em !important;
    }

.comment-pages {
    padding-bottom: 1em;
    text-align: center;
    }

.comment-pages.bottompages,
.comment-pages.bottompages {
    padding-top: 1em;
    }

#comments {
    margin-top: -1em;
    }

.comment-content ul,
.comment-content ol {
    margin: 1em 1em 1em 3em;
    }

.comment-wrapper {
    border-top: 1px solid $*color_entry_border;
    margin: .5em 0 0;
    }

.partial {
    padding: .3em 0 !important;
    }

.partial .comment {
    display: inline !important;
    padding: 1em 0;
    }

.partial .comment-title {
    display: inline !important;
    padding-right: .5em;
    }

.comment .comment-title a:hover {
    color: $*color_page_link_hover;
    }

.comment .header .datetime {
    padding: 0 0 .5em;
    text-transform: uppercase;
    }

.has-userpic .comment .userpic {
    text-align: center;
    }

.comment .contents {
    clear: both;
    line-height: 1.45em;
    padding: .5em 0;
    }

.comment .poster {
    margin: 0;
    }

.comment-poster .anonymous {
    color: $*color_page_link !important;
    font-weight: bold;
    }

.comment .poster-ip {
    color: $*color_page_link;
    }

.comment-content {
    padding: .8em 0 .5em;
    }

.comment .footer {
    clear: both;
    padding: 1em .5em 0;
    }

.comment .multiform-checkbox {
    font-family: $*font_comment_title;
    float: right;
    margin-top: -1px; /* line up the checkbox */
    padding-left: .5em;
    text-transform: lowercase;
    }

.comment-interaction-links {
    padding-bottom: 1em;
    text-align: right;
    }

.comment-management-links {
    float: right;
    }

.comment-interaction-links li,
.comment-management-links li {
    border-right: 1px solid $*color_comment_interaction_links_border;
    font-family: $*font_comment_title;
    padding: 0 .5em;
    text-transform: lowercase;
    }

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

.comment-interaction-links a:hover,
.comment-management-links a:hover {
    color: $*color_page_link_hover;
    }

.edittime {
     color: $*color_page_link;
     padding-top: 1em;
    }

.bottomcomment {
    padding: 2.2em 0 .5em;
    text-align: center;
    }

.bottomcomment .entry-interaction-links{
    margin-bottom: 1.5em;
    }

/* Archive Pages
***************************************************************************/

.page-archive .navigation {
    text-align: center;
    }

.page-archive .bottomnav {
    padding-top: 1em;
    }

#archive-year {
    padding: 2.2em 4em 0;
    }

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

.month-wrapper .header {
    padding: 0 0 .5em 2em;
    }

.month-wrapper .contents caption {
    display: none;
    }

table.month {
    text-align: center;
    width: 90%;
    }

table.month th {
    border: 1px solid $*color_calendar_border;
    border-left: none;
    font-weight: normal;
    height: 4em;
    padding: .5em;
    }

table.month td {
    border-bottom: 1px solid $*color_calendar_border;
    border-right: 1px solid $*color_calendar_border;
    height: 4em;
    width: 4em;
    }

table.month td:first-child,
table.month th:first-child {
    border-left: 1px solid $*color_calendar_border;
    }

.month-wrapper .day-has-entries {
    background: $*color_calendar_background;
    color: $*color_calendar_text;
    }

.month-wrapper .day-has-entries a {
    color: $*color_calendar_link;
    }

.month-wrapper .day-has-entries:hover {
    background: $*color_calendar_background_hover;
    color: $*color_calendar_text_hover;
    }

.month-wrapper .day-has-entries a:visited {
    color: $*color_calendar_link_visited;
    }

.month-wrapper .day-has-entries:hover p a {
    color: $*color_calendar_link_hover;
    }

.month-wrapper .day-has-entries a:active {
    color: $*color_calendar_link_active;
    }

.month-wrapper .footer {
    padding-right: 2.5em;
    padding-top: 1em;
    text-align: right;
    }

#archive-month {
    padding-top: 2.2em;
    }

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

#archive-month .topnav {
    padding-top: .8em;
    }

#archive-month .bottomnav {
    margin-top: .5em;
    }

#archive-month .topnav {
    border-top: 1px solid $*color_entry_border;
    }

.navigation .month-back,
.navigation .month-forward {
    text-align: center;
    }

#archive-month .month {
    margin-top: .7em;
    padding: 1em 2em 0;
    }

.month h3.entry-title {
    $entry_title_font
    }

dd.month {
    display: inline;
    }

.month dl, .month dt, .month dd {
    margin: 0;
    padding: 0;
    }

.month .datetime,
.month .access-filter,
.month .entry-title {
    padding-right: 5px;
    }

#archive-day .day {
    border-top: 1px solid $*color_entry_border;
    margin-top: 1em;
    }

h3.day-date {
    font-family: $*font_entry_title;
    padding-top: 1em;
    }

/* Tags Page
***************************************************************************/

.tags-container {
    border-top: 1px solid $*color_entry_title;
    padding: 0 1em;
    }

.tags-container h2 {
    font-family: $*font_entry_title;
    padding: .5em 0 1em;
    }

.tags-container .ljtaglist {
    line-height: 1.8em;
    }

.tags-container ul.ljtaglist {
    list-style: none;
    }

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

/* Icons Page
***************************************************************************/

.icons-container {
    border-top: 1px solid $*color_entry_title;
    padding: 0 1em;
    }

.icons-container h2 {
    font-family: $*font_entry_title;
    padding: .5em 0 1em;
    }

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

.icons-container .icon {
    margin: 1.5em 0;
    }

.icon-image {
    float: left;
    clear: left;
    margin-bottom: .25em;
    min-width: 100px;
    padding-right: 1em;
    }

.icon-info {
    min-height: 100px;
    }

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

.icon-info .default {
    text-decoration: underline;
    }

.icon-keywords ul {
    margin: 0;
    }

/* Modules
***************************************************************************/

.module {
    border-bottom: none;
    border-left: none;
    border-right: none;
    line-height: 1.1em;
    margin-bottom: 2.5em;
    }

@media $medium_media_query {
    .one-column #secondary .module,
    .one-column #tertiary .module,
    .two-columns #tertiary .module {
        float: left;
        margin-right: 2em;
        }

    .one-column-split #primary,
    .one-column #footer,
    .two-columns #footer {
        clear: both;
        }
}

.module h2 {
    padding-top: .8em;
    text-transform: lowercase;
    }

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

.module-content {
    padding-top: .8em
    }

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

.module-content li {
    padding: .3em 0;
    }

#header .module {
    border: none;
    }

#header .module-navlinks ul {
    margin: -.8em 0 1.8em;
    }

#header .module-navlinks {
    margin-bottom: 0;
    }

#header .module-navlinks li {
    $module_title_font
    display: inline;
    padding: 0 1em 0 0 !important;
    }

.module-userprofile .userpic img {
    background: $*color_module_title;
    border: 1px solid $*color_module_title;
    padding: 5px;
    }

.module-userprofile .journal-website-name {
    padding-top: .8em;
    }

ul.userlite-interaction-links {
    list-style: none;
    }

ul.userlite-interaction-links li {
    display: block;
    }

.module-calendar .module-content {
    padding-top: 1em;
    }

.module-calendar table {
    text-align: center;
    width: 100%;
    }

.module-calendar th,
.module-calendar td {
    border: 1px solid $*color_calendar_background;
    height: 2em;
    line-height: 2em;
    }

.module-calendar td a {
    background: $*color_calendar_background;
    color: $*color_calendar_link;
    display: block;
    text-align: center;
    }

.module-calendar td a:visited {
    color: $*color_calendar_link_visited;
    }

.module-calendar td a:hover {
    background: $*color_calendar_background_hover;
    color: $*color_calendar_link_hover;
    }

.module-calendar td a:active {
    color: $*color_calendar_link_active;
    }

.module-tags_multilevel li {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
    }

.module-tags_multilevel li ul li {
    margin-left: -.5em;
    padding-left: 2em;
    }

.module-tags_cloud .module-list {
    line-height: 1.8em;
    }

.module-tags_cloud .module-list a {
    text-decoration: underline;
    }

.manage-tags-link, .manage-link {
    font-family: $*font_module_heading;
    padding-top: .8em;
    text-transform: lowercase;
    }

.module-powered, .module-time {
    padding-top: .8em;
    border-top: 1px solid $*color_module_title;
    }

.module-powered a,
.module .manage-link a {
    color: $*color_module_accent;
    }

.module-powered a:visited,
.module .manage-link a:visited {
    color: $*color_module_link_visited;
    }

.module-powered a:hover,
.module .manage-link a:hover {
    color: $*color_module_link_hover;
    }

.module-powered a:active,
.module .manage-link a:active {
    color: $*color_module_link_active;
    }

.module-search .search-box {
    margin-right: 2px;
    padding: 1px;
    }

/* Footer
***************************************************************************/

#footer {
    border-top: 2px solid $*color_footer_border;
    margin-top: 3em;
    padding: 0;
    text-transform: lowercase;
    }

#footer .inner {
    padding: 2em 0;
    }

$userpic_css

""";
}